Class ItemUtil


  • public final class ItemUtil
    extends Object
    Util class for item.
    • 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
      • 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