public class TelesalesImages
extends java.lang.Object
The class stores some images as descriptors, and some are stored as real images in the registry. This is a pure speed-space trade-off. The trick for users of this class is that images obtained from the registry (using getImage()), do not 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. You can change an image from being stored as a descriptor to a registry image, or vice-versa. But make sure that all users of the image are calling the correct getImage...() method and handling disposal correctly.
Images:
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.
Where are the images?
The images (typically GIFs) are found in the icons directory under the resources plugins install directory.
How to add a new image ?
Modifier and Type | Field and Description |
---|---|
static java.lang.String | COPYRIGHT
IBM copyright notice field
|
static java.lang.String | ICONS_PATH
Location of the icons
|
Constructor and Description |
---|
TelesalesImages() |
Modifier and Type | Method and Description |
---|---|
static void | declareImage(java.lang.String key, java.lang.String path)
Declare an ImageDescriptor in the descriptor table.
|
static void | declareRegistryImage(java.lang.String key, java.lang.String path)
Declare an image in the registry table.
|
static org.eclipse.swt.graphics.Image | getImage(org.eclipse.jface.resource.ImageDescriptor descriptor)
Returns the image assiciated with the given image descriptor.
|
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.ImageDescriptor | getImageDescriptorFromExtension(org.eclipse.core.runtime.IExtension extension, java.lang.String subdirectoryAndFilename)
Convenience Method.
|
static org.eclipse.jface.resource.ImageDescriptor | getImageDescriptorFromPlugin(org.osgi.framework.Bundle bundle, java.lang.String subdirectoryAndFilename)
Convenience Method.
|
static org.eclipse.jface.resource.ImageDescriptor | getImageDescriptorFromPluginID(java.lang.String pluginId, java.lang.String subdirectoryAndFilename)
Convenience Method.
|
static org.eclipse.jface.resource.ImageRegistry | getImageRegistry()
Returns the ImageRegistry.
|
static org.eclipse.jface.resource.ImageRegistry | initializeImageRegistry()
Initialize the image registry by declaring all of the required graphics.
|
public static final java.lang.String COPYRIGHT
public static final java.lang.String ICONS_PATH
public static final void declareImage(java.lang.String key, java.lang.String path)
public static final void declareRegistryImage(java.lang.String key, java.lang.String path)
public static org.eclipse.swt.graphics.Image getImage(java.lang.String symbolicName)
public static org.eclipse.swt.graphics.Image getImage(org.eclipse.jface.resource.ImageDescriptor descriptor)
public static org.eclipse.jface.resource.ImageDescriptor getImageDescriptor(java.lang.String symbolicName)
public static org.eclipse.jface.resource.ImageDescriptor getImageDescriptorFromExtension(org.eclipse.core.runtime.IExtension extension, java.lang.String subdirectoryAndFilename)
This method is convenience and only intended for use by the workbench. This is because this method explicitly uses the workbench's registry for caching/retrieving images from other extensions. Other plugins must use their own registry. This convenience method is subject to removal.
Note:
The parameter subdirectoryAndFilename must not have any leading period (.) or path separators (/ or \). Clients should use icons/mysample.gif (not ./icons/mysample.gif).
Note:
This consults the plugin for extension and obtains its installation location. All requested images are assumed to be in a directory below and relative to that plugin's installation directory.
public static org.eclipse.jface.resource.ImageDescriptor getImageDescriptorFromPlugin(org.osgi.framework.Bundle bundle, java.lang.String subdirectoryAndFilename)
This method is convenience and only intended for use by the workbench. This is because this method explicitly uses the workbench's registry for caching/retrieving images from other extensions. Other plugins must use their own registry. This convenience method is subject to removal.
Note:
The parameter subdirectoryAndFilename must not have a leading period (.) or path separators (/ or \). Clients should use icons/mysample.gif (not ./icons/mysample.gif).
Note:
This consults the plugin for extension and obtains its installation location. All requested images are assumed to be in a directory below and relative to that plugin's installation directory or one of its fragments.
public static org.eclipse.jface.resource.ImageDescriptor getImageDescriptorFromPluginID(java.lang.String pluginId, java.lang.String subdirectoryAndFilename)
This method is convenience and only intended for use by the workbench. This is because it explicitly uses the workbench's registry for caching/retrieving images from other extensions. Other plugins must use their own registry. This convenience method is subject to removal.
Note:
The parameter subdirectoryAndFilename must not have any leading period (.) or path separators (/ or \). Clients should use icons/mysample.gif (not ./icons/mysample.gif).
Note:
This consults the plugin for extension and obtains its installation location. All requested images are assumed to be in a directory below and relative to that plugin's installation directory.
public static org.eclipse.jface.resource.ImageRegistry getImageRegistry()
public static org.eclipse.jface.resource.ImageRegistry initializeImageRegistry()
Prefix conventions:
Wizard banners WIZBAN_ Preference banners PREF_BAN_ Property page banners PROPBAN_ Color toolbar CTOOL_ Enable toolbar ETOOL_ Disable toolbar DTOOL_ Local enabled toolbar ELCL_ Local disabled toolbar DLCL_ Object large OBJL_ Object small OBJS_ View VIEW_ Product images PROD_ Misc images MISC_
Where are the images?
The images (typically GIFs) are found in the same location as this plugin class. This may mean the same package directory as the package holding this class. The images are declared using this.getClass() to ensure they are looked up by this plugin class.