Package org.eclipse.wb.swt
Class ResourceManager
- java.lang.Object
-
- org.eclipse.wb.swt.SWTResourceManager
-
- org.eclipse.wb.swt.ResourceManager
-
public class ResourceManager extends SWTResourceManager
Utility class for managing OS resources associated with SWT/JFace controls such as colors, fonts, images, etc. !!! IMPORTANT !!! Application code must explicitly invoke thedispose()method to release the operating system resources managed by cached objects when those objects and OS resources are no longer needed (e.g. on application shutdown) This class may be freely distributed as part of any application or plugin.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceResourceManager.PluginResourceProviderProvider for plugin resources, used by WindowBuilder at design time.
-
Field Summary
-
Fields inherited from class org.eclipse.wb.swt.SWTResourceManager
BOTTOM_LEFT, BOTTOM_RIGHT, LAST_CORNER_KEY, TOP_LEFT, TOP_RIGHT
-
-
Constructor Summary
Constructors Constructor Description ResourceManager()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static ImagedecorateImage(Image baseImage, Image decorator)Returns anImagecomposed of a base image decorated by another image.static ImagedecorateImage(Image baseImage, Image decorator, int corner)Returns anImagecomposed of a base image decorated by another image.static voiddispose()Dispose of cached objects and their underlying OS resources.static voiddisposeImages()Dispose all of the cached images.static ImagegetImage(ImageDescriptor descriptor)Returns anImagebased on the specifiedImageDescriptor.static ImageDescriptorgetImageDescriptor(Class<?> clazz, String path)Returns anImageDescriptorstored in the file at the specified path relative to the specified class.static ImageDescriptorgetImageDescriptor(String path)Returns anImageDescriptorstored in the file at the specified path.static ImagegetPluginImage(Object plugin, String name)Deprecated.UsegetPluginImage(String, String)instead.static ImagegetPluginImage(String symbolicName, String path)Returns anImagebased on aBundleand resource entry path.static ImageDescriptorgetPluginImageDescriptor(Object plugin, String name)Deprecated.UsegetPluginImageDescriptor(String, String)instead.static ImageDescriptorgetPluginImageDescriptor(String symbolicName, String path)Returns anImageDescriptorbased on aBundleand resource entry path.-
Methods inherited from class org.eclipse.wb.swt.SWTResourceManager
disposeColors, disposeCursors, disposeFonts, getBoldFont, getColor, getColor, getColor, getCursor, getFont, getFont, getImage, getImage, getImage
-
-
-
-
Method Detail
-
getImageDescriptor
public static ImageDescriptor getImageDescriptor(Class<?> clazz, String path)
Returns anImageDescriptorstored in the file at the specified path relative to the specified class.- Parameters:
clazz- theClassrelative to which to find the image descriptor.path- the path to the image file.- Returns:
- the
ImageDescriptorstored in the file at the specified path.
-
getImageDescriptor
public static ImageDescriptor getImageDescriptor(String path)
Returns anImageDescriptorstored in the file at the specified path.- Parameters:
path- the path to the image file.- Returns:
- the
ImageDescriptorstored in the file at the specified path.
-
getImage
public static Image getImage(ImageDescriptor descriptor)
Returns anImagebased on the specifiedImageDescriptor.- Parameters:
descriptor- theImageDescriptorfor theImage.- Returns:
- the
Imagebased on the specifiedImageDescriptor.
-
decorateImage
public static Image decorateImage(Image baseImage, Image decorator)
Returns anImagecomposed of a base image decorated by another image.
-
decorateImage
public static Image decorateImage(Image baseImage, Image decorator, int corner)
Returns anImagecomposed of a base image decorated by another image.
-
disposeImages
public static void disposeImages()
Dispose all of the cached images.
-
getPluginImage
@Deprecated public static Image getPluginImage(Object plugin, String name)
Deprecated.UsegetPluginImage(String, String)instead.Returns anImagebased on a plugin and file path.
-
getPluginImage
public static Image getPluginImage(String symbolicName, String path)
Returns anImagebased on aBundleand resource entry path.- Parameters:
symbolicName- the symbolic name of theBundle.path- the path of the resource entry.- Returns:
- the
Imagestored in the file at the specified path.
-
getPluginImageDescriptor
@Deprecated public static ImageDescriptor getPluginImageDescriptor(Object plugin, String name)
Deprecated.UsegetPluginImageDescriptor(String, String)instead.Returns anImageDescriptorbased on a plugin and file path.- Parameters:
plugin- the pluginObjectcontaining the image.name- the path to th eimage within the plugin.- Returns:
- the
ImageDescriptorstored in the file at the specified path.
-
getPluginImageDescriptor
public static ImageDescriptor getPluginImageDescriptor(String symbolicName, String path)
Returns anImageDescriptorbased on aBundleand resource entry path.- Parameters:
symbolicName- the symbolic name of theBundle.path- the path of the resource entry.- Returns:
- the
ImageDescriptorbased on aBundleand resource entry path.
-
dispose
public static void dispose()
Dispose of cached objects and their underlying OS resources. This should only be called when the cached objects are no longer needed (e.g. on application shutdown).
-
-