Showing posts with label template. Show all posts
Showing posts with label template. Show all posts

Monday, September 7, 2009

New Plug-in Wizard template: Can I add Import-Package programmatically?

Dear Planet Eclipse readers, please take notice of my problem with adding an Import-Package to the MANIFEST.MF using the Plug-in Wizard templating mechanism. Any suggestions and pointers very much appreciated! I'd really like to remove step 7 from the following tutorial:

Last Friday, the Bioclipse 2.1 development series moved to Eclipse 3.5, so I had to update the Bioclipse SDK too, which we developed earlier.

With a new Eclipse version also comes new screenshots to talk you through the process of setting up a new Bioclipse manager plugin.

Step 1
Right click in your workspace navigator, and choose New -> Project:



Step 2
And select to create a new Plug-in Project:



Step 3
Give a project name, such as net.bioclipse.xml:



Step 4
Tune the ID, Version, Name, and Provider to your liking:



Step 5
Then select Bioclipse Manager:



Step 6
The next wizard page is specific the the Bioclipse manager, and asks a manager namespace, which will be used as prefix in the JavaScript Console. For example, if I make the namespace xml, then I will type xml.someMethod() inside the JavaScript. The default manager name is typically OK by default:

Then click Finish and let Eclipse set up the new project.

Step 7
Because I have not figured out yet how to add Import-Package to the MANIFEST.MF programmatically, you will have to do this manually. Add the last line of the next screenshot to the MANIFEST.MF of your new plugin:



Update: I found a hack to add the Import-Package programmatically, by overwriting the execute(IProject project, IPluginModelBase model, IProgressMonitor monitor) in the Template class.