de.cau.cs.kieler.kaom.importer.ptolemy.utils
Class Utils

java.lang.Object
  extended by de.cau.cs.kieler.kaom.importer.ptolemy.utils.Utils

public final class Utils
extends Object

Contains utility methods used in the plug-in.

Rating red

Method Summary
static String getFileBaseName(String fileName)
          Returns the file name without file extension.
static String getFileExtension(String fileName)
          Returns the file extension of the file with the given name.
static String getSetting(IDialogSettings settings, String key, String deflt)
          Returns the given setting from the given dialog settings instance, or the given default if none is found.
static String[] getSettingArray(IDialogSettings settings, String key, String[] deflt)
          Returns the given setting from the given dialog settings instance, or the given default if none is found.
static boolean getSettingBoolean(IDialogSettings settings, String key, boolean deflt)
          Returns the given setting from the given dialog settings instance, or the given default if none is found.
static void insertVerticalSpace(Composite container, int space, int columns)
          Inserts the given amount of vertical space into the given container.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getSetting

public static String getSetting(IDialogSettings settings,
                                String key,
                                String deflt)
Returns the given setting from the given dialog settings instance, or the given default if none is found.

Parameters:
settings - the dialog settings to retrieve the setting from.
key - the setting's key.
deflt - the default value.
Returns:
the setting's value or its default value.

getSettingBoolean

public static boolean getSettingBoolean(IDialogSettings settings,
                                        String key,
                                        boolean deflt)
Returns the given setting from the given dialog settings instance, or the given default if none is found.

Parameters:
settings - the dialog settings to retrieve the setting from.
key - the setting's key.
deflt - the default value.
Returns:
the setting's value or its default value.

getSettingArray

public static String[] getSettingArray(IDialogSettings settings,
                                       String key,
                                       String[] deflt)
Returns the given setting from the given dialog settings instance, or the given default if none is found.

Parameters:
settings - the dialog settings to retrieve the setting from.
key - the setting's key.
deflt - the default value.
Returns:
the setting's value or its default value.

insertVerticalSpace

public static void insertVerticalSpace(Composite container,
                                       int space,
                                       int columns)
Inserts the given amount of vertical space into the given container. This is accomplished by inserting a label with suitable layout data. The container is assumed to use GridLayout. This method must only be called at the beginning of a new line in the layout manager.

Parameters:
container - the container to insert the space into.
space - the amount of space to insert.
columns - the number of columns in the grid layout.

getFileExtension

public static String getFileExtension(String fileName)
Returns the file extension of the file with the given name. If a file name begins with a dot, the part following it is not considered a file extension.

Parameters:
fileName - name of the file whose extension to return.
Returns:
the file extension, if any, without the dot.

getFileBaseName

public static String getFileBaseName(String fileName)
Returns the file name without file extension.

Parameters:
fileName - name of the file whose base name to return.
Returns:
the base name.