de.cau.cs.kieler.sim.kiem.config.data
Class Tools

java.lang.Object
  extended by de.cau.cs.kieler.sim.kiem.config.data.Tools

public final class Tools
extends Object

Contains a number of useful tools.
Also contains a number of Strings needed in more than one class.

Rating proposed yellow
(2010-01-27)

Field Summary
static String ADD_PROPERTY_TOOLTIP
          the tooltip for the add property dialog.
static String ADVANCED_MODE_HINT
          the tooltip for the advanced user mode.
static KiemPropertyKeyWrapper AIMED_STEP_DURATION_KEY
          identifier for the step duration.
static String APPLICATION_NAME
          the name of the application.
static String ARE_YOU_SURE
          title string for confirmation boxes.
static String CONFIG_DATA_COMPONENT_NAME
          the name for configuration component.
static String CONFIG_DATA_PLUGIN_ID
          the plugin id for configuration component.
static String CONTRIBUTION_CONFIGURATION_KEY
          the key for the preference store for the contribution manager.
static String DEFAULT_CONFIGURATION_KEY
          identifier for the default configuration.
static KiemPropertyKeyWrapper DEFAULT_EDITOR_KEY
          the key for the default editor.
static KiemPropertyKeyWrapper DEFAULT_EDITOR_NAME_KEY
          the key for the default editor name.
static KiemPropertyKeyWrapper DEFAULT_PRIORITY_KEY
          the key for the default priority.
static String DELETE_QUESTION
          message string for delete boxes.
static String EDITOR_ID_NAME
          identifier for the editor id.
static String EDITOR_IDS_KEY
          identifier for the list of editors.
static String EDITOR_NAME
          identifier for an editor.
static String EDITOR_NAME_NAME
          identifier for the editor name.
static String IGNORED_KEYS_BUTTON_TOOLTIP
          the tooltip for the always use defaults dialog.
static String IGNORED_KEYS_KEY
          identifier for the list of ignored keys.
static String IS_ADVANCED_NAME
          identifier for the advanced mode property.
static String IS_MATCHING_VISIBLE_NAME
          identifier for the matching combo.
static String IS_RECENT_VISIBLE_NAME
          identifier for the recent combo.
static String LOCATION_NAME
          identifier for the location of a file.
static String MOST_RECENT_SCHEDULES_KEY
          identifier for the list of most recently used schedules.
static String PROPERTY_KEY_CANT_BE_NULL
          An error message showing that the key can't be null.
static String PROPERTY_KEY_HINT
          the hint for the property key field.
static String PROPERTY_KEY_NAME
          the name for a property key.
static String PROPERTY_NAME
          the name for a property.
static String PROPERTY_VALUE_HINT
          the hint for the property value field.
static String PROPERTY_VALUE_NAME
          the name for a property value.
static KiemPropertyKeyWrapper RECENT_CAPACITY_KEY
          the key for the capacity of the recent schedules list.
static String SCHEDULE_CONFIGURATION_KEY
          identifier for the schedule configuration.
static String SCHEDULE_DATA_NAME
          identifier for a single scheduling data.
static KiemPropertyKeyWrapper TIMEOUT_KEY
          identifier for the timeout.
static String WARNING_TITLE
          the title of warning dialogs.
 
Method Summary
static
<T> List<T>
arrayToList(T[] array)
          Converts an array to a list.
static KiemProperty getKiemProperty(String input)
          Convenience method for parsing a property key and value and constructing a KiemProperty from it.
static String getLabelFor(String key)
          Get the humanly readable label for one of the keys.
static String getRestartMessage(String attribute)
          Constructs an info message about restart.
static String getTooltipFor(String key)
          Get a tooltip text for the element with the specified key.
static String getValue(String key, String input)
          Get a value from an input string.
static String[] getValueList(String key, String input)
          Get a list of values from an input string.
static KiemProperty[] listToKiemPropertyArray(List<KiemProperty> list)
          Convert a list to a KiemProperty array.
static String putProperty(KiemProperty prop)
          Convenience method for creating the string for a property.
static String putValue(String key, String value)
          Create a string with start and end tags.
static
<Type> Type[]
removeFromArray(Type[] array, int index)
          Removes an element from an array.
static void showErrorDialog(String message, Shell shell)
          Display an error dialog with a message.
static void showErrorWithStackTrace(RuntimeException e0, Shell shell)
          Display an error dialog with a message.
static void showParseWarningMissingEditorAttributes(String string)
          Shows a silent warning in the main KIEMPlugin to notify
