Class ItemUtil
java.lang.Object
org.eclipse.emf.compare.rcp.internal.extension.impl.ItemUtil
Util class for item.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Delimiter character used to serialize a list into preferences. -
Method Summary
Modifier and TypeMethodDescriptionstatic <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> T
getItem
(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 ofIItemDescriptor
from preferences.
-
Field Details
-
PREFERENCE_DELIMITER
Delimiter character used to serialize a list into preferences.- See Also:
-
-
Method Details
-
getItem
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
-IItemRegistry
of 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 ofIItemDescriptor
from preferences.- Type Parameters:
T
- Type ofIItemDescriptor
- Parameters:
registry
- Registry for theIItemDescriptor
qualifier
- the preference qualifier (plug-in ID)preferenceKey
- Key for thisIItemDescriptor
in preferences- Returns:
- List of
IItemDescriptor
or 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:
Set
of active items
-