Currently one has to configure natures on a project explicitly so they are persisted in the .project file.
This is very unflexible and has some drawbacks:
- Natures can be missing and one gets a warning then
- A required nature for a project might disable functions and the user has to find out why the desired function is not there
- We need to have code to explicitly enable natures or "convert" projects
- It requires to retain project files in the SCM
Instead I think we should have some way to implicitly enable a nature on a project (without persisting it) based on the enable we already have for run shortcuts for example:
<enablement>
<with variable="selection">
<count value="1"/>
<iterate>
<adapt type="org.eclipse.jdt.core.IJavaElement">
<test property="org.eclipse.jdt.core.isInJavaProjectWithNature" value="org.eclipse.pde.PluginNature"/>
<test property="org.eclipse.jdt.core.hasTypeOnClasspath" value="junit.framework.Test"/>
<test property="org.eclipse.jdt.junit.canLaunchAsJUnit" forcePluginActivation="true"/>
</adapt>
</iterate>
</with>
</enablement>
for example in pde one has the pluginNature that might be enabled when there is a META-INF/MANIFEST.MF file, in fact tycho-pomless is working that way with great success, also m2e nature can be enabled by having a pom.xml, a java nature is probabbly always useful if any *.java file is in the project and so on, for the case that one does NOT want a nature we then can have a syntax like <nature>!org.eclipse.pde.PluginNature</nature> to explicitly disable a nature if desired.
Please note that this will not automatically enable any builders or classpath entries, these will still need to be explicitly set so this will only enable e.g. menu entries or other actions / code to build on the fact that a given nature was detected.
Currently one has to configure natures on a project explicitly so they are persisted in the
.projectfile.This is very unflexible and has some drawbacks:
Instead I think we should have some way to implicitly enable a nature on a project (without persisting it) based on the enable we already have for run shortcuts for example:
for example in pde one has the
pluginNaturethat might be enabled when there is a META-INF/MANIFEST.MF file, in fact tycho-pomless is working that way with great success, also m2e nature can be enabled by having apom.xml, a java nature is probabbly always useful if any*.javafile is in the project and so on, for the case that one does NOT want a nature we then can have a syntax like<nature>!org.eclipse.pde.PluginNature</nature>to explicitly disable a nature if desired.Please note that this will not automatically enable any builders or classpath entries, these will still need to be explicitly set so this will only enable e.g. menu entries or other actions / code to build on the fact that a given nature was detected.