the user that one of the EditorDefinitions couldn't be parsed.
static void showParseWarningMissingPropertyAttributes(String string)
          Shows a silent warning in the main KIEMPlugin to notify
the user that one of the KiemProperties couldn't be parsed.
static void showWarning(String textMessage, Exception exception, boolean silent)
          KiemPlugin.showWarning(String, String, Exception, boolean).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

AIMED_STEP_DURATION_KEY

public static final KiemPropertyKeyWrapper AIMED_STEP_DURATION_KEY
identifier for the step duration.


DEFAULT_EDITOR_KEY

public static final KiemPropertyKeyWrapper DEFAULT_EDITOR_KEY
the key for the default editor.


DEFAULT_EDITOR_NAME_KEY

public static final KiemPropertyKeyWrapper DEFAULT_EDITOR_NAME_KEY
the key for the default editor name.


DEFAULT_PRIORITY_KEY

public static final KiemPropertyKeyWrapper DEFAULT_PRIORITY_KEY
the key for the default priority.


RECENT_CAPACITY_KEY

public static final KiemPropertyKeyWrapper RECENT_CAPACITY_KEY
the key for the capacity of the recent schedules list.


TIMEOUT_KEY

public static final KiemPropertyKeyWrapper TIMEOUT_KEY
identifier for the timeout.


ADD_PROPERTY_TOOLTIP

public static final String ADD_PROPERTY_TOOLTIP
the tooltip for the add property dialog.

See Also:
Constant Field Values

ADVANCED_MODE_HINT

public static final String ADVANCED_MODE_HINT
the tooltip for the advanced user mode.

See Also:
Constant Field Values

APPLICATION_NAME

public static final String APPLICATION_NAME
the name of the application.

See Also:
Constant Field Values

ARE_YOU_SURE

public static final String ARE_YOU_SURE
title string for confirmation boxes.

See Also:
Constant Field Values

CONTRIBUTION_CONFIGURATION_KEY

public static final String CONTRIBUTION_CONFIGURATION_KEY
the key for the preference store for the contribution manager.

See Also:
Constant Field Values

DEFAULT_CONFIGURATION_KEY

public static final String DEFAULT_CONFIGURATION_KEY
identifier for the default configuration.

See Also:
Constant Field Values

DELETE_QUESTION

public static final String DELETE_QUESTION
message string for delete boxes.

See Also:
Constant Field Values

EDITOR_NAME

public static final String EDITOR_NAME
identifier for an editor.

See Also:
Constant Field Values

EDITOR_IDS_KEY

public static final String EDITOR_IDS_KEY
identifier for the list of editors.

See Also:
Constant Field Values

EDITOR_NAME_NAME

public static final String EDITOR_NAME_NAME
identifier for the editor name.

See Also:
Constant Field Values

EDITOR_ID_NAME

public static final String EDITOR_ID_NAME
identifier for the editor id.

See Also:
Constant Field Values

IGNORED_KEYS_KEY

public static final String IGNORED_KEYS_KEY
identifier for the list of ignored keys.

See Also:
Constant Field Values

IGNORED_KEYS_BUTTON_TOOLTIP

public static final String IGNORED_KEYS_BUTTON_TOOLTIP
the tooltip for the always use defaults dialog.

See Also:
Constant Field Values

IS_RECENT_VISIBLE_NAME

public static final String IS_RECENT_VISIBLE_NAME
identifier for the recent combo.

See Also:
Constant Field Values

IS_MATCHING_VISIBLE_NAME

public static final String IS_MATCHING_VISIBLE_NAME
identifier for the matching combo.

See Also:
Constant Field Values

IS_ADVANCED_NAME

public static final String IS_ADVANCED_NAME
identifier for the advanced mode property.

See Also:
Constant Field Values

LOCATION_NAME

public static final String LOCATION_NAME
identifier for the location of a file.

See Also:
Constant Field Values

MOST_RECENT_SCHEDULES_KEY

public static final String MOST_RECENT_SCHEDULES_KEY
identifier for the list of most recently used schedules.

See Also:
Constant Field Values

CONFIG_DATA_COMPONENT_NAME

public static final String CONFIG_DATA_COMPONENT_NAME
the name for configuration component.

See Also:
Constant Field Values

CONFIG_DATA_PLUGIN_ID

public static final String CONFIG_DATA_PLUGIN_ID
the plugin id for configuration component.

See Also:
Constant Field Values

PROPERTY_NAME

public static final String PROPERTY_NAME
the name for a property.

See Also:
Constant Field Values

