org.eclipse.datatools.sqltools.sql.ui
Class SQLImages

java.lang.Object
  extended by org.eclipse.datatools.sqltools.sql.ui.SQLImages

public class SQLImages
extends java.lang.Object

This class provides convenience access to many of the resources required by the workbench. The class stores some images as descriptors, and some are stored as real Images in the registry. This is a pure speed-space tradeoff. The trick for users of this class is that images obtained from the registry (using getImage()), don't require disposal since they are shared, while images obtained using getImageDescriptor() will require disposal. Consult the declareImages method to see if a given image is declared as a registry image or just as a descriptor. If you change an image from being stored as a descriptor to a registry image, or vice-versa, make sure to check all users of the image to ensure they are calling the correct getImage... method and handling disposal correctly. Images: - use getImage(key) to access cached images from the registry. - Less common images are found by calling getImageDescriptor(key) where key can be found in IWorkbenchGraphicConstants This class initializes the image registry by declaring all of the required graphics. This involves creating image descriptors describing how to create/find the image should it be needed. The image is not actually allocated until requested. Some Images are also made available to other plugins by being placed in the descriptor table of the SharedImages class. Where are the images? The images (typically gifs) are found the plugins install directory How to add a new image Place the gif file into the appropriate directories. Add a constant to IWorkbenchGraphicConstants following the conventions Add the declaration to this file


Field Summary
static java.lang.String ICONS_PATH
           
static java.lang.String IMG_EDT_DATABASE
           
static java.lang.String IMG_EDT_DATATYPE
           
static java.lang.String IMG_EDT_DEFAULT
           
static java.lang.String IMG_EDT_DELETE
           
static java.lang.String IMG_EDT_EVENT
           
static java.lang.String IMG_EDT_FUNCTION
           
static java.lang.String IMG_EDT_INSERT
           
static java.lang.String IMG_EDT_INSERT_TRIGGER
           
static java.lang.String IMG_EDT_KEYWORD
           
static java.lang.String IMG_EDT_PARAMETER
           
static java.lang.String IMG_EDT_PROCEDURE
           
static java.lang.String IMG_EDT_SELECT
           
static java.lang.String IMG_EDT_SQL
           
static java.lang.String IMG_EDT_SYSTEM_PROCEDURE
           
static java.lang.String IMG_EDT_TABLE
           
static java.lang.String IMG_EDT_TABLE_ALIAS
           
static java.lang.String IMG_EDT_TRIGGER
           
static java.lang.String IMG_EDT_UNRESERVEDKEYWORD
           
static java.lang.String IMG_EDT_UPDATE
           
static java.lang.String IMG_EDT_VIEW
           
 
Constructor Summary
SQLImages()
           
 
Method Summary
static void declareImage(java.lang.String symbolicName, org.eclipse.jface.resource.ImageDescriptor descriptor, boolean shared)
          Declares a workbench image.
static void dispose()
          Disposes and clears the workbench images.
static org.eclipse.swt.graphics.Image getImage(java.lang.String symbolicName)
          Returns the image stored in the workbench plugin's image registry under the given symbolic name.
static org.eclipse.jface.resource.ImageDescriptor getImageDescriptor(java.lang.String symbolicName)
          Returns the image descriptor stored under the given symbolic name.
static org.eclipse.jface.resource.ImageRegistry getImageRegistry()
          Returns the ImageRegistry.
static org.eclipse.jface.resource.ImageDescriptor getSQLImageDescriptor(java.lang.String relativePath)
          Get the workbench image with the given path relative to ICON_PATH.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ICONS_PATH

public static final java.lang.String ICONS_PATH
See Also:
Constant Field Values

IMG_EDT_SQL

public static final java.lang.String IMG_EDT_SQL
See Also:
Constant Field Values

IMG_EDT_SELECT

public static final java.lang.String IMG_EDT_SELECT
See Also:
Constant Field Values

IMG_EDT_DELETE

public static final java.lang.String IMG_EDT_DELETE
See Also:
Constant Field Values

IMG_EDT_UPDATE

public static final java.lang.String IMG_EDT_UPDATE
See Also:
Constant Field Values

IMG_EDT_INSERT

public static final java.lang.String IMG_EDT_INSERT
See Also:
Constant Field Values

IMG_EDT_DATABASE

