Replies: 5 comments 1 reply
|
This is something we have discussed with @mickaelistria in the past and the overall goal has been to enable actions/commands/etc. without the need for natures at all if a "condition" is met and thus gradually remove the need for them. |
|
Yes that's what I noticed today, there is an Action but it has |
|
IIRC, Action themselves are somewhat deprecated in favor of commands+handlers. Maybe actions don't allow to leverage full expression support, and that could be one reason they're deprecated. Overall, I don't think we should aim at "implicit" or "dynamic" project natures as it's the opposite of what nature are meant to be, the expression framework does most of the job already. The only valid nowadays case for relying on a nature is if the condition to know whether project matches or not a type is expensive to compute and not possible to re-evaluate often (so the nature definition becomes a type of "cache" of the evaluation value) |
|
@mickaelistria that sounds interesting in this case I have specifically Can you probably create a PR as an example on how one would do this in java? were one can check several thing (for demo of course isJavaNature would be sufficent) |
|
In a plugin.xml <extension point="org.eclipse.core.expressions.definitions">
<definition id="org.eclipse.pde.isInterestingProject">
<with variable="project">
<test property="org.eclipse.jdt.core.isInJavaProjectWithNature" value="org.eclipse.pde.PluginNature"/>
</with>
<!-- extend with other criteria -->
</definition>
</extension>and then any <enableWhen>
<reference definitionId="org.eclipse.pde.isInterestingProject"/>
</enableWhen> |
Uh oh!
There was an error while loading. Please reload this page.
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.
All reactions