| java.lang.Object org.eclipse.ui.internal.util.Util
Util | final public class Util (Code) | | |
Method Summary | |
public static Object[] | appendArray(Object[] array1, Object[] array2) | public static void | arrayCopyWithRemoval(Object[] src, Object[] dst, int idxToRemove) | public static void | assertInstance(Object object, Class c) | public static void | assertInstance(Object object, Class c, boolean allowNull) | public static int | compare(boolean left, boolean right) | public static int | compare(Comparable left, Comparable right) | public static int | compare(Comparable[] left, Comparable[] right) | public static int | compare(int left, int right) | public static int | compare(List left, List right) | public static int | compare(Object left, Object right) | final public static int | compareIdentity(Object left, Object right) An optimized comparison that uses identity hash codes to perform the
comparison between non- null objects.
Parameters: left - The left-hand side of the comparison; may be null . Parameters: right - The right-hand side of the comparison; may benull . | public static void | diff(Map left, Map right, Set leftOnly, Set different, Set rightOnly) | public static void | diff(Set left, Set right, Set leftOnly, Set rightOnly) | public static boolean | endsWith(List left, List right, boolean equals) | public static boolean | endsWith(Object[] left, Object[] right, boolean equals) | public static boolean | equals(boolean left, boolean right) | public static boolean | equals(int left, int right) | public static boolean | equals(Object left, Object right) | final public static boolean | equals(Object[] leftArray, Object[] rightArray) Tests whether two arrays of objects are equal to each other. | public static Object | getAdapter(Object sourceObject, Class adapterType) If it is possible to adapt the given object to the given type, this
returns the adapter. | public static String[] | getArrayFromList(String prop, String separator) Returns the result of converting a list of comma-separated tokens into an array. | public static Shell | getShellToParentOn() Return an appropriate shell to parent dialogs on. | public static IWorkbenchWindow | getWorkbenchWindowForShell(Shell shellToCheck) Return the window for the given shell or the currently active window if
one could not be determined. | public static int | hashCode(boolean b) | public static int | hashCode(int i) | public static int | hashCode(Object object) | public static String | intern(String string) | public static String | replaceAll(String src, String find, String replacement) Foundation replacement for String.replaceAll(*).
Parameters: src - the starting string. Parameters: find - the string to find. Parameters: replacement - the string to replace. | public static Collection | safeCopy(Collection collection, Class c) | public static Collection | safeCopy(Collection collection, Class c, boolean allowNullElements) | public static List | safeCopy(List list, Class c) | public static List | safeCopy(List list, Class c, boolean allowNullElements) | public static Map | safeCopy(Map map, Class keyClass, Class valueClass) | public static Map | safeCopy(Map map, Class keyClass, Class valueClass, boolean allowNullKeys, boolean allowNullValues) | public static Set | safeCopy(Set set, Class c) | public static Set | safeCopy(Set set, Class c, boolean allowNullElements) | public static SortedMap | safeCopy(SortedMap sortedMap, Class keyClass, Class valueClass) | public static SortedMap | safeCopy(SortedMap sortedMap, Class keyClass, Class valueClass, boolean allowNullKeys, boolean allowNullValues) | public static SortedSet | safeCopy(SortedSet sortedSet, Class c) | public static SortedSet | safeCopy(SortedSet sortedSet, Class c, boolean allowNullElements) | public static Object | safeLoadExecutableExtension(IConfigurationElement element, String attName, Class classSpec) Attempt to load the executable extension from the element/attName. | public static String | safeString(String input) Ensures that a string is not null. | public static String[] | split(String src, char delim) Splits a string at the first occurance of the delimiting char.
If the source string is null then so is the result. | public static boolean | startsWith(List left, List right, boolean equals) | public static boolean | startsWith(Object[] left, Object[] right, boolean equals) | public static String | translateString(ResourceBundle resourceBundle, String key) | public static String | translateString(ResourceBundle resourceBundle, String key, String string, boolean signal, boolean trim) |
ZERO_LENGTH_STRING | final public static String ZERO_LENGTH_STRING(Code) | | |
appendArray | public static Object[] appendArray(Object[] array1, Object[] array2)(Code) | | Appends array2 to the end of array1 and returns the result
Parameters: array1 - Parameters: array2 - since: 3.1 |
arrayCopyWithRemoval | public static void arrayCopyWithRemoval(Object[] src, Object[] dst, int idxToRemove)(Code) | | |
assertInstance | public static void assertInstance(Object object, Class c, boolean allowNull)(Code) | | |
compare | public static int compare(boolean left, boolean right)(Code) | | |
compare | public static int compare(int left, int right)(Code) | | |
compareIdentity | final public static int compareIdentity(Object left, Object right)(Code) | | An optimized comparison that uses identity hash codes to perform the
comparison between non- null objects.
Parameters: left - The left-hand side of the comparison; may be null . Parameters: right - The right-hand side of the comparison; may benull . 0 if they are the same, -1 if leftis null ;1 if right isnull . Otherwise, the left identity hash codeminus the right identity hash code. |
endsWith | public static boolean endsWith(List left, List right, boolean equals)(Code) | | |
endsWith | public static boolean endsWith(Object[] left, Object[] right, boolean equals)(Code) | | |
equals | public static boolean equals(boolean left, boolean right)(Code) | | |
equals | public static boolean equals(int left, int right)(Code) | | |
equals | final public static boolean equals(Object[] leftArray, Object[] rightArray)(Code) | | Tests whether two arrays of objects are equal to each other. The arrays
must not be null , but their elements may be
null .
Parameters: leftArray - The left array to compare; may be null , andmay be empty and may contain null elements. Parameters: rightArray - The right array to compare; may be null , andmay be empty and may contain null elements. true if the arrays are equal length and theelements at the same position are equal; false otherwise. |
getAdapter | public static Object getAdapter(Object sourceObject, Class adapterType)(Code) | | If it is possible to adapt the given object to the given type, this
returns the adapter. Performs the following checks:
- Returns
sourceObject if it is an instance of the
adapter type.
- If sourceObject implements IAdaptable, it is queried for adapters.
- If sourceObject is not an instance of PlatformObject (which would have
already done so), the adapter manager is queried for adapters
Otherwise returns null.
Parameters: sourceObject - object to adapt, or null Parameters: adapterType - type to adapt to a representation of sourceObject that is assignable to theadapter type, or null if no such representation exists |
getArrayFromList | public static String[] getArrayFromList(String prop, String separator)(Code) | | Returns the result of converting a list of comma-separated tokens into an array.
Used as a replacement for String.split(String) , to allow compilation
against JCL Foundation (bug 80053).
Parameters: prop - the initial comma-separated string Parameters: separator - the separator characters the array of string tokens since: 3.1 |
getShellToParentOn | public static Shell getShellToParentOn()(Code) | | Return an appropriate shell to parent dialogs on. This will be one of the
workbench windows (the active one) should any exist. Otherwise
null is returned.
the shell to parent on or null if there is noappropriate shell since: 3.3 |
getWorkbenchWindowForShell | public static IWorkbenchWindow getWorkbenchWindowForShell(Shell shellToCheck)(Code) | | Return the window for the given shell or the currently active window if
one could not be determined.
Parameters: shellToCheck - the shell to search on the window for the given shell or the currently active window ifone could not be determined since: 3.2 |
hashCode | public static int hashCode(boolean b)(Code) | | |
hashCode | public static int hashCode(int i)(Code) | | |
intern | public static String intern(String string)(Code) | | Returns an interned representation of the given string
Parameters: string - The string to intern The interned string |
replaceAll | public static String replaceAll(String src, String find, String replacement)(Code) | | Foundation replacement for String.replaceAll(*).
Parameters: src - the starting string. Parameters: find - the string to find. Parameters: replacement - the string to replace. The new string. since: 3.3 |
safeCopy | public static Map safeCopy(Map map, Class keyClass, Class valueClass, boolean allowNullKeys, boolean allowNullValues)(Code) | | |
safeCopy | public static Set safeCopy(Set set, Class c, boolean allowNullElements)(Code) | | |
safeLoadExecutableExtension | public static Object safeLoadExecutableExtension(IConfigurationElement element, String attName, Class classSpec)(Code) | | Attempt to load the executable extension from the element/attName. If
the load fails or the resulting object is not castable to the
provided classSpec (if any) an error is logged and a null is returned.
Parameters: element - The IConfigurationElement containing theexecutable extension's specification Parameters: attName - The attribute name of the executable extension Parameters: classSpec - An optional Class defining the typethat the loaded Object must be castable to. This is optional to supportcode where the client has a choice of mutually non-castable types tochoose from. The loaded object which is guaranteed to becastable to the given classSpec or null if a failure occurred |
safeString | public static String safeString(String input)(Code) | | Ensures that a string is not null. Converts null strings into empty
strings, and leaves any other string unmodified. Use this to help
wrap calls to methods that return null instead of the empty string.
Can also help protect against implementation errors in methods that
are not supposed to return null.
Parameters: input - input string (may be null) input if not null, or the empty string if input is null |
split | public static String[] split(String src, char delim)(Code) | | Splits a string at the first occurance of the delimiting char.
If the source string is null then so is the result. If the source
string is badly formatted then it is returned in the first array
entry and the second entry is an empty string.
Parameters: src - The string to be split Parameters: delim - The character to split on A two entry string array containing the left/right pair. |
startsWith | public static boolean startsWith(List left, List right, boolean equals)(Code) | | |
startsWith | public static boolean startsWith(Object[] left, Object[] right, boolean equals)(Code) | | |
|
|