net.refractions.udig.catalog.ui
Class CatalogUIPlugin

java.lang.Object
  extended by AbstractUIPlugin
      extended by net.refractions.udig.catalog.ui.CatalogUIPlugin

public class CatalogUIPlugin
extends AbstractUIPlugin

Lifecycle & Resource management for RegistryUI.

The CatalogUIPlugin provides access for shared images descriptors.

Example use of a shared image descriptor:

 ImageRegistry images = CatalogUIPlugin.getDefault().getImageRegistry();
 ImageDescriptor image = images.getDescriptor(ISharedImages.IMG_DATASTORE_OBJ);
 

Implementation Note

The CatalogUIPlugin delegates the following resource management tasks: These resources are intended for use by classes within this plugin.

Author:
Jody Garnett, Refractions Research, Inc

Field Summary
static java.lang.String ICONS_PATH
          Icons path (value "icons/")
static java.lang.String ID
          The id of the plug-in
static java.lang.String PREF_OPEN_DIALOG_DIRECTORY
          Preference store for the last directory open by the file selection dialog
 
Constructor Summary
CatalogUIPlugin()
          The constructor.
 
Method Summary
static CatalogUIPlugin getDefault()
          Returns the shared instance.
 ISharedImages getImages()
          Images instance for use with ImageConstants.
static ImageDescriptor icon(IResolve resolve)
           
static ImageDescriptor icon(IResolve resolve, IProgressMonitor monitor)
          Create icon for provided resource, this will block!
static Image image(IResolve resolve)
          Quick and dirty image generated based on ID, this image is shared and should not be disposed.
static boolean isDebugging(java.lang.String trace)
          Performs the Platform.getDebugOption true check on the provided trace
static void log(java.lang.String message2, java.lang.Throwable t)
          Logs the Throwable in the plugin's log.
 void start(BundleContext context)
          Set up shared images.
 void stop(BundleContext context)
          Cleanup after shared images.
static void trace(java.lang.String message)
           
static void trace(java.lang.String message, java.lang.Throwable e)
          Messages that only engage if getDefault().isDebugging()
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ID

public static final java.lang.String ID
The id of the plug-in

See Also:
Constant Field Values

PREF_OPEN_DIALOG_DIRECTORY

public static final java.lang.String PREF_OPEN_DIALOG_DIRECTORY
Preference store for the last directory open by the file selection dialog

See Also:
Constant Field Values

ICONS_PATH

public static final java.lang.String ICONS_PATH
Icons path (value "icons/")

See Also:
Constant Field Values
Constructor Detail

CatalogUIPlugin

public CatalogUIPlugin()
The constructor.

Method Detail

start

public void start(BundleContext context)
           throws java.lang.Exception
Set up shared images.

Parameters:
context -
Throws:
java.lang.Exception
See Also:
org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)

stop

public void stop(BundleContext context)
          throws java.lang.Exception
Cleanup after shared images.

Parameters:
context -
Throws:
java.lang.Exception
See Also:
org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)

getDefault

public static CatalogUIPlugin getDefault()
Returns the shared instance.

Returns:
CatalogUIPlugin singleton

getImages

public ISharedImages getImages()
Images instance for use with ImageConstants.

Returns:
Images for use with ImageConstants.

log

public static void log(java.lang.String message2,
                       java.lang.Throwable t)
Logs the Throwable in the plugin's log.

This will be a user visable ERROR iff:

Parameters:
message -
t -

trace

public static void trace(java.lang.String message,
                         java.lang.Throwable e)
Messages that only engage if getDefault().isDebugging()

It is much prefered to do this:


 private static final String RENDERING = "net.refractions.udig.project/render/trace";
 if (ProjectUIPlugin.getDefault().isDebugging() && "true".equalsIgnoreCase(RENDERING)) {
     System.out.println("your message here");
 }
 

Parameters:
message -
e -

trace

public static void trace(java.lang.String message)

isDebugging

public static boolean isDebugging(java.lang.String trace)
Performs the Platform.getDebugOption true check on the provided trace

Note: ProjectUIPlugin.getDefault().isDebugging() must also be on.

Parameters:
trace - currently only RENDER is defined
Returns:
true if -debug is on for this plugin

image

public static Image image(IResolve resolve)
Quick and dirty image generated based on ID, this image is shared and should not be disposed.

This method does not block and can be safely used to by a LabelProvider. This method does not make use of any information available via an info object (because that would require blocking and be unsafe).

Parameters:
resource -
Returns:
Image representing provided resource
See Also:
glyph

icon

public static ImageDescriptor icon(IResolve resolve)
                            throws java.io.IOException
Throws:
java.io.IOException

icon

public static ImageDescriptor icon(IResolve resolve,
                                   IProgressMonitor monitor)
                            throws java.io.IOException
Create icon for provided resource, this will block!

Parameters:
resource -
Returns:
ImageDescriptor for resource.
Throws:
java.io.IOException