public static final java.lang.String IMG_EDT_DATABASE
See Also:
Constant Field Values

IMG_EDT_TABLE

public static final java.lang.String IMG_EDT_TABLE
See Also:
Constant Field Values

IMG_EDT_TABLE_ALIAS

public static final java.lang.String IMG_EDT_TABLE_ALIAS
See Also:
Constant Field Values

IMG_EDT_VIEW

public static final java.lang.String IMG_EDT_VIEW
See Also:
Constant Field Values

IMG_EDT_PROCEDURE

public static final java.lang.String IMG_EDT_PROCEDURE
See Also:
Constant Field Values

IMG_EDT_SYSTEM_PROCEDURE

public static final java.lang.String IMG_EDT_SYSTEM_PROCEDURE
See Also:
Constant Field Values

IMG_EDT_FUNCTION

public static final java.lang.String IMG_EDT_FUNCTION
See Also:
Constant Field Values

IMG_EDT_EVENT

public static final java.lang.String IMG_EDT_EVENT
See Also:
Constant Field Values

IMG_EDT_KEYWORD

public static final java.lang.String IMG_EDT_KEYWORD
See Also:
Constant Field Values

IMG_EDT_UNRESERVEDKEYWORD

public static final java.lang.String IMG_EDT_UNRESERVEDKEYWORD
See Also:
Constant Field Values

IMG_EDT_TRIGGER

public static final java.lang.String IMG_EDT_TRIGGER
See Also:
Constant Field Values

IMG_EDT_INSERT_TRIGGER

public static final java.lang.String IMG_EDT_INSERT_TRIGGER
See Also:
Constant Field Values

IMG_EDT_DEFAULT

public static final java.lang.String IMG_EDT_DEFAULT
See Also:
Constant Field Values

IMG_EDT_DATATYPE

public static final java.lang.String IMG_EDT_DATATYPE
See Also:
Constant Field Values

IMG_EDT_PARAMETER

public static final java.lang.String IMG_EDT_PARAMETER
See Also:
Constant Field Values
Constructor Detail

SQLImages

public SQLImages()
Method Detail

declareImage

public static void declareImage(java.lang.String symbolicName,
                                org.eclipse.jface.resource.ImageDescriptor descriptor,
                                boolean shared)
Declares a workbench image.

The workbench remembers the given image descriptor under the given name, and makes the image available to plug-ins via IWorkbench.getSharedImages(). For "shared" images, the workbench remembers the image descriptor and will manages the image object create from it; clients retrieve "shared" images via ISharedImages.getImage(). For the other, "non-shared" images, the workbench remembers only the image descriptor; clients retrieve the image descriptor via ISharedImages.getImageDescriptor() and are entirely responsible for managing the image objects they create from it. (This is made confusing by the historical fact that the API interface is called "ISharedImages".)

Parameters:
symbolicName - the symbolic name of the image
descriptor - the image descriptor
shared - true if this is a shared image, and false if this is not a shared image
See Also:
ISharedImages.getImage(java.lang.String), ISharedImages.getImageDescriptor(java.lang.String)

getImage

public static org.eclipse.swt.graphics.Image getImage(java.lang.String symbolicName)
Returns the image stored in the workbench plugin's image registry under the given symbolic name. If there isn't any value associated with the name then null is returned. The returned Image is managed by the workbench plugin's image registry. Callers of this method must not dispose the returned image. This method is essentially a convenient short form of WorkbenchImages.getImageRegistry.get(symbolicName).


getImageDescriptor

public static org.eclipse.jface.resource.ImageDescriptor getImageDescriptor(java.lang.String symbolicName)
Returns the image descriptor stored under the given symbolic name. If there isn't any value associated with the name then null is returned. The class also "caches" commonly used images in the image registry. If you are looking for one of these common images it is recommended you use the getImage() method instead.


getImageRegistry

public static org.eclipse.jface.resource.ImageRegistry getImageRegistry()
Returns the ImageRegistry.


dispose

public static void dispose()
Disposes and clears the workbench images. Called when the workbench is shutting down.

Since:
3.1

getSQLImageDescriptor

public static org.eclipse.jface.resource.ImageDescriptor getSQLImageDescriptor(java.lang.String relativePath)
Get the workbench image with the given path relative to ICON_PATH.

Parameters:
relativePath -
Returns:
ImageDescriptor