Exemplo n.º 1
0
 public static RGB convertRGB(String key, String value) {
   if (Styles.NONE.equals(value)) return null;
   if (Styles.SYSTEM.equals(value)) {
     return getSystemRGB(key, null);
   }
   return ColorUtils.toRGB(value);
 }
Exemplo n.º 2
0
 private void setValueToPicker(Object value) {
   ISelection selection;
   if (configurer.isNoneValueSet()
       && (configurer.getNoneValue() == value
           || (configurer.getNoneValue() != null && configurer.getNoneValue().equals(value)))) {
     selection = new ColorSelection(ColorSelection.NONE);
   } else if (configurer.isAutoValueSet()
       && (configurer.getAutoValue() == value
           || (configurer.getAutoValue() != null && configurer.getAutoValue().equals(value)))) {
     selection = new ColorSelection(ColorSelection.AUTO);
   } else if (value instanceof String) {
     RGB color = ColorUtils.toRGB((String) value);
     selection = color == null ? ColorSelection.EMPTY : new ColorSelection(color);
   } else if (value instanceof RGB) {
     selection = new ColorSelection((RGB) value);
   } else {
     selection = ColorSelection.EMPTY;
   }
   picker.setSelection(selection);
 }