org.eclipse.emf.compare.rcp.internal.extension.impl

## 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
`static String` `PREFERENCE_DELIMITER` Delimiter character used to serialize a list into preferences.

### Method Summary

All Methods Static Methods Concrete Methods
`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> 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 of `IItemDescriptor` from preferences.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### 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 registry
  `preferenceKey` - 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 type
  `preferenceKey` - 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 of `IItemDescriptor` from preferences.

Type Parameters:
  `T` - Type of `IItemDescriptor`
Parameters:
  `registry` - Registry for the `IItemDescriptor`
  `qualifier` - the preference qualifier (plug-in ID)
  `preferenceKey` - Key for this `IItemDescriptor` 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 kind
  `qualifier` - The preference qualifier (plug-in ID)
  `disabledItemPreferenceKey` - Preference key where are stored disabled items.
Returns:
  `Set` of active items