Beispiel #1
0
  protected void refreshControls() {
    String colorValue = fDiagramModelObject.getFillColor();
    RGB rgb = ColorFactory.convertStringToRGB(colorValue);
    if (rgb == null) {
      rgb = ColorFactory.getDefaultFillColor(fDiagramModelObject).getRGB();
    }

    fColorChooser.setColorValue(rgb);

    boolean enabled =
        fDiagramModelObject instanceof ILockable
            ? !((ILockable) fDiagramModelObject).isLocked()
            : true;
    fColorChooser.setEnabled(enabled);

    // If user pref is to save the color then it's a different meaning of default
    boolean isDefaultColor = (colorValue == null);
    if (Preferences.STORE.getBoolean(IPreferenceConstants.SAVE_USER_DEFAULT_COLOR)) {
      isDefaultColor =
          (colorValue != null)
              && rgb.equals(ColorFactory.getDefaultFillColor(fDiagramModelObject).getRGB());
    }
    fColorChooser.setIsDefaultColor(isDefaultColor);
  }