private void handleSyntaxColorListSelection() { HighlightingColorListItem item = getHighlightingColorListItem(); if (item == null) { fEnableCheckbox.setEnabled(false); fSyntaxForegroundColorEditor.getButton().setEnabled(false); fColorEditorLabel.setEnabled(false); fBoldCheckBox.setEnabled(false); fItalicCheckBox.setEnabled(false); fStrikethroughCheckBox.setEnabled(false); fUnderlineCheckBox.setEnabled(false); return; } RGB rgb = PreferenceConverter.getColor(getPreferenceStore(), item.getColorKey()); fSyntaxForegroundColorEditor.setColorValue(rgb); fBoldCheckBox.setSelection(getPreferenceStore().getBoolean(item.getBoldKey())); fItalicCheckBox.setSelection(getPreferenceStore().getBoolean(item.getItalicKey())); fStrikethroughCheckBox.setSelection( getPreferenceStore().getBoolean(item.getStrikethroughKey())); fUnderlineCheckBox.setSelection(getPreferenceStore().getBoolean(item.getUnderlineKey())); if (item instanceof SemanticHighlightingColorListItem) { boolean semanticHighlightingEnabled = getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_SEMANTIC_HIGHLIGHTING_ENABLED); fEnableCheckbox.setEnabled(semanticHighlightingEnabled); boolean enable = semanticHighlightingEnabled && getPreferenceStore() .getBoolean(((SemanticHighlightingColorListItem) item).getEnableKey()); fEnableCheckbox.setSelection(enable); fSyntaxForegroundColorEditor.getButton().setEnabled(enable); fColorEditorLabel.setEnabled(enable); fBoldCheckBox.setEnabled(enable); fItalicCheckBox.setEnabled(enable); fStrikethroughCheckBox.setEnabled(enable); fUnderlineCheckBox.setEnabled(enable); } else { fSyntaxForegroundColorEditor.getButton().setEnabled(true); fColorEditorLabel.setEnabled(true); fBoldCheckBox.setEnabled(true); fItalicCheckBox.setEnabled(true); fStrikethroughCheckBox.setEnabled(true); fUnderlineCheckBox.setEnabled(true); fEnableCheckbox.setEnabled(false); fEnableCheckbox.setSelection(true); } }
private OverlayPreferenceStore.OverlayKey[] createOverlayStoreKeys() { List<OverlayPreferenceStore.OverlayKey> overlayKeys = new ArrayList<OverlayPreferenceStore.OverlayKey>(); overlayKeys.add( new OverlayPreferenceStore.OverlayKey( OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_SEMANTIC_HIGHLIGHTING_ENABLED)); for (int i = 0, n = fListModel.size(); i < n; i++) { HighlightingColorListItem item = fListModel.get(i); overlayKeys.add( new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, item.getColorKey())); overlayKeys.add( new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, item.getBoldKey())); overlayKeys.add( new OverlayPreferenceStore.OverlayKey( OverlayPreferenceStore.BOOLEAN, item.getItalicKey())); overlayKeys.add( new OverlayPreferenceStore.OverlayKey( OverlayPreferenceStore.BOOLEAN, item.getStrikethroughKey())); overlayKeys.add( new OverlayPreferenceStore.OverlayKey( OverlayPreferenceStore.BOOLEAN, item.getUnderlineKey())); if (item instanceof SemanticHighlightingColorListItem) overlayKeys.add( new OverlayPreferenceStore.OverlayKey( OverlayPreferenceStore.BOOLEAN, ((SemanticHighlightingColorListItem) item).getEnableKey())); } OverlayPreferenceStore.OverlayKey[] keys = new OverlayPreferenceStore.OverlayKey[overlayKeys.size()]; overlayKeys.toArray(keys); return keys; }