net.refractions.udig.tool.info
Class Policy

java.lang.Object
  extended by net.refractions.udig.tool.info.Policy

public class Policy
extends java.lang.Object

Policy implements Internationalization convenience methods for the plugin and makes progress monitor policy decisions.


Field Summary
protected static java.util.ResourceBundle bundle
          The resource bundle to get strings from
 
Constructor Summary
Policy()
           
 
Method Summary
static java.lang.String bind(java.lang.String key)
          Gets a string from the resource bundle.
static java.lang.String bind(java.lang.String id, java.lang.Object binding)
          Lookup the message with the given ID in this catalog and bind its substitution locations with the given string.
static java.lang.String bind(java.lang.String key, java.lang.Object[] args)
          Gets a string from the resource bundle and binds it with the given arguments.
static java.lang.String bind(java.lang.String id, java.lang.Object binding1, java.lang.Object binding2)
          Lookup the message with the given ID in this catalog and bind its substitution locations with the given strings.
static java.lang.String bind(java.lang.String id, java.lang.Object binding1, java.lang.Object binding2, java.lang.Object binding3)
          Lookup the message with the given ID in this catalog and bind its substitution locations with the given strings.
static java.lang.String bind(java.lang.String key, java.util.ResourceBundle b)
          Gets a string from the resource bundle.
static void checkCanceled(IProgressMonitor monitor)
          Checks if the progress monitor is canceled.
static void cleanup()
          Clean up after bundle.
static java.util.ResourceBundle getBundle()
           
static void localize(java.lang.String bundleName)
          Creates a NLS catalog for the given locale.
static IProgressMonitor monitorFor(IProgressMonitor monitor)
          Returns a monitor for the given monitor
static IProgressMonitor subMonitorFor(IProgressMonitor monitor, int ticks)
          Set up a monitor - for a sub taks.
static java.lang.String toTruncatedPath(IPath path, int split)
          Search backwards until split separators are found
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

bundle

protected static java.util.ResourceBundle bundle
The resource bundle to get strings from

Constructor Detail

Policy

public Policy()
Method Detail

localize

public static void localize(java.lang.String bundleName)
Creates a NLS catalog for the given locale.

Parameters:
bundleName - the name of the bundle

cleanup

public static void cleanup()
Clean up after bundle.


bind

public static java.lang.String bind(java.lang.String id,
                                    java.lang.Object binding)
Lookup the message with the given ID in this catalog and bind its substitution locations with the given string.

Parameters:
id - the id to look up
binding - the string to bind to the result
Returns:
the bound string

bind

public static java.lang.String bind(java.lang.String id,
                                    java.lang.Object binding1,
                                    java.lang.Object binding2)
Lookup the message with the given ID in this catalog and bind its substitution locations with the given strings.

Parameters:
id - the id to look up
binding1 - the first string to bind to the result
binding2 - the second string to bind to the result
Returns:
the bound string

bind

public static java.lang.String bind(java.lang.String id,
                                    java.lang.Object binding1,
                                    java.lang.Object binding2,
                                    java.lang.Object binding3)
Lookup the message with the given ID in this catalog and bind its substitution locations with the given strings.

Parameters:
id - the id to look up
binding1 - the first string to bind to the result
binding2 - the second string to bind to the result
binding3 - the third string to bind to the result
Returns:
the bound string

bind

public static java.lang.String bind(java.lang.String key,
                                    java.util.ResourceBundle b)
Gets a string from the resource bundle. We don't want to crash because of a missing String. Returns the key if not found.

Parameters:
key - the id to look up
b - nudle used for key binding
Returns:
the string with the given key

bind

public static java.lang.String bind(java.lang.String key)
Gets a string from the resource bundle. We don't want to crash because of a missing String. Returns the key if not found.

Parameters:
key - the id to look up
Returns:
the string with the given key

bind

public static java.lang.String bind(java.lang.String key,
                                    java.lang.Object[] args)
Gets a string from the resource bundle and binds it with the given arguments. If the key is not found, return the key.

Parameters:
key - the id to look up
args - the strings to bind to the result
Returns:
the bound string

checkCanceled

public static void checkCanceled(IProgressMonitor monitor)
Checks if the progress monitor is canceled.

Parameters:
monitor - the onitor to check for cancellation
Throws:
OperationCanceledException - if the monitor is canceled

monitorFor

public static IProgressMonitor monitorFor(IProgressMonitor monitor)
Returns a monitor for the given monitor

Parameters:
monitor - the monitor to return a monitor for
Returns:
a monitor for the given monitor

subMonitorFor

public static IProgressMonitor subMonitorFor(IProgressMonitor monitor,
                                             int ticks)
Set up a monitor - for a sub taks.

Parameters:
monitor -
ticks -
Returns:
ProgressMonitor of the provided number of ticks

toTruncatedPath

public static java.lang.String toTruncatedPath(IPath path,
                                               int split)
Search backwards until split separators are found

Parameters:
path -
split -
Returns:
like path shorter

getBundle

public static java.util.ResourceBundle getBundle()