## org.eclipse.m2m.atl.adt.ui.text
Class AtlColorManager

    java.lang.Object
      org.eclipse.m2m.atl.adt.ui.text.AtlColorManager

All Implemented Interfaces:
  org.eclipse.jface.text.source.ISharedTextColors

    public class AtlColorManager

extends java.lang.Object
implements org.eclipse.jface.text.source.ISharedTextColors

This manager allows to share colors. A color is represented as a couple of a string and an RGB value.

Field Summary
`protected java.util.Map<org.eclipse.swt.widgets.Display,java.util.Map<org.eclipse.swt.graphics.RGB,org.eclipse.swt.graphics.Color>>` `displayTable` `displayTable` stores a map for each display found.
`protected java.util.HashMap<java.lang.String,org.eclipse.swt.graphics.RGB>` `keyTable` `keyTable` is a hash map regrouping the string key of the color and the effective RGB color associated with.

Constructor Summary
`AtlColorManager()` Creates a new color manager setting to auto dispose it when the display is disposed.
`AtlColorManager(boolean adodd)` Creates a new color manager setting the auto dispose on display dispose mode with the given parameter.

Method Summary
`java.lang.Object` `add(java.lang.String key, org.eclipse.swt.graphics.RGB rgb)` Adds in the table a new color.
`void` `bindColor(java.lang.String key, org.eclipse.swt.graphics.RGB rgb)` Remembers the given color specification under the given key.
`void` `dispose()`
`protected void` `dispose(org.eclipse.swt.widgets.Display display)` Disposes the color manager with the values from the display.
`org.eclipse.swt.graphics.Color` `getColor(org.eclipse.swt.graphics.RGB rgb)`
`org.eclipse.swt.graphics.Color` `getColor(java.lang.String color)` Gets the color resource matching the color string.
`java.lang.Object` `remove(java.lang.String key)` Removes from the table the color given by the string key.
`void` `unbindColor(java.lang.String key)` Forgets the color specification remembered under the given key.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### displayTable

    protected java.util.Map<org.eclipse.swt.widgets.Display,java.util.Map<org.eclipse.swt.graphics.RGB,org.eclipse.swt.graphics.Color>> displayTable

  `displayTable` stores a map for each display found.

### keyTable

    protected java.util.HashMap<java.lang.String,org.eclipse.swt.graphics.RGB> keyTable

  `keyTable` is a hash map regrouping the string key of the color and the effective RGB color associated with.

Constructor Detail

### AtlColorManager

    public AtlColorManager()

  Creates a new color manager setting to auto dispose it when the display is disposed.

### AtlColorManager

    public AtlColorManager(boolean adodd)

  Creates a new color manager setting the auto dispose on display dispose mode with the given parameter.

  Parameters:
    `adodd` - the auto dispose on display dispose mode

Method Detail

### add

    public java.lang.Object add(java.lang.String key,
                                org.eclipse.swt.graphics.RGB rgb)

  Adds in the table a new color.

  Parameters:
    `key` - the string key representing the color
    `rgb` - the RGB color associated to the color
  Returns:
    the new object inserted in the table

### bindColor

    public void bindColor(java.lang.String key,
                          org.eclipse.swt.graphics.RGB rgb)

  Remembers the given color specification under the given key.

  Parameters:
    `key` - the color key
    `rgb` - the color specification
  Throws:
    `java.lang.UnsupportedOperationException` - if there is already a color specification remembered under the given key

### dispose

    public void dispose()

  Specified by:
    `dispose` in interface `org.eclipse.jface.text.source.ISharedTextColors`
  See Also:
    `ISharedTextColors.dispose()`

### dispose

    protected void dispose(org.eclipse.swt.widgets.Display display)

  Disposes the color manager with the values from the display.

  Parameters:
    `display` - the display to use

### getColor

    public org.eclipse.swt.graphics.Color getColor(org.eclipse.swt.graphics.RGB rgb)

  Specified by:
    `getColor` in interface `org.eclipse.jface.text.source.ISharedTextColors`
  See Also:
    `ISharedTextColors.getColor(org.eclipse.swt.graphics.RGB)`

### getColor

    public org.eclipse.swt.graphics.Color getColor(java.lang.String color)

  Gets the color resource matching the color string.

  Parameters:
    `color` - the key string of the color
  Returns:
    the matching color associated to the color key

### remove

    public java.lang.Object remove(java.lang.String key)

  Removes from the table the color given by the string key.

  Parameters:
    `key` - the string key of the color
  Returns:
    the object removed from the table

### unbindColor

    public void unbindColor(java.lang.String key)

  Forgets the color specification remembered under the given key.

  Parameters:
    `key` - the color key

Copyright 2007 IBM Corporation and others. All Rights Reserved.