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 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
FieldsModifier and TypeFieldDescriptionprotected Map<org.eclipse.swt.widgets.Display, Map<org.eclipse.swt.graphics.RGB, org.eclipse.swt.graphics.Color>> displayTablestores a map for each display found.keyTableis a hash map regrouping the string key of the color and the effective RGB color associated with. -
Constructor Summary
ConstructorsConstructorDescriptionCreates 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
Modifier and TypeMethodDescriptionAdds in the table a new color.voidRemembers the given color specification under the given key.voiddispose()protected voiddispose(org.eclipse.swt.widgets.Display display) Disposes the color manager with the values from the display.org.eclipse.swt.graphics.ColorGets the color resource matching the color string.org.eclipse.swt.graphics.ColorgetColor(org.eclipse.swt.graphics.RGB rgb) Removes from the table the color given by the string key.voidunbindColor(String key) Forgets the color specification remembered under the given key.
-
Field Details
-
displayTable
-
keyTable
-
-
Constructor Details
-
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 Details
-
add
-
bindColor
Remembers the given color specification under the given key.- Parameters:
key- the color keyrgb- the color specification- Throws:
UnsupportedOperationException- if there is already a color specification remembered under the given key
-
dispose
public void dispose()- Specified by:
disposein interfaceorg.eclipse.jface.text.source.ISharedTextColors- See Also:
-
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:
getColorin interfaceorg.eclipse.jface.text.source.ISharedTextColors- See Also:
-
getColor
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
-
unbindColor
Forgets the color specification remembered under the given key.- Parameters:
key- the color key
-