Curtis
Curtis

Reputation: 4031

How can I specify the icon for a new wizard in Eclipse?

I've added a custom new project wizard to Eclipse which uses the preexisting Java nature. Here's the block from plugin.xml where I add it:

  <wizard
        class="com.corp.eclipse.wizard.project.NewExtensionWizard"
        descriptionImage="/rsrc/icons/app.png"
        finalPerspective="org.eclipse.jdt.ui.JavaPerspective"
        icon="rsrc/icons/app.png"
        id="framer.newExtensionWizard"
        name="Extension Project"
        project="true">
  </wizard>

The "Extension Project" project type shows up just fine in the "New" dialog, but the icon is not displayed. Does anyone know if there's a trick to getting icons attached to wizards in Eclipse? This is Eclipse 3.5.2.

Upvotes: 4

Views: 1092

Answers (2)

Erika Redmark
Erika Redmark

Reputation: 489

I had the same issue as yours and I had to breakpoint through the initialisation code to finally find out why. This may be your issue:

In AbstractUIPlugin.class, imageDescriptorFromPlugin(...)

// if the bundle is not ready then there is no image
Bundle bundle = Platform.getBundle(pluginId);
if (!BundleUtility.isReady(bundle)) {
    return null;
}

The bundle may not be loading. This can happen if the id of the plugin is not a prefix of the extension point (as was my case). So, the id for your wizard is framer.newExtensionWizard. Unless your entire plugin id (Bundle-SymbolicName in MANIFEST.MF) is just framer, the method is not going to find the bundle, and thus the image will not appear.

The solution then is to make sure that whatever id you give your plugin, make sure all extension point ids use that id as a prefix.

Upvotes: 2

Prakash G. R.
Prakash G. R.

Reputation: 4892

Is rsrc is your source folder? Usually icons folder is kept under the project directly. You can move it out of the source folder and also specify it in the build.properties.

Upvotes: 0

Related Questions