Command Images

org.eclipse.ui.commandImages

3.2

The images extension point provides a way of linking different types of images and icons to a particular command. These images can be used, as appropriate, wherever the command appears in the user interface. To accommodate some boundary cases (e.g., tool bar drop-down items), it is possible to group the images for a particular commands into "styles". These styles can then be specifically requested when a command is to be displayed.

<!ELEMENT extension (image*)>

<!ATTLIST extension

point CDATA #REQUIRED

id    CDATA #IMPLIED

name  CDATA #IMPLIED>


<!ELEMENT image EMPTY>

<!ATTLIST image

commandId    CDATA #REQUIRED

icon         CDATA #REQUIRED

disabledIcon CDATA #IMPLIED

hoverIcon    CDATA #IMPLIED

style        CDATA #IMPLIED>

The images to associate with a particular command.



<extension point=

"org.eclipse.ui.commandsImages"

>

<image commandId=

"ProfileLast"

hoverIcon=

"icons/full/etool16/profile.gif"

disabledIcon=

"icons/full/dtool16/profile.gif"

icon=

"icons/full/etool16/profile.gif"

/>

<image commandId=

"ProfileLast"

hoverIcon=

"icons/full/etool16/history.gif"

disabledIcon=

"icons/full/dtool16/history.gif"

icon=

"icons/full/etool16/history.gif"

imageStyle=

"toolbar"

/>

</extension>

Within the workbench, it is possible to get images for commands using the org.eclipse.ui.handlers.ICommandImageService interface. This interface can be retrieved from supporting workbench objects, such as IWorkbench itself. To retrieve the service, you would make a call like IWorkbench.getAdapter(ICommandImageService.class).