PROPERTY_VALUE_NAME

public static final String PROPERTY_VALUE_NAME
the name for a property value.

See Also:
Constant Field Values

PROPERTY_VALUE_HINT

public static final String PROPERTY_VALUE_HINT
the hint for the property value field.

See Also:
Constant Field Values

PROPERTY_KEY_NAME

public static final String PROPERTY_KEY_NAME
the name for a property key.

See Also:
Constant Field Values

PROPERTY_KEY_CANT_BE_NULL

public static final String PROPERTY_KEY_CANT_BE_NULL
An error message showing that the key can't be null.

See Also:
Constant Field Values

PROPERTY_KEY_HINT

public static final String PROPERTY_KEY_HINT
the hint for the property key field.

See Also:
Constant Field Values

SCHEDULE_CONFIGURATION_KEY

public static final String SCHEDULE_CONFIGURATION_KEY
identifier for the schedule configuration.

See Also:
Constant Field Values

SCHEDULE_DATA_NAME

public static final String SCHEDULE_DATA_NAME
identifier for a single scheduling data.

See Also:
Constant Field Values

WARNING_TITLE

public static final String WARNING_TITLE
the title of warning dialogs.

See Also:
Constant Field Values
Method Detail

getRestartMessage

public static String getRestartMessage(String attribute)
Constructs an info message about restart.

Parameters:
attribute - the attribute that was changed.
Returns:
the info message.

getLabelFor

public static String getLabelFor(String key)
Get the humanly readable label for one of the keys.

Parameters:
key - the key to look for.
Returns:
a label or the key itself if no label was found.

getTooltipFor

public static String getTooltipFor(String key)
Get a tooltip text for the element with the specified key.

Parameters:
key - the key to look for.
Returns:
the tooltip text.

arrayToList

public static <T> List<T> arrayToList(T[] array)
Converts an array to a list.

Type Parameters:
T - the type of the list
Parameters:
array - the array to convert
Returns:
the resulting list

listToKiemPropertyArray

public static KiemProperty[] listToKiemPropertyArray(List<KiemProperty> list)
Convert a list to a KiemProperty array.

Parameters:
list - the list to convert.
Returns:
the resulting array.

removeFromArray

public static <Type> Type[] removeFromArray(Type[] array,
                                            int index)
Removes an element from an array.

Type Parameters:
Type - the type of the array
Parameters:
array - the array
index - the index to be removed
Returns:
the resulting array

showErrorDialog

public static void showErrorDialog(String message,
                                   Shell shell)
Display an error dialog with a message.

Parameters:
message - the message to display.
shell - the parent shell.

showErrorWithStackTrace

public static void showErrorWithStackTrace(RuntimeException e0,
                                           Shell shell)
Display an error dialog with a message.

Parameters:
e0 - the exception that should be printed.
shell - the parent shell.

showWarning

public static void showWarning(String textMessage,
                               Exception exception,
                               boolean silent)
KiemPlugin.showWarning(String, String, Exception, boolean).

Parameters:
textMessage - the message explaining the error.
exception - the exception causing the error.
silent - true if a message box should be displayed.

showParseWarningMissingPropertyAttributes

public static void showParseWarningMissingPropertyAttributes(String string)
Shows a silent warning in the main KIEMPlugin to notify
the user that one of the KiemProperties couldn't be parsed.

Parameters:
string - the key of the property that has no value

showParseWarningMissingEditorAttributes

public static void showParseWarningMissingEditorAttributes(String string)
Shows a silent warning in the main KIEMPlugin to notify
the user that one of the EditorDefinitions couldn't be parsed.

Parameters:
string - the key of the property that has no value

putValue

public static String putValue(String key,
                              String value)
Create a string with start and end tags.

Parameters:
key - the key of the property
value - the value of the property
Returns:
the value enclosed in tags

putProperty

public static String putProperty(KiemProperty prop)
Convenience method for creating the string for a property.

Parameters:
prop - the property
Returns:
the string

getValue

public static String getValue(String key,
                              String input)
Get a value from an input string.

Parameters:
key - the key to look for.
input - the input string
Returns:
the value or null

getValueList

public static String[] getValueList(String key,
                                    String input)
Get a list of values from an input string.

Parameters:
key - the key to look for each individual element in the list
input - the input string
Returns:
the value or null

getKiemProperty

public static KiemProperty getKiemProperty(String input)
Convenience method for parsing a property key and value and constructing a KiemProperty from it.

Parameters:
input - the input string
Returns:
the KiemProperty or null