public class GeneralUtils extends Object
Constructor and Description |
---|
GeneralUtils() |
Modifier and Type | Method and Description |
---|---|
static <TYPE> void |
calculateCombinations(List<TYPE> elements,
int min,
int max,
CombinationListener<TYPE> listener) |
static void |
centerComponent(Component componentToCenter,
Component centerRelativeTo)
Centers a component (dialog, window) relative to another component.
|
static boolean |
containsFlag(int property,
int flag)
Test wether a propety contains a given flag.
|
static String |
convertIdToPath(String id) |
static int |
cumulativeSum(int number) |
static int |
factorial(int number) |
static String |
generateUID(Object object)
method returns a string that can be used as id for the given object.
|
static long |
getMaxHeapSize() |
static String |
getRGBString(Color color)
mehtod returns a string that represents the given color.
|
static String |
getTemporaryDirectory()
Returns the temporary directory of the system.
|
static long |
getUsedBytes() |
static String |
getUsersHomeDirectory()
Returns the home directory of the user.
|
static void |
replaceInFile(File file,
String regex,
String content)
Replace a string in a text file.
|
static void |
showErrorDialog(Object message,
String title)
This method creates a special MessageDialog (JOptionPane).
|
static boolean |
testForFileLocker(IWorkbench workbench,
IAbstractFile[] files,
String message) |
static boolean |
testForFileLocker(IWorkbench workbench,
IAbstractFile file,
String message) |
static String |
toString(Point2D point) |
static Object |
tryCast(Object object,
Class toCastIn)
Deprecated.
|
public static long getUsedBytes()
public static long getMaxHeapSize()
public static String generateUID(Object object)
object
- the object thats id is questionedpublic static String getRGBString(Color color)
color
- the color that CSS2 string is questioned@Deprecated public static Object tryCast(Object object, Class toCastIn)
object
- the object that should be castedtoCastIn
- the class the object should be casted topublic static void showErrorDialog(Object message, String title)
message
- the message that should be showntitle
- the title that should heading the dialog panepublic static void centerComponent(Component componentToCenter, Component centerRelativeTo)
componentToCenter
- the component that should be centeredcenterRelativeTo
- the component that should be the 'parent' while centeringpublic static void replaceInFile(File file, String regex, String content) throws IOException, FileNotFoundException
file
- the file in which the string should be replacedregex
- the regular expression to specify the search stringcontent
- the string that should be replace the found stringIOException
FileNotFoundException
public static boolean containsFlag(int property, int flag)
((property & flag) == flag)
property
- the property to testflag
- the flag that should be in the propertypublic static String getUsersHomeDirectory()
public static String getTemporaryDirectory()
public static boolean testForFileLocker(IWorkbench workbench, IAbstractFile[] files, String message)
public static boolean testForFileLocker(IWorkbench workbench, IAbstractFile file, String message)
public static <TYPE> void calculateCombinations(List<TYPE> elements, int min, int max, CombinationListener<TYPE> listener)
public static int factorial(int number)
public static int cumulativeSum(int number)