Class ItemUtil
- java.lang.Object
-
- org.eclipse.emf.compare.rcp.internal.extension.impl.ItemUtil
-
public final class ItemUtil extends Object
Util class for item.
-
-
Field Summary
Fields Modifier and Type Field Description static StringPREFERENCE_DELIMITERDelimiter character used to serialize a list into preferences.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> Set<IItemDescriptor<T>>getActiveItems(IItemRegistry<T> registry, String qualifier, String disabledItemPreferenceKey)Get all active item from a registry.static <T> IItemDescriptor<T>getDefaultItemDescriptor(IItemRegistry<T> registry, String preferenceKey)Get an item descriptor using the preferences.static <T> TgetItem(IItemRegistry<T> registry, String preferenceKey)Get an item using the preferences.static <T> List<IItemDescriptor<T>>getItemsDescriptor(IItemRegistry<T> registry, String qualifier, String preferenceKey)Get a list ofIItemDescriptorfrom preferences.
-
-
-
Field Detail
-
PREFERENCE_DELIMITER
public static final String PREFERENCE_DELIMITER
Delimiter character used to serialize a list into preferences.- See Also:
- Constant Field Values
-
-
Method Detail
-
getItem
public static <T> T getItem(IItemRegistry<T> registry, String preferenceKey)
Get an item using the preferences. If nothing has been set in the preferences then the highest ranking item is returned- Type Parameters:
T- Type of item- Parameters:
registry- The item registrypreferenceKey- The preference to retrieve the key.- Returns:
- an item or null if nothing has been found.
-
getDefaultItemDescriptor
public static <T> IItemDescriptor<T> getDefaultItemDescriptor(IItemRegistry<T> registry, String preferenceKey)
Get an item descriptor using the preferences. If nothing has been set in the preferences then the highest ranking item is returned- Type Parameters:
T- Type of item- Parameters:
registry-IItemRegistryof the item typepreferenceKey- Preference key use to retrieve the item- Returns:
IItemDescriptor
-
getItemsDescriptor
public static <T> List<IItemDescriptor<T>> getItemsDescriptor(IItemRegistry<T> registry, String qualifier, String preferenceKey)
Get a list ofIItemDescriptorfrom preferences.- Type Parameters:
T- Type ofIItemDescriptor- Parameters:
registry- Registry for theIItemDescriptorqualifier- the preference qualifier (plug-in ID)preferenceKey- Key for thisIItemDescriptorin preferences- Returns:
- List of
IItemDescriptoror null if nothing in preferences
-
getActiveItems
public static <T> Set<IItemDescriptor<T>> getActiveItems(IItemRegistry<T> registry, String qualifier, String disabledItemPreferenceKey)
Get all active item from a registry.(Filter out all disable element stored in preferences)
- Type Parameters:
T- Item type- Parameters:
registry- Registry holding all items of this kindqualifier- The preference qualifier (plug-in ID)disabledItemPreferenceKey- Preference key where are stored disabled items.- Returns:
Setof active items
-
-