Class CustomColorManager


  • public class CustomColorManager
    extends Object
    This class managed the custom user colors. Save the custom color to persistent storage IEclipsePreferences
    • Field Detail

      • NUMBER_OF_CUSTOM_COLORS

        public static final int NUMBER_OF_CUSTOM_COLORS
        See Also:
        Constant Field Values
    • Constructor Detail

      • CustomColorManager

        public CustomColorManager()
    • Method Detail

      • set

        public void set​(int index,
                        org.eclipse.swt.graphics.RGB color)
        Set to storage color
        Parameters:
        index - the index
        color - the RGB color
        Throws:
        IndexOutOfBoundsException - if the index does not fall to interval
      • get

        public org.eclipse.swt.graphics.RGB get​(int index)
        Get Color by index
        Parameters:
        index - index of the returned color.
        Returns:
        the RGB color
        Throws:
        IndexOutOfBoundsException - if the index does not fall to interval
      • getAll

        public List<org.eclipse.swt.graphics.RGB> getAll()
        Gets all the custom user colors
        Returns:
        all custom colors
      • save

        public void save()
                  throws org.osgi.service.prefs.BackingStoreException
        Save all the custom colors to storage
        Throws:
        org.osgi.service.prefs.BackingStoreException - if class does not save colors
      • remove

        public org.eclipse.swt.graphics.RGB remove​(int index)
        Remove element by index
        Parameters:
        index - the index
        Returns:
        removed color
        Throws:
        IndexOutOfBoundsException - if the index does not fall to interval
      • getKey

        protected String getKey​(int idx)
        Figures out the name, under which the color is stored in preferences
        Parameters:
        idx - the index of the color in the array
        Returns:
        the key in preferences for color with index idx