How to allow devs to add a custom nature after project creation? [message #1719171] |
Tue, 05 January 2016 14:04  |
Eclipse User |
|
|
|
I've inherited the codebase for a plugin which is an editor for a custom specification language. The original plugin is able to run the compiler on the entire project, and individual files while in the editor for that file.
It is not presently able to compile all the files in a project when any of the files in the project change. This is necessary when referenced modules are changed, as the referencing module needs to be recompiled.
Therefore, I've started down the path of defining a custom "nature", and eventually a custom Incremental Project Builder. The IPB will be hard enough, but for now I'm just trying to get the basic nature mechanics working.
For now I've just created the skeleton "nature" subclass (implementing IProjectNature). I understand that I have to associate the nature with the project in the "wizard" that is presently creating projects using this plugin. I think I know the proper place to put this code.
Right now, however, I'd like to understand my options for allowing developers to manually add the custom nature to an existing project that was not created using the plugin. The custom nature requires the "maven2Builder" nature, and I understand how to specify that in the plugin.xml.
I know that the "Configure" menu has options like "Convert to Maven Project", which essentially adds the Maven nature to a project. I'm guessing I would have to add an item to this menu for a similar operation.
Is there any typical way in the project properties to add natures to projects?
|
|
|
Re: How to allow devs to add a custom nature after project creation? [message #1719179 is a reply to message #1719171] |
Tue, 05 January 2016 16:42  |
Eclipse User |
|
|
|
There is no standard facility in the platform to allow natures to be added or removed by end users. The closest analog is the Faceted Project Framework in WTP. Unlike natures, project facets are designed to be manipulated by end users. For backwards compatibility, a facet can handle adding/removing a nature. As an example of this you can check out the Java facet that's included in WTP. It allows end-users to add Java support to any Eclipse project.
|
|
|
Powered by
FUDForum. Page generated in 0.03063 seconds