u123
u123

Reputation: 16267

Using eclipse build in icons in plugin.xml

In a plugin I have defined a command in the plugin.xml file. I would like to add the Eclipse default image/icon for the "Open Perspective" button in the toolbar to this command.

In eclipse I have tried to activate the Plugin-in Spy (Shift+Alt+F1) on the icon which gives me the following info:

The contributing plug-in:
org.eclipse.pde.ui (3.6.1.v20110210_r362)

but I cannot find any info on the image used for that specify button in that plugin. I see that other images are specified using:

$nl$/icons/obj16/plugin_javasearch.gif

How to do I:

1) Find the icon used for the "Open Perspective" button?

2) Specify that I want to use that icon for my own command in my own plugin.xml file?

Below is my current definition of my command:

<menuContribution
      allPopups="false"
      locationURI="base.application.menuContribution1">
   <toolbar
         id="base.application.perspective">
      <command
            commandId="openPerspective"
            icon=" IWorkbenchGraphicConstants.IMG_ETOOL_NEW_PAGE"
            style="push">
      </command>
   </toolbar>
</menuContribution>  

Upvotes: 4

Views: 2781

Answers (1)

Paul Webster
Paul Webster

Reputation: 10654

To find the icon you might have to use the brute force approach. Use File>Import...>Plug-ins and Fragments and import some plugins. I wouldn't have thought Open Perspective was in pde (maybe try org.eclipse.ui or org.eclipse.ui.ide) but you can try PDE as well.

As for using it, you can use the platform:/plugin protocol to reference an icon in someone else's plugin. But those filenames are considered "implementation details". While they probably won't change, the plugins have no obligation to keep them the same from release to release.

Upvotes: 5

Related Questions