private void doEventLoop() { Shell splash = getSplash(); while (fAuthenticated == false) { if (splash.getDisplay().readAndDispatch() == false) { splash.getDisplay().sleep(); } } for (Control control : splash.getChildren()) { control.dispose(); } String progressRectString = null; String messageRectString = null; String foregroundColorString = null; IProduct product = Platform.getProduct(); if (product != null) { progressRectString = product.getProperty(IProductConstants.STARTUP_PROGRESS_RECT); messageRectString = product.getProperty(IProductConstants.STARTUP_MESSAGE_RECT); foregroundColorString = product.getProperty(IProductConstants.STARTUP_FOREGROUND_COLOR); } Rectangle progressRect = StringConverter.asRectangle(progressRectString, new Rectangle(5, 275, 445, 15)); setProgressRect(progressRect); Rectangle messageRect = StringConverter.asRectangle(messageRectString, new Rectangle(0, 0, 0, 0)); // new Rectangle(7, 252, 445, 20)); setMessageRect(messageRect); getContent(); }
/** * @see * org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences() */ public void initializeDefaultPreferences() { IPreferenceStore store = UnifiedEditorsPlugin.getDefault().getPreferenceStore(); store.setDefault(com.aptana.ide.core.preferences.IPreferenceConstants.SHOW_LIVE_HELP, true); store.setDefault(IPreferenceConstants.CACHE_BUST_BROWSERS, true); store.setDefault(IPreferenceConstants.PIANO_KEY_DIFFERENCE, 7); store.setDefault(IPreferenceConstants.MATCH_BRACKETS, "true"); // $NON-NLS-1$ store.setDefault( IPreferenceConstants.MATCH_BRACKETS_COLOR, StringConverter.asString(new RGB(150, 150, 150))); store.setDefault(IPreferenceConstants.SHOW_WHITESPACE, false); store.setDefault(IPreferenceConstants.ENABLE_WORD_WRAP, false); store.setDefault(IPreferenceConstants.USER_AGENT_PREFERENCE, "IE,Mozilla"); // $NON-NLS-1$ store.setDefault(IPreferenceConstants.INSERT_ON_TAB, false); store.setDefault(AbstractTextEditor.PREFERENCE_NAVIGATION_SMART_HOME_END, false); store.setDefault(IPreferenceConstants.CONTENT_ASSIST_DELAY, 200); store.setDefault(IPreferenceConstants.COLORIZER_TEXT_HIGHLIGHT_ENABLED, false); store.setDefault( IPreferenceConstants.COLORIZER_TEXT_HIGHLIGHT_BACKGROUND_COLOR, StringConverter.asString(new RGB(212, 212, 212))); store.setDefault(IPreferenceConstants.COLORIZER_MAXCOLUMNS, 500); store.setDefault(IPreferenceConstants.EXPAND_EDITOR_OPTIONS, true); store.setDefault(IPreferenceConstants.EXPAND_TOKENS, true); store.setDefault(IPreferenceConstants.EXPAND_REGIONS, false); store.setDefault(IPreferenceConstants.SHOW_ERRORS, true); store.setDefault(IPreferenceConstants.SHOW_WARNINGS, false); store.setDefault(IPreferenceConstants.SHOW_INFOS, false); store.setDefault(IPreferenceConstants.DRAG_AND_DROP_ENABLED, true); store.setDefault(IPreferenceConstants.SORT_OUTLINE_ALPHABETICALLY, false); store.setDefault(IPreferenceConstants.PARSER_OFF_UI, true); // Tasks store.setDefault(IPreferenceConstants.COMPILER_TASK_CASE_SENSITIVE, true); store.setDefault(IPreferenceConstants.COMPILER_TASK_TAGS, "TODO,FIXME,XXX,OPTIMIZE"); store.setDefault(IPreferenceConstants.COMPILER_TASK_PRIORITIES, "NORMAL,HIGH,NORMAL,LOW"); // These two _must_ be set as a preference, or UnifiedEditor will crash // hard without // warning on initialization. // store.setDefault(ColorizerPreferencePage.HRD_SET, "default"); // store.setDefault(ColorizerPreferencePage.USE_BACK, true); // // store.setDefault(ColorizerPreferencePage.FULL_BACK, true); // store.setDefault(ColorizerPreferencePage.PAIRS_MATCH, // "PAIRS_OUTLINE"); // // store.setDefault(ColorizerPreferencePage.HORZ_CROSS, true); // store.setDefault(ColorizerPreferencePage.VERT_CROSS, true); // To set preferences for AbstractTextEditor store = org.eclipse.ui.internal.editors.text.EditorsPlugin.getDefault().getPreferenceStore(); store.setToDefault(AbstractTextEditor.PREFERENCE_NAVIGATION_SMART_HOME_END); store.setDefault(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_UNDO_HISTORY_SIZE, 500); }
@Override public void init(Shell splash) { super.init(splash); String progressRectString = null; String messageRectString = null; String foregroundColorString = null; IProduct product = Platform.getProduct(); if (product != null) { progressRectString = product.getProperty(IProductConstants.STARTUP_PROGRESS_RECT); messageRectString = product.getProperty(IProductConstants.STARTUP_MESSAGE_RECT); foregroundColorString = product.getProperty(IProductConstants.STARTUP_FOREGROUND_COLOR); } Rectangle progressRect = StringConverter.asRectangle(progressRectString, new Rectangle(10, 10, 300, 15)); setProgressRect(progressRect); Rectangle messageRect = StringConverter.asRectangle(messageRectString, new Rectangle(10, 35, 300, 15)); setMessageRect(messageRect); int foregroundColorInteger; try { foregroundColorInteger = Integer.parseInt(foregroundColorString, 16); } catch (Exception ex) { foregroundColorInteger = 0xD2D7FF; // off white } setForeground( new RGB( (foregroundColorInteger & 0xFF0000) >> 16, (foregroundColorInteger & 0xFF00) >> 8, foregroundColorInteger & 0xFF)); final Point buildIdPoint = new Point(322, 190); getContent() .addPaintListener( new PaintListener() { public void paintControl(PaintEvent e) { // System.out // .println("SplashHandler.init(...).new PaintListener() {...}.paintControl()"); e.gc.setForeground(getForeground()); e.gc.drawText( "v" + Activator.getDefault().getBundle().getHeaders().get("Bundle-Version"), buildIdPoint.x, buildIdPoint.y, true); } }); }
@Override public void initializeDefaultPreferences() { IPreferenceStore store = RentalUIActivator.getDefault().getPreferenceStore(); RGB black = new RGB(0, 0, 0); RGB red = new RGB(255, 0, 0); RGB green = new RGB(0, 255, 0); RGB blue = new RGB(0, 0, 255); store.setDefault(PREF_COLOR_AGENCIES, StringConverter.asString(black)); store.setDefault(PREF_COLOR_CUSTOMERS, StringConverter.asString(red)); store.setDefault(PREF_COLOR_RENTAL_OBJECTS, StringConverter.asString(green)); store.setDefault(PREF_COLOR_RENTALS, StringConverter.asString(blue)); store.setDefault(PREF_PALETTE, "com.st.rental.ui.palette.default"); }
private void adaptToTextForegroundChange(Highlighting highlighting, PropertyChangeEvent event) { RGB rgb = null; Object value = event.getNewValue(); if (value instanceof RGB) rgb = (RGB) value; else if (value instanceof String) rgb = StringConverter.asRGB((String) value); if (rgb != null) { String property = event.getProperty(); Color color = fColorManager.getColor(property); if ((color == null || !rgb.equals(color.getRGB())) && fColorManager instanceof IColorManagerExtension) { IColorManagerExtension ext = (IColorManagerExtension) fColorManager; ext.unbindColor(property); ext.bindColor(property, rgb); color = fColorManager.getColor(property); } TextAttribute oldAttr = highlighting.getTextAttribute(); highlighting.setTextAttribute( new TextAttribute(color, oldAttr.getBackground(), oldAttr.getStyle())); } }
public static Color getConnectionTypeColor(DBPConnectionType connectionType) { String rgbString = connectionType.getColor(); if (CommonUtils.isEmpty(rgbString)) { return null; } return DBeaverUI.getSharedTextColors().getColor(StringConverter.asRGB(rgbString)); }
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()); } }
@Inject public void setOkForegroundColor( Display display, @Preference(nodePath = IConstant.PREFERENCE_NODE, value = IPreferenceKey.COLOR_OK_FOREGROUND) String rgbText) { okForegroundColor = new Color(display, StringConverter.asRGB(rgbText)); }
/** * Not thread safe, but should only be called from the UI Thread, so it's not really a problem. * * @param rgb * @return The <code>Color</code> instance cached for this rgb value, creating it along the way if * required. */ public static Color getColor(RGB rgb) { ColorRegistry r = getDefault().getColorCache(); String rgbString = StringConverter.asString(rgb); if (!r.hasValueFor(rgbString)) { r.put(rgbString, rgb); } return r.get(rgbString); }
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()); } }
@Inject public void setSuppressedGrblBackgroundColor( Display display, @Preference( nodePath = IConstant.PREFERENCE_NODE, value = IPreferenceKey.COLOR_GRBL_SUPPRESSED_BACKGROUND) String rgbText) { suppressedGrblBackgroundColor = new Color(display, StringConverter.asRGB(rgbText)); }
@Inject public void setSuppressedErrorForegroundColor( Display display, @Preference( nodePath = IConstant.PREFERENCE_NODE, value = IPreferenceKey.COLOR_ERROR_SUPPRESSED_FOREGROUND) String rgbText) { supppressedErrorForegroundColor = new Color(display, StringConverter.asRGB(rgbText)); }
@Inject public void setTimestampBackgroundColor( Display display, @Preference( nodePath = IConstant.PREFERENCE_NODE, value = IPreferenceKey.COLOR_TIMESTAMP_BACKGROUND) String rgbText) { timestampBackgroundColor = new Color(display, StringConverter.asRGB(rgbText)); }
@Inject public void setTerminalForegroundColor( Display display, @Preference( nodePath = IConstant.PREFERENCE_NODE, value = IPreferenceKey.COLOR_TERMINAL_FOREGROUND) String rgbText) { terminalForegroundColor = new Color(display, StringConverter.asRGB(rgbText)); if (terminalText != null && !terminalText.isDisposed()) terminalText.setForeground(terminalForegroundColor); }
public void setErrorMessage(String errorMessage) { this.errorMessage = errorMessage; if (errorMessageText != null && !errorMessageText.isDisposed()) { errorMessageText.setText(errorMessage == null ? " \n " : errorMessage); // $NON-NLS-1$ boolean hasError = errorMessage != null && (StringConverter.removeWhiteSpaces(errorMessage)).length() > 0; errorMessageText.setEnabled(hasError); errorMessageText.setVisible(hasError); errorMessageText.getParent().update(); Control button = getButton(IDialogConstants.OK_ID); if (button != null) { button.setEnabled(errorMessage == null); } } }
/** * Sets or clears the error message. If not <code>null</code>, the OK button is disabled. * * @param errorMessage the error message, or <code>null</code> to clear */ public void setErrorMessage(String errorMessage) { this.errorMessage = errorMessage; if (errorMessageText != null && !errorMessageText.isDisposed()) { errorMessageText.setText(errorMessage == null ? " \n " : errorMessage); // $NON-NLS-1$ // Disable the error message text control if there is no error, or // no error text (empty or whitespace only). Hide it also to avoid color change. boolean hasError = errorMessage != null && (StringConverter.removeWhiteSpaces(errorMessage)).length() > 0; errorMessageText.setEnabled(hasError); errorMessageText.setVisible(hasError); errorMessageText.getParent().update(); // Access the ok button by id, in case clients have overridden button creation. Control button = getButton(IDialogConstants.OK_ID); if (button != null) { button.setEnabled(errorMessage == null); } } }
public static Color getConnectionColor(DBPConnectionConfiguration connectionInfo) { String rgbString = connectionInfo.getConnectionColor(); if (CommonUtils.isEmpty(rgbString)) { rgbString = connectionInfo.getConnectionType().getColor(); } if (CommonUtils.isEmpty(rgbString)) { return null; } Color connectionColor = DBeaverUI.getSharedTextColors().getColor(StringConverter.asRGB(rgbString)); if (connectionColor.getBlue() == 255 && connectionColor.getRed() == 255 && connectionColor.getGreen() == 255) { // For white color return just null to avoid explicit color set. // It is important for dark themes return null; } return connectionColor; }
/** * Updates the change font button and the previewer to reflect the newly selected font. * * @param font The FontData[] to update with. */ private void updateFont(FontData font[]) { FontData[] bestFont = JFaceResources.getFontRegistry().filterData(font, valueControl.getDisplay()); // if we have nothing valid do as best we can if (bestFont == null) { bestFont = getDefaultFontData(); } // Now cache this value in the receiver this.chosenFont = bestFont; if (valueControl != null) { valueControl.setText(StringConverter.asString(chosenFont[0])); } if (previewer != null) { previewer.setFont(bestFont); } }
private void adaptToColorChange(PropertyChangeEvent event) { RGB rgb = null; Token token = (Token) tokenMap.get(event.getProperty()); LToken lToken = (LToken) tokenMap.get(event.getProperty() + MARK_SUFFIX); if (token == null && lToken == null) { return; } Object value = event.getNewValue(); if (value instanceof RGB) rgb = (RGB) value; else if (value instanceof String) rgb = StringConverter.asRGB((String) value); if (rgb != null) { String property = event.getProperty(); Object data = token.getData(); if (data instanceof TextAttribute) { TextAttribute oldAttr = (TextAttribute) data; TextAttribute newAttr = new TextAttribute( colorManager.getColor(property), oldAttr.getBackground(), oldAttr.getStyle()); if (token != null) token.setData(newAttr); if (lToken != null) lToken.setData(newAttr); } } }
/* * @see org.eclipse.ui.views.properties.tabbed.view.ITabbedPropertySection#refresh() */ public void refresh() { FontData fontdata = buttonElement.getControl().getFont().getFontData()[0]; fontText.setText(StringConverter.asString(fontdata)); }
public void initializeDefaultPreferences() { IPreferenceStore store = HTMLPlugin.getDefault().getPreferenceStore(); store.setDefault(HTMLPlugin.PREF_COLOR_TAG, StringConverter.asString(IHTMLColorConstants.TAG)); store.setDefault( HTMLPlugin.PREF_COLOR_COMMENT, StringConverter.asString(IHTMLColorConstants.HTML_COMMENT)); store.setDefault( HTMLPlugin.PREF_COLOR_DOCTYPE, StringConverter.asString(IHTMLColorConstants.PROC_INSTR)); store.setDefault( HTMLPlugin.PREF_COLOR_STRING, StringConverter.asString(IHTMLColorConstants.STRING)); store.setDefault( HTMLPlugin.PREF_COLOR_SCRIPT, StringConverter.asString(IHTMLColorConstants.SCRIPT)); store.setDefault( HTMLPlugin.PREF_COLOR_CSSPROP, StringConverter.asString(IHTMLColorConstants.CSS_PROP)); store.setDefault( HTMLPlugin.PREF_COLOR_CSSCOMMENT, StringConverter.asString(IHTMLColorConstants.CSS_COMMENT)); store.setDefault( HTMLPlugin.PREF_COLOR_CSSVALUE, StringConverter.asString(IHTMLColorConstants.CSS_VALUE)); store.setDefault(HTMLPlugin.PREF_EDITOR_TYPE, "tab"); store.setDefault(HTMLPlugin.PREF_DTD_URI, ""); store.setDefault(HTMLPlugin.PREF_DTD_PATH, ""); store.setDefault(HTMLPlugin.PREF_DTD_CACHE, true); store.setDefault(HTMLPlugin.PREF_ASSIST_AUTO, true); store.setDefault(HTMLPlugin.PREF_ASSIST_CHARS, "</\""); store.setDefault(HTMLPlugin.PREF_ASSIST_CLOSE, true); store.setDefault(HTMLPlugin.PREF_ASSIST_TIMES, 0); store.setDefault(HTMLPlugin.PREF_USE_SOFTTAB, false); store.setDefault(HTMLPlugin.PREF_SOFTTAB_WIDTH, 2); store.setDefault( HTMLPlugin.PREF_COLOR_FG, StringConverter.asString(IHTMLColorConstants.FOREGROUND)); store.setDefault( HTMLPlugin.PREF_COLOR_BG, StringConverter.asString(IHTMLColorConstants.BACKGROUND)); store.setDefault(HTMLPlugin.PREF_COLOR_BG_DEF, true); store.setDefault( HTMLPlugin.PREF_JSP_COMMENT, StringConverter.asString(IHTMLColorConstants.JAVA_COMMENT)); store.setDefault( HTMLPlugin.PREF_JSP_STRING, StringConverter.asString(IHTMLColorConstants.JAVA_STRING)); store.setDefault( HTMLPlugin.PREF_JSP_KEYWORD, StringConverter.asString(IHTMLColorConstants.JAVA_KEYWORD)); store.setDefault(HTMLPlugin.PREF_JSP_FIX_PATH, false); store.setDefault(HTMLPlugin.PREF_PAIR_CHAR, true); store.setDefault(HTMLPlugin.PREF_SHOW_XML_ERRORS, false); store.setDefault( HTMLPlugin.PREF_COLOR_JSCOMMENT, StringConverter.asString(IHTMLColorConstants.JAVA_COMMENT)); store.setDefault( HTMLPlugin.PREF_COLOR_JSSTRING, StringConverter.asString(IHTMLColorConstants.JAVA_STRING)); store.setDefault( HTMLPlugin.PREF_COLOR_JSKEYWORD, StringConverter.asString(IHTMLColorConstants.JAVA_KEYWORD)); store.setDefault( HTMLPlugin.PREF_COLOR_JSDOC, StringConverter.asString(IHTMLColorConstants.JSDOC)); store.setDefault(HTMLPlugin.PREF_CUSTOM_ATTRS, ""); store.setDefault(HTMLPlugin.PREF_CUSTOM_ELEMENTS, ""); store.setDefault(HTMLPlugin.PREF_TASK_TAGS, "FIXME\t2\nTODO\t1\nXXXX\t1\n"); store.setDefault(HTMLPlugin.PREF_ENABLE_CLASSNAME, false); store.setDefault( HTMLPlugin.PREF_CLASSNAME_ATTRS, "type class classname className bean component"); store.setDefault(HTMLPlugin.PREF_SCHEMA_MAPPINGS, ""); store.setDefault(HTMLPlugin.PREF_AUTO_EDIT, true); store.setDefault( HTMLPlugin.PREF_COLOR_TAGLIB, StringConverter.asString(IHTMLColorConstants.TAGLIB)); store.setDefault( HTMLPlugin.PREF_COLOR_TAGLIB_ATTR, StringConverter.asString(IHTMLColorConstants.TAGLIB_ATTR)); store.setDefault(HTMLPlugin.PREF_FORMATTER_TAB, false); store.setDefault(HTMLPlugin.PREF_FORMATTER_INDENT, 2); store.setDefault(HTMLPlugin.PREF_FORMATTER_LINE, 120); getContributions(store); }
public Color3f getMinorColor() { String value = getString(MINOR_GRID_COLOR); RGB color = StringConverter.asRGB(value); return new Color3f( (float) (color.red / 255.0), (float) (color.green / 255.0), (float) (color.blue / 255.0)); }
/** * Creates a <code>AnnotationPreference</code> the given configuration element. * * @param element the configuration element * @return the created annotation preference */ private AnnotationPreference createSpec(IConfigurationElement element) { String s; int i; boolean b; ReadOnlyAnnotationPreference info = new ReadOnlyAnnotationPreference(); s = element.getAttribute("annotationType"); // $NON-NLS-1$ if (s == null || s.trim().length() == 0) return null; info.setAnnotationType(s); s = element.getAttribute("label"); // $NON-NLS-1$ if (s != null && s.trim().length() > 0) info.setPreferenceLabel(s); s = element.getAttribute("markerType"); // $NON-NLS-1$ if (s != null && s.trim().length() > 0) info.setMarkerType(s); s = element.getAttribute("markerSeverity"); // $NON-NLS-1$ if (s != null && s.trim().length() > 0) { i = StringConverter.asInt(s, IMarker.SEVERITY_INFO); info.setSeverity(i); } s = element.getAttribute("textPreferenceKey"); // $NON-NLS-1$ if (s != null && s.trim().length() > 0) info.setTextPreferenceKey(s); s = element.getAttribute("textPreferenceValue"); // $NON-NLS-1$ if (s != null && s.trim().length() > 0) { b = StringConverter.asBoolean(s, false); info.setTextPreferenceValue(b); } s = element.getAttribute("highlightPreferenceKey"); // $NON-NLS-1$ if (s != null && s.trim().length() > 0) info.setHighlightPreferenceKey(s); s = element.getAttribute("highlightPreferenceValue"); // $NON-NLS-1$ if (s != null && s.trim().length() > 0) { b = StringConverter.asBoolean(s, false); info.setHighlightPreferenceValue(b); } s = element.getAttribute("overviewRulerPreferenceKey"); // $NON-NLS-1$ if (s != null && s.trim().length() > 0) info.setOverviewRulerPreferenceKey(s); s = element.getAttribute("overviewRulerPreferenceValue"); // $NON-NLS-1$ if (s != null && s.trim().length() > 0) { b = StringConverter.asBoolean(s, false); info.setOverviewRulerPreferenceValue(b); } s = element.getAttribute("verticalRulerPreferenceKey"); // $NON-NLS-1$ if (s != null && s.trim().length() > 0) info.setVerticalRulerPreferenceKey(s); s = element.getAttribute("verticalRulerPreferenceValue"); // $NON-NLS-1$ if (s != null && s.trim().length() > 0) { b = StringConverter.asBoolean(s, true); info.setVerticalRulerPreferenceValue(b); } s = element.getAttribute("colorPreferenceKey"); // $NON-NLS-1$ if (s != null && s.trim().length() > 0) info.setColorPreferenceKey(s); s = element.getAttribute("colorPreferenceValue"); // $NON-NLS-1$ if (s != null && s.trim().length() > 0) { RGB rgb = StringConverter.asRGB(s); info.setColorPreferenceValue(rgb == null ? new RGB(0, 0, 0) : rgb); } s = element.getAttribute("presentationLayer"); // $NON-NLS-1$ if (s != null && s.trim().length() > 0) { i = StringConverter.asInt(s, 0); info.setPresentationLayer(i); } s = element.getAttribute("contributesToHeader"); // $NON-NLS-1$ if (s != null && s.trim().length() > 0) { b = StringConverter.asBoolean(s, false); info.setContributesToHeader(b); } s = element.getAttribute("showInNextPrevDropdownToolbarActionKey"); // $NON-NLS-1$ if (s != null && s.trim().length() > 0) info.setShowInNextPrevDropdownToolbarActionKey(s); s = element.getAttribute("showInNextPrevDropdownToolbarAction"); // $NON-NLS-1$ if (s != null && s.trim().length() > 0) { b = StringConverter.asBoolean(s, false); info.setShowInNextPrevDropdownToolbarAction(b); } s = element.getAttribute("isGoToNextNavigationTargetKey"); // $NON-NLS-1$ if (s != null && s.trim().length() > 0) info.setIsGoToNextNavigationTargetKey(s); s = element.getAttribute("isGoToNextNavigationTarget"); // $NON-NLS-1$ if (s != null && s.trim().length() > 0) { b = StringConverter.asBoolean(s, false); info.setIsGoToNextNavigationTarget(b); } s = element.getAttribute("isGoToPreviousNavigationTargetKey"); // $NON-NLS-1$ if (s != null && s.trim().length() > 0) info.setIsGoToPreviousNavigationTargetKey(s); s = element.getAttribute("isGoToPreviousNavigationTarget"); // $NON-NLS-1$ if (s != null && s.trim().length() > 0) { b = StringConverter.asBoolean(s, false); info.setIsGoToPreviousNavigationTarget(b); } s = element.getAttribute("symbolicIcon"); // $NON-NLS-1$ if (s != null && s.trim().length() > 0) info.setSymbolicImageName(s); s = element.getAttribute("icon"); // $NON-NLS-1$ if (s != null && s.trim().length() > 0) info.setImageDescriptor(getImageDescriptor(s, element)); s = element.getAttribute("quickFixIcon"); // $NON-NLS-1$ if (s != null && s.trim().length() > 0) info.setQuickFixImageDescriptor(getImageDescriptor(s, element)); s = element.getAttribute("annotationImageProvider"); // $NON-NLS-1$ if (s != null && s.trim().length() > 0) info.setAnnotationImageProviderData(element, "annotationImageProvider"); // $NON-NLS-1$ s = element.getAttribute("textStylePreferenceKey"); // $NON-NLS-1$ if (s != null && s.trim().length() > 0) info.setTextStylePreferenceKey(s); s = element.getAttribute("textStylePreferenceValue"); // $NON-NLS-1$ if (s != null && s.trim().length() > 0) { if (AnnotationPreference.STYLE_BOX.equals(s) || AnnotationPreference.STYLE_DASHED_BOX.equals(s) || AnnotationPreference.STYLE_IBEAM.equals(s) || AnnotationPreference.STYLE_SQUIGGLES.equals(s) || AnnotationPreference.STYLE_PROBLEM_UNDERLINE.equals(s) || AnnotationPreference.STYLE_UNDERLINE.equals(s)) info.setTextStyleValue(s); else info.setTextStyleValue(AnnotationPreference.STYLE_NONE); } s = element.getAttribute("includeOnPreferencePage"); // $NON-NLS-1$ info.setIncludeOnPreferencePage(s == null || StringConverter.asBoolean(s, true)); info.markReadOnly(); return info; }
private static String toString(RGB selection) { return StringConverter.asString(selection); }
public void setCurrentTheme(Theme theme) { fCurrentTheme = theme; // Set the find in file search color IEclipsePreferences prefs = new InstanceScope().getNode("org.eclipse.search"); // $NON-NLS-1$ prefs.put( "org.eclipse.search.potentialMatch.fgColor", toString(theme.getSearchResultColor())); // $NON-NLS-1$ try { prefs.flush(); } catch (BackingStoreException e) { ThemePlugin.logError(e); } // Set the color for the search result annotation, the pref key is "searchResultIndicationColor" prefs = new InstanceScope().getNode("org.eclipse.ui.editors"); // $NON-NLS-1$ if (!theme.hasEntry("override.searchResultIndication")) // $NON-NLS-1$ { prefs.put( "searchResultIndicationColor", toString(theme.getSearchResultColor())); // $NON-NLS-1$ } // TODO Use markup.changed bg color for "decoration color" in Prefs>General>Appearance>Colors // and Fonts // TODO Move this stuff over to theme change listeners in the XML/HTML/Ruby editor plugins? if (!theme.hasEntry("override.xmlTagPairOccurrenceIndication")) // $NON-NLS-1$ { prefs.putBoolean("xmlTagPairOccurrenceIndicationHighlighting", false); // $NON-NLS-1$ prefs.putBoolean("xmlTagPairOccurrenceIndication", true); // $NON-NLS-1$ prefs.put( "xmlTagPairOccurrenceIndicationColor", toString(theme.getOccurenceHighlightColor())); // $NON-NLS-1$ prefs.put( "xmlTagPairOccurrenceIndicationTextStyle", AnnotationPreference.STYLE_BOX); // $NON-NLS-1$ } if (!theme.hasEntry("override.htmlTagPairOccurrenceIndication")) // $NON-NLS-1$ { prefs.putBoolean("htmlTagPairOccurrenceIndicationHighlighting", false); // $NON-NLS-1$ prefs.putBoolean("htmlTagPairOccurrenceIndication", true); // $NON-NLS-1$ prefs.put( "htmlTagPairOccurrenceIndicationColor", toString(theme.getOccurenceHighlightColor())); // $NON-NLS-1$ prefs.put( "htmlTagPairOccurrenceIndicationTextStyle", AnnotationPreference.STYLE_BOX); // $NON-NLS-1$ } if (!theme.hasEntry("override.rubyBlockPairOccurrenceIndication")) // $NON-NLS-1$ { prefs.putBoolean("rubyBlockPairOccurrenceIndicationHighlighting", false); // $NON-NLS-1$ prefs.putBoolean("rubyBlockPairOccurrenceIndication", true); // $NON-NLS-1$ prefs.put( "rubyBlockPairOccurrenceIndicationColor", toString(theme.getOccurenceHighlightColor())); // $NON-NLS-1$ prefs.put( "rubyBlockPairOccurrenceIndicationTextStyle", AnnotationPreference.STYLE_BOX); // $NON-NLS-1$ } // PyDev Occurrences (com.python.pydev.occurrences) // Override them if pydev is set to use our themes if (Platform.getPreferencesService() .getBoolean( "org.python.pydev.red_core", "PYDEV_USE_APTANA_THEMES", true, //$NON-NLS-1$ //$NON-NLS-2$ null)) { if (!theme.hasEntry("override.pydevOccurrenceIndication")) // $NON-NLS-1$ { MarkerAnnotationPreferences preferences = new MarkerAnnotationPreferences(); AnnotationPreference pydevOccurPref = null; for (Object obj : preferences.getAnnotationPreferences()) { AnnotationPreference pref = (AnnotationPreference) obj; Object type = pref.getAnnotationType(); if ("com.python.pydev.occurrences".equals(type)) // $NON-NLS-1$ { pydevOccurPref = pref; } } if (pydevOccurPref != null) { if (pydevOccurPref.getTextStylePreferenceKey() != null) { // Now that pydev supports text style, use the box style and don't highlight. prefs.putBoolean("pydevOccurrenceHighlighting", false); // $NON-NLS-1$ prefs.putBoolean("pydevOccurrenceIndication", true); // $NON-NLS-1$ prefs.put( "pydevOccurrenceIndicationColor", toString(theme.getOccurenceHighlightColor())); // $NON-NLS-1$ prefs.put( "pydevOccurrenceIndicationTextStyle", AnnotationPreference.STYLE_BOX); // $NON-NLS-1$ } else { // Must use highlighting, since we're against older pydev that had no text style prefs.putBoolean("pydevOccurrenceHighlighting", true); // $NON-NLS-1$ prefs.putBoolean("pydevOccurrenceIndication", true); // $NON-NLS-1$ prefs.put( "pydevOccurrenceIndicationColor", toString(theme.getSearchResultColor())); // $NON-NLS-1$ } } } } try { prefs.flush(); } catch (BackingStoreException e) { ThemePlugin.logError(e); } // Set the bg/fg/selection colors for compare editors prefs = new InstanceScope().getNode("org.eclipse.compare"); // $NON-NLS-1$ prefs.putBoolean(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT, false); prefs.put( AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND, StringConverter.asString(theme.getBackground())); prefs.putBoolean(AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND_SYSTEM_DEFAULT, false); prefs.put( AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND, StringConverter.asString(theme.getForeground())); prefs.putBoolean( AbstractTextEditor.PREFERENCE_COLOR_SELECTION_BACKGROUND_SYSTEM_DEFAULT, false); prefs.put( AbstractTextEditor.PREFERENCE_COLOR_SELECTION_BACKGROUND, StringConverter.asString(theme.getSelectionAgainstBG())); prefs.putBoolean( AbstractTextEditor.PREFERENCE_COLOR_SELECTION_FOREGROUND_SYSTEM_DEFAULT, false); prefs.put( AbstractTextEditor.PREFERENCE_COLOR_SELECTION_FOREGROUND, StringConverter.asString(theme.getForeground())); prefs.put( AbstractDecoratedTextEditorPreferenceConstants.EDITOR_CURRENT_LINE_COLOR, toString(theme.getLineHighlightAgainstBG())); try { prefs.flush(); } catch (BackingStoreException e) { ThemePlugin.logError(e); } // Also set the standard eclipse editor props, like fg, bg, selection fg, bg prefs = new InstanceScope().getNode("com.aptana.editor.common"); // $NON-NLS-1$ prefs.putBoolean( AbstractTextEditor.PREFERENCE_COLOR_SELECTION_FOREGROUND_SYSTEM_DEFAULT, false); prefs.put( AbstractTextEditor.PREFERENCE_COLOR_SELECTION_FOREGROUND, toString(theme.getSelectionAgainstBG())); prefs.putBoolean(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT, false); prefs.put(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND, toString(theme.getBackground())); prefs.putBoolean(AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND_SYSTEM_DEFAULT, false); prefs.put(AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND, toString(theme.getForeground())); prefs.put( AbstractDecoratedTextEditorPreferenceConstants.EDITOR_CURRENT_LINE_COLOR, toString(theme.getLineHighlightAgainstBG())); try { prefs.flush(); } catch (BackingStoreException e) { ThemePlugin.logError(e); } prefs = new InstanceScope().getNode(ThemePlugin.PLUGIN_ID); prefs.put(IPreferenceConstants.ACTIVE_THEME, theme.getName()); prefs.putLong(THEME_CHANGED, System.currentTimeMillis()); try { prefs.flush(); } catch (BackingStoreException e) { ThemePlugin.logError(e); } // Force font final String[] fontIds = new String[] { IThemeManager.VIEW_FONT_NAME, JFaceResources.TEXT_FONT, "org.eclipse.ui.workbench.texteditor.blockSelectionModeFont" }; //$NON-NLS-1$ UIUtils.getDisplay() .asyncExec( new Runnable() { public void run() { for (String fontId : fontIds) { Font fFont = JFaceResources.getFontRegistry().get(fontId); // Only set new values if they're different from existing! Font existing = JFaceResources.getFont(fontId); String existingString = ""; // $NON-NLS-1$ if (!existing.isDisposed()) { existingString = PreferenceConverter.getStoredRepresentation(existing.getFontData()); } String fdString = PreferenceConverter.getStoredRepresentation(fFont.getFontData()); if (!existingString.equals(fdString)) { // put in registry... JFaceResources.getFontRegistry().put(fontId, fFont.getFontData()); } } } }); }
public void setKey(String key, int value) { setKey(key, StringConverter.asString(value)); }