Reputation: 11565
I am writing an eclipse plug-in and I need to provide a functionality to let the user create a custom project which is basically a plain old Java project with my jar as a dependency and my sample class in the source folder.
It should also have my custom nature (this is to tag the project / change its icon so that it stands out visually).
The user must be able to choose at least the name of the project and its location, and preferably the Java execution environment because it must be 8+.
My understanding is the way to do this is to create a custom org.eclipse.ui.newWizards
extension point. I have considered following solutions :
org.eclipse.jdt.internal.ui.wizards.JavaProjectWizard
, to just add my jar, class and custom nature at creation. Problem is this class is "not API" and I should not be extending it.What would be the best solution in your opinion?
Upvotes: 3
Views: 918
Reputation: 111142
As you mention you should not use JavaProjectWizard as this is an internal class and may be changed without notices.
You can use org.eclipse.ui.wizards.newresource.BasicNewProjectResourceWizard
to create a project. This does not let you change the wizard pages but you can override the performFinish
to do the additional operations you need.
Adding the Java nature to the project will indeed make the various Java preference pages available.
Upvotes: 1