Eclipse Platform
Release 3.1

org.eclipse.jface.commands
Class CommandImageManager

java.lang.Object
  extended byorg.eclipse.jface.commands.CommandImageManager

public final class CommandImageManager
extends Object

A central lookup facility for images for commands. Images can be associated with commands using this manager.

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.
 
Constructor Summary
CommandImageManager()
           
 
Method Summary
 void bind(String commandId, int type, String style, URL url)
          Binds a particular image path to a command id, type and style triple
 void clear()
          Removes all of the images from this manager.
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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
Constructor Detail

CommandImageManager

public CommandImageManager()
Method Detail

bind

public final void bind(String commandId,
                       int type,
                       String style,
                       URL url)
Binds a particular image path to a command id, type and style triple

Parameters:
commandId - The identifier of the command to which the image should be bound; must not be null.
type - The type of image to retrieve. This value must be one of the TYPE constants defined in this class.
style - The style of the image; may be null.
url - The URL to the image. Should not be null.

clear

public final void clear()
Removes all of the images from this manager.


getImageDescriptor

public final 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; never null.

getImageDescriptor

public final 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 class.
Returns:
An image appropriate for the given command; null if the given image type cannot be found.

getImageDescriptor

public final 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 class.
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 final 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.

Eclipse Platform
Release 3.1

Guidelines for using Eclipse APIs.

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