+ // set preferences
+ Preferences.setPreferences(new Preferences()
+ {
+ @Override
+ public ColorDefinition getColorDefinition(String name)
+ {
+ RGB rgb = getColorRegistry().getRGB(name);
+ if (rgb == null)
+ {
+ StatusManager.getManager().handle(new Status(IStatus.ERROR, "net.mograsim.plugin.core", "No color for name " + name));
+ return new ColorDefinition(BuiltInColor.COLOR_BLACK);
+ }
+ return new ColorDefinition(rgb.red, rgb.green, rgb.blue);
+ }
+
+ @Override
+ public Color getColor(String name)
+ {
+ return getColorRegistry().get(name);
+ }
+
+ private ColorRegistry getColorRegistry()
+ {
+ return PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getColorRegistry();
+ }
+ });
+