Eclipse Platform
Release 3.1

org.eclipse.ui.commands
Interface ICommandImageService


public interface ICommandImageService

Provides a look-up facility for images associated with commands.

The type of an image indicates the state of the associated command within the user interface. The supported types are: TYPE_DEFAULT (to be used for an enabled command), TYPE_DISABLED (to be used for a disabled command) and TYPE_HOVER (to be used for an enabled command over which the mouse is hovering).

The style of an image is an arbitrary string used to distinguish between sets of images associated with a command. For example, a command may appear in the menus as the default style. However, in the toolbar, the command is simply the default action for a toolbar drop down item. As such, perhaps a different image style is appropriate. The classic case is the "Run Last Launched" command, which appears in the menu and the toolbar, but with different icons in each location.

This interface should not be implemented or extended by clients.

Since:
3.2

Field Summary
static int TYPE_DEFAULT
          The type of image to display in the default case.
static int TYPE_DISABLED
          The type of image to display if the corresponding command is disabled.
static int TYPE_HOVER
          The type of image to display if the mouse is hovering over the command and the command is enabled.
 
Method Summary
 ImageDescriptor getImageDescriptor(String commandId)
          Retrieves the default image associated with the given command in the default style.
 ImageDescriptor getImageDescriptor(String commandId, int type)
          Retrieves the image of the given type associated with the given command in the default style.
 ImageDescriptor getImageDescriptor(String commandId, int type, String style)
          Retrieves the image of the given type associated with the given command in the given style.
 ImageDescriptor getImageDescriptor(String commandId, String style)
          Retrieves the default image associated with the given command in the given style.
 void readRegistry()
           Reads the command image information from the registry.
 

Field Detail

TYPE_DEFAULT

public static final int TYPE_DEFAULT
The type of image to display in the default case.

See Also:
Constant Field Values

TYPE_DISABLED

public static final int TYPE_DISABLED
The type of image to display if the corresponding command is disabled.

See Also:
Constant Field Values

TYPE_HOVER

public static final int TYPE_HOVER
The type of image to display if the mouse is hovering over the command and the command is enabled.

See Also:
Constant Field Values
Method Detail

getImageDescriptor

public ImageDescriptor getImageDescriptor(String commandId)
Retrieves the default image associated with the given command in the default style.

Parameters:
commandId - The identifier to find; must not be null.
Returns:
An image appropriate for the given command; may be null.

getImageDescriptor

public ImageDescriptor getImageDescriptor(String commandId,
                                          int type)
Retrieves the image of the given type associated with the given command in the default style.

Parameters:
commandId - The identifier to find; must not be null.
type - The type of image to retrieve. This value must be one of the TYPE constants defined in this interface.
Returns:
An image appropriate for the given command; null if the given image type cannot be found.

getImageDescriptor

public ImageDescriptor getImageDescriptor(String commandId,
                                          int type,
                                          String style)
Retrieves the image of the given type associated with the given command in the given style.

Parameters:
commandId - The identifier to find; must not be null.
type - The type of image to retrieve. This value must be one of the TYPE constants defined in this interface.
style - The style of the image to retrieve; may be null.
Returns:
An image appropriate for the given command; null if the given image style and type cannot be found.

getImageDescriptor

public ImageDescriptor getImageDescriptor(String commandId,
                                          String style)
Retrieves the default image associated with the given command in the given style.

Parameters:
commandId - The identifier to find; must not be null.
style - The style of the image to retrieve; may be null.
Returns:
An image appropriate for the given command; null if the given image style cannot be found.

readRegistry

public void readRegistry()

Reads the command image information from the registry. This will overwrite any of the existing information in the command image service. This method is intended to be called during start-up. When this method completes, this command image service will reflect the current state of the registry.


Eclipse Platform
Release 3.1

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp. and others 2000, 2005. All rights reserved.