I. Graphics in the plugin.xml

Most UI extension points allow you to specify a graphic file directly in the extension definition. You can then assign these graphic files to different UI elements (such as views, editors, actions, or wizards) in the plugin.xml file. The procedure is the same for all these elements.

 

Procedure

 

1. Import graphics into the icons folder

The address for storing these graphic files is always ascertained in relation to the current plug-in.

For this reason, import the graphic you want into the icons folder for the current plug-in.

 

2. Specify the icon attribute in the plugin.xml file

Assign the name of the graphic file (relative to the plug-in) to the icon attribute in the extension definition.

 

Example

 

This example shows how the graphic file my_image.gif is linked to a view element using the extension point org.eclipse.ui.views.

 

 

   <extension point="org.eclipse.ui.views">

      <view

            name="My View"

            icon="icons/my_image.gif"

            category="ui.project.test"

            class="ui.myproject.views.MyView"

            id="ui.myproject.views.MyView">

      </view>

   </extension>