Java Code Examples for org.eclipse.jface.resource.StringConverter#asRGB()
The following examples show how to use
org.eclipse.jface.resource.StringConverter#asRGB() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EditorUtils.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
public static Color colorFromString(String rgbString) { if (rgbString != null && rgbString.trim().length() > 0) { Color col = JFaceResources.getColorRegistry().get(rgbString); try { if (col == null) { RGB rgb = StringConverter.asRGB(rgbString); JFaceResources.getColorRegistry().put(rgbString, rgb); col = JFaceResources.getColorRegistry().get(rgbString); } } catch (DataFormatException e) { log.error("Corrupt color value: " + rgbString, e); } return col; } return null; }
Example 2
Source File: PersistentTokenDescriptor.java From xds-ide with Eclipse Public License 1.0 | 5 votes |
public void preferenciesFromIni(Ini ini) { String s = ini.get(Config.DEFAULT_GLOBAL_SECTION_NAME, styleId); if (s != null) { styleWhenEnabled = Integer.parseInt(s); } else { styleWhenEnabled = getDefaultStyle(); } s = ini.get(Config.DEFAULT_GLOBAL_SECTION_NAME, disabledId); if (s != null) { isDisabled = (Integer.parseInt(s) != 0); } else { isDisabled = false; } s = ini.get(Config.DEFAULT_GLOBAL_SECTION_NAME, colorId); if (s != null) { rgbWhenEnabled = StringConverter.asRGB(s, getDefaultRgb()); } else { rgbWhenEnabled = getDefaultRgb(); } if (isDisabled && iTokens != null) { PersistentTokenDescriptor pt = iTokens.getDefaultColoring(); TextAttributeDescriptor ta = pt.getTextAttribute(); if (ta != null) { setTextAttribute(new TextAttributeDescriptor(ta.getForeground(), null, ta.getStyle())); } } else { setTextAttribute(new TextAttributeDescriptor(rgbWhenEnabled, null, styleWhenEnabled)); } }
Example 3
Source File: EditorAppearanceColorsComponent.java From goclipse with Eclipse Public License 1.0 | 5 votes |
public void setValues(String colorPrefValue, boolean useSystemDefaultPrefValue) { color = StringConverter.asRGB(colorPrefValue, PreferenceConverter.COLOR_DEFAULT_DEFAULT); useSystemDefault = false; if(useSystemDefaultKey != null) { useSystemDefault = useSystemDefaultPrefValue; } }
Example 4
Source File: ColorConfigLoader.java From translationstudio8 with GNU General Public License v2.0 | 4 votes |
private Color getColor(Device device, String key) { String fg = pfStore.getString(key); return new Color(device, StringConverter.asRGB(fg)); }
Example 5
Source File: ColorConfigLoader.java From tmxeditor8 with GNU General Public License v2.0 | 4 votes |
private Color getColor(Device device, String key) { String fg = pfStore.getString(key); return new Color(device, StringConverter.asRGB(fg)); }
Example 6
Source File: MinimapOverviewRuler.java From Pydev with Eclipse Public License 1.0 | 4 votes |
private void fillSelectionColorField() { String colorCode = preferenceStore.getString(MinimapOverviewRulerPreferencesPage.MINIMAP_SELECTION_COLOR); RGB asRGB = StringConverter.asRGB(colorCode); selectionColor = new Color(Display.getDefault(), asRGB); }
Example 7
Source File: TextStylingPreference.java From goclipse with Eclipse Public License 1.0 | 4 votes |
public static RGB getRgb(IPreferencesAccess prefsHelper, String key) { return StringConverter.asRGB(prefsHelper.getString(key), PreferenceConverter.COLOR_DEFAULT_DEFAULT); }
Example 8
Source File: ColorPreference.java From goclipse with Eclipse Public License 1.0 | 4 votes |
@Override protected RGB parseString(String stringValue) { return StringConverter.asRGB(stringValue); }
Example 9
Source File: Colors.java From depan with Apache License 2.0 | 2 votes |
/** * Convert the given string to a color. The string must have the form "R,G,B". * If the conversion fails, return a red color. * * @param key * @return the Color corresponding to the given string R,G,B */ public static Color getRgb(String key) { RGB rgb = StringConverter.asRGB(key, new RGB(255, 0, 0)); return colorFromRgb(rgb); }