fable.framework.toolbox
Class ToolBox

java.lang.Object
  extended by fable.framework.toolbox.ToolBox

public class ToolBox
extends java.lang.Object

Author:
G. Suchet fable.preprocessor Feb 7, 2007

Constructor Summary
ToolBox()
           
 
Method Summary
static java.lang.String addQuotesForSpacesInName(java.lang.String pathName, java.lang.String regex, java.lang.String sep)
           
static boolean checkExtension(java.lang.String fileName, java.lang.String extension)
           
static boolean checkIfFileExists(java.lang.String fileName)
           
static boolean checkIfIsDirectory(java.lang.String path)
           
static java.lang.String[] getFileNamesByEntireRegex(java.lang.String directoryPath, java.lang.String regex, boolean bRetreive)
           
static java.lang.String getFileNumber(java.lang.String filename)
           
static java.io.File[] getFilesByEntireRegex(java.lang.String directoryPath, java.lang.String regex, boolean bRetreive)
           
static java.lang.String[] getFilesByEntireRegexAndTime(java.lang.String directoryPath, java.lang.String regex, boolean bRetreive, long date)
           
static java.lang.String[] getFilesFromDirectory(java.lang.String directoryPath, java.lang.String extension)
           
static java.lang.String getFileType(java.lang.String fileName)
           
static java.lang.String getHelpContextTooltip()
          This method returns the appropriate key to press to have context help depending on the operating System
static java.lang.String getPluginName(java.lang.String pluginId)
          Gets the plug-in name from its ID.
static java.lang.String getPluginPath(java.lang.String bundleName, java.lang.String PluginId)
          This static method returns bundle path.
static java.lang.String getPluginVersion(java.lang.String pluginId)
          Gets the plug-in version from its ID.
static java.awt.Color getRandomColor()
          26 oct.
static java.lang.String getStem(java.lang.String filename)
           
static boolean isOsLinux()
          Test whether operating system is linux or not
static boolean isOsWindows()
          Test whether operating system is windows or not
static boolean isSmallPerspectiveSet()
          This method checks if small perspective option have been set in in configuration preference page ( fable.framework.toolboxpreferences.ConfigurationPreferencesPage ) to display a perspective designed for small screen or for large screen, first depending on the screen size, and from user preference after.
static void quicksort(java.io.File[] list, int begin, int end)
           
static void quicksort(java.lang.String[] list, int begin, int end)
           
static java.util.Date stringToDate(java.lang.String sDate, java.lang.String sFormat)
          13 d�c.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ToolBox

public ToolBox()
Method Detail

getPluginPath

public static java.lang.String getPluginPath(java.lang.String bundleName,
                                             java.lang.String PluginId)
                                      throws java.io.IOException
This static method returns bundle path.

Returns:
bundle path
Throws:
java.io.IOException - if bundle is not found.

checkIfFileExists

public static boolean checkIfFileExists(java.lang.String fileName)
Parameters:
the - name of the file
Returns:
true if the file exists

checkExtension

public static boolean checkExtension(java.lang.String fileName,
                                     java.lang.String extension)
Parameters:
filename - the name of the file
extension - extension to check

checkIfIsDirectory

public static boolean checkIfIsDirectory(java.lang.String path)

getFilesFromDirectory

public static java.lang.String[] getFilesFromDirectory(java.lang.String directoryPath,
                                                       java.lang.String extension)

quicksort

public static void quicksort(java.io.File[] list,
                             int begin,
                             int end)

quicksort

public static void quicksort(java.lang.String[] list,
                             int begin,
                             int end)

getFilesByEntireRegex

public static java.io.File[] getFilesByEntireRegex(java.lang.String directoryPath,
                                                   java.lang.String regex,
                                                   boolean bRetreive)
Returns:
a list of file name (no pathName)

getFileNamesByEntireRegex

public static java.lang.String[] getFileNamesByEntireRegex(java.lang.String directoryPath,
                                                           java.lang.String regex,
                                                           boolean bRetreive)
Returns:
a list of file name (no pathName)

getFilesByEntireRegexAndTime

public static java.lang.String[] getFilesByEntireRegexAndTime(java.lang.String directoryPath,
                                                              java.lang.String regex,
                                                              boolean bRetreive,
                                                              long date)

getRandomColor

public static java.awt.Color getRandomColor()
26 oct. 07

Returns:
a random Color

addQuotesForSpacesInName

public static java.lang.String addQuotesForSpacesInName(java.lang.String pathName,
                                                        java.lang.String regex,
                                                        java.lang.String sep)

stringToDate

public static java.util.Date stringToDate(java.lang.String sDate,
                                          java.lang.String sFormat)
                                   throws java.lang.Exception
13 d�c. 07

Parameters:
sDate -
sFormat -
Returns:
Throws:
java.lang.Exception

getPluginName

public static java.lang.String getPluginName(java.lang.String pluginId)
Gets the plug-in name from its ID.

Parameters:
pluginId - The plug-in's Activator ID.
Returns:

getPluginVersion

public static java.lang.String getPluginVersion(java.lang.String pluginId)
Gets the plug-in version from its ID.

Parameters:
pluginId - The plug-in's Activator ID.
Returns:

getStem

public static java.lang.String getStem(java.lang.String filename)
Parameters:
filename -
Returns:
the stem of the file name

getFileType

public static java.lang.String getFileType(java.lang.String fileName)

getFileNumber

public static java.lang.String getFileNumber(java.lang.String filename)

isSmallPerspectiveSet

public static boolean isSmallPerspectiveSet()
This method checks if small perspective option have been set in in configuration preference page ( fable.framework.toolboxpreferences.ConfigurationPreferencesPage ) to display a perspective designed for small screen or for large screen, first depending on the screen size, and from user preference after.

example usage in your plugin ApplicationWorkbenchAdvisor:
public String getInitialWindowPerspectiveId() {
smallPerspective = ToolBox.isSmallPerspectiveSet();
if (smallPerspective) {
return PERSPECTIVE_ID_SMALLSCREEN;
}
return PERSPECTIVE_ID; }

Returns:
true if preferred perspective is "Display a perspective that is better for small screen".

isOsLinux

public static boolean isOsLinux()
Test whether operating system is linux or not

Returns:
true if operating system is linux

isOsWindows

public static boolean isOsWindows()
Test whether operating system is windows or not

Returns:
true if operating system is windows

getHelpContextTooltip

public static java.lang.String getHelpContextTooltip()
This method returns the appropriate key to press to have context help depending on the operating System

Returns:
  • F1 if os is windows
  • Ctrl+F1 if os is linux
  • help key on the mac