I am using a kind of framework where every time I make a new Java project. I have to arrange the files in the appropriate packages and reference the appropriate external JAR libraries. How do I make a new project template like in the New Project dialog under a new folder?
You need to write an Eclipse plugin for that, and concentrate on New Project Wizard. About writing Eclipse plugins, it is covered in Stack Overflow question How to write a plugin for Eclipse?.
I've just done a bit of research on this for our own nefarious purposes, and found the answer.
You need to create an Eclipse plugin that uses the org.eclipse.ui.newWizards
package. You can define your own category or use an existing one once you find the category ID. To create a new project wizard rather than a new resource wizard, you need to set the "project=true".
Also, your plugin must contain a class that implement org.eclipse.ui.INewWizard
. Clicking on the class link from the plugin.xml
editor will do the trick.
That class must do all the work in the performFinish
override, and must return true to indicate that it actually did its thing and the wizard can close. This is where you create files, directories, set natures, and so forth.
来源:https://stackoverflow.com/questions/2414020/how-to-make-a-new-eclipse-project-template