Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make a new Eclipse project template?

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?

like image 437
Mohit Deshpande Avatar asked Mar 10 '10 01:03

Mohit Deshpande


2 Answers

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.

like image 102
Mark Storer Avatar answered Sep 22 '22 03:09

Mark Storer


You need to write an Eclipse plugin for that, and concentrate on New Project Wizard.

Writing Eclipse plugins is covered in Stack Overflow question How to write a plugin for Eclipse?.

like image 32
Nevena Avatar answered Sep 19 '22 03:09

Nevena