net.sf.jtreemap.ktreemap.example
Class ResourceManager

java.lang.Object
  extended by net.sf.jtreemap.ktreemap.example.ResourceManager

public class ResourceManager
extends java.lang.Object

Utility class for managing OS resources associated with SWT controls such as colors, fonts, images, etc. !!! IMPORTANT !!! Application code must explicitly invoke the dispose() 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.

Copyright (c) 2003, Instantiations, Inc.
All Rights Reserved

 

Constructor Summary
ResourceManager()
           
 
Method Summary
static org.eclipse.swt.graphics.Image decorateImage(org.eclipse.swt.graphics.Image baseImage, org.eclipse.swt.graphics.Image decorator)
           
static void dispose()
          Dispose of cached objects and their underlying OS resources.
static void disposeColors()
          dispose colors
static void disposeCursors()
          dispose cursors
static void disposeFonts()
          dispose fonts
static void disposeImages()
          dispose images
static void fixCoolBarSize(org.eclipse.swt.widgets.CoolBar bar)
           
static org.eclipse.swt.graphics.Font getBoldFont(org.eclipse.swt.graphics.Font baseFont)
           
static org.eclipse.swt.graphics.Color getColor(int systemColorID)
           
static org.eclipse.swt.graphics.Color getColor(int r, int g, int b)
           
static org.eclipse.swt.graphics.Color getColor(org.eclipse.swt.graphics.RGB rgb)
           
static org.eclipse.swt.graphics.Cursor getCursor(int id)
           
static org.eclipse.swt.graphics.Font getFont(java.lang.String name, int height, int style)
           
static org.eclipse.swt.graphics.Image getImage(java.lang.Class clazz, java.lang.String path)
           
static org.eclipse.swt.graphics.Image getImage(org.eclipse.jface.resource.ImageDescriptor descriptor)
           
static org.eclipse.swt.graphics.Image getImage(java.lang.String path)
           
static org.eclipse.jface.resource.ImageDescriptor getImageDescriptor(java.lang.Class clazz, java.lang.String path)
           
static org.eclipse.jface.resource.ImageDescriptor getImageDescriptor(java.lang.String path)
           
static org.eclipse.swt.graphics.Font getItalicFont(org.eclipse.swt.graphics.Font baseFont)
           
static org.eclipse.swt.graphics.Image getPluginImage(java.lang.Object plugin, java.lang.String name)
           
static org.eclipse.jface.resource.ImageDescriptor getPluginImageDescriptor(java.lang.Object plugin, java.lang.String name)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceManager

public ResourceManager()
Method Detail

decorateImage

public static org.eclipse.swt.graphics.Image decorateImage(org.eclipse.swt.graphics.Image baseImage,
                                                           org.eclipse.swt.graphics.Image decorator)
Parameters:
baseImage -
decorator -
Returns:
the decorating image

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)


disposeColors

public static void disposeColors()
dispose colors


disposeCursors

public static void disposeCursors()
dispose cursors


disposeFonts

public static void disposeFonts()
dispose fonts


disposeImages

public static void disposeImages()
dispose images


fixCoolBarSize

public static void fixCoolBarSize(org.eclipse.swt.widgets.CoolBar bar)
Parameters:
bar -

getBoldFont

public static org.eclipse.swt.graphics.Font getBoldFont(org.eclipse.swt.graphics.Font baseFont)
Parameters:
baseFont -
Returns:
the bold font

getColor

public static org.eclipse.swt.graphics.Color getColor(int systemColorID)
Parameters:
systemColorID -
Returns:
the systemColor

getColor

public static org.eclipse.swt.graphics.Color getColor(int r,
                                                      int g,
                                                      int b)
Parameters:
r -
g -
b -
Returns:
the color

getColor

public static org.eclipse.swt.graphics.Color getColor(org.eclipse.swt.graphics.RGB rgb)
Parameters:
rgb -
Returns:
the color

getCursor

public static org.eclipse.swt.graphics.Cursor getCursor(int id)
Parameters:
id -
Returns:
the cursor

getFont

public static org.eclipse.swt.graphics.Font getFont(java.lang.String name,
                                                    int height,
                                                    int style)
Parameters:
name -
height -
style -
Returns:
the font

getImage

public static org.eclipse.swt.graphics.Image getImage(java.lang.Class clazz,
                                                      java.lang.String path)
Parameters:
clazz -
path -
Returns:
the image

getImage

public static org.eclipse.swt.graphics.Image getImage(org.eclipse.jface.resource.ImageDescriptor descriptor)
Parameters:
descriptor -
Returns:
the image

getImage

public static org.eclipse.swt.graphics.Image getImage(java.lang.String path)
Parameters:
path -
Returns:
the image

getImageDescriptor

public static org.eclipse.jface.resource.ImageDescriptor getImageDescriptor(java.lang.Class clazz,
                                                                            java.lang.String path)
Parameters:
clazz -
path -
Returns:
the ImageDescriptor

getImageDescriptor

public static org.eclipse.jface.resource.ImageDescriptor getImageDescriptor(java.lang.String path)
Parameters:
path -
Returns:
the ImageDescriptor

getItalicFont

public static org.eclipse.swt.graphics.Font getItalicFont(org.eclipse.swt.graphics.Font baseFont)
Parameters:
baseFont -
Returns:
the italic font

getPluginImage

public static org.eclipse.swt.graphics.Image getPluginImage(java.lang.Object plugin,
                                                            java.lang.String name)
Parameters:
plugin -
name -
Returns:
the image

getPluginImageDescriptor

public static org.eclipse.jface.resource.ImageDescriptor getPluginImageDescriptor(java.lang.Object plugin,
                                                                                  java.lang.String name)
Parameters:
plugin -
name -
Returns:
the ImageDescriptor