public void storeHighlight( final IPreferenceStore store, final TokenHighlight th, HighlightStyle style) { if (store != null) { store.setValue(th.getColorKey(), StringConverter.asString(style.getColor())); store.setValue(th.getStylesKey(), style.getStyles()); } }
private void loadColors() { fColors = new HashMap<TokenHighlight, HighlightStyle>(); for (final TokenHighlight th : TokenHighlight.values()) { final HighlightStyle data = new HighlightStyle(); data.load(COLORS_QUALIFIER + th.getName(), th.getDefaultData()); fColors.put(th, data); } }
private void loadDefaultEditorColors() { final IPreferenceStore rootStore = getPreferenceStore(); for (final TokenHighlight th : TokenHighlight.values()) { final HighlightStyle data = th.getDefaultStyle(); rootStore.setDefault(th.getColorKey(), StringConverter.asString(data.getColor())); rootStore.setDefault(th.getStylesKey(), data.getStyles()); } }
@Override public boolean performOk() { for (final TokenHighlight th : fColors.keySet()) { final IEclipsePreferences node = new InstanceScope().getNode(COLORS_QUALIFIER + th.getName()); final HighlightStyle data = fColors.get(th); // TODO only if different than default! data.store(node); } return super.performOk(); }
void handleSyntaxColorListSelection() { final TokenHighlight item = getHighlight(); fEnableCheckbox.setEnabled(item != null); fSyntaxForegroundColorEditor.getButton().setEnabled(item != null); fColorEditorLabel.setEnabled(item != null); fBoldCheckBox.setEnabled(item != null); fItalicCheckBox.setEnabled(item != null); fStrikethroughCheckBox.setEnabled(item != null); fUnderlineCheckBox.setEnabled(item != null); if (item == null) { return; } final HighlightStyle style = item.getStyle(fOverlayStore); fSyntaxForegroundColorEditor.setColorValue(style.getColor()); fBoldCheckBox.setSelection(style.hasStyle(SWT.BOLD)); fItalicCheckBox.setSelection(style.hasStyle(SWT.ITALIC)); fStrikethroughCheckBox.setSelection(style.hasStyle(TextAttribute.STRIKETHROUGH)); fUnderlineCheckBox.setSelection(style.hasStyle(TextAttribute.UNDERLINE)); // if (item instanceof SemanticHighlightingColorListItem) { // fEnableCheckbox.setEnabled(true); // final boolean enable = 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); // } }