/** * Private constructor to avoid instantiation. */ private XYGraphMediaFactory() { _colorRegistry = new ColorRegistry(); _imageRegistry = new ImageRegistry(); _fontRegistry = new FontRegistry(); _imageCache = new HashMap<ImageDescriptor, Image>(); // dispose all images from the image cache, when the display is disposed Display.getDefault().addListener(SWT.Dispose, new Listener() { public void handleEvent(final Event event) { for (Image img : _imageCache.values()) { img.dispose(); } disposeResources(); } }); }
private Color getColor(final String configurationKey, final String defaultColorKey) { String colorKey = configuration.getString(configurationKey, defaultColorKey); RGB rgbColorData; try { rgbColorData = StringConverter.asRGB(colorKey); } catch (final RuntimeException e) { logger.log(Level.FINER, e.toString(), e); logger.log(Level.INFO, Messages.get("err.invalid.color"), colorKey); colorKey = defaultColorKey; rgbColorData = StringConverter.asRGB(colorKey); } final ColorRegistry colorRegistry = JFaceResources.getColorRegistry(); if (!colorRegistry.hasValueFor(colorKey)) { colorRegistry.put(colorKey, rgbColorData); } return colorRegistry.get(colorKey); }
private void updateUI_Colors(final Composite parent) { final ColorRegistry colorRegistry = JFaceResources.getColorRegistry(); final Color fgColor = colorRegistry.get(IPhotoPreferences.PHOTO_VIEWER_COLOR_FOREGROUND); final Color bgColor = colorRegistry.get(IPhotoPreferences.PHOTO_VIEWER_COLOR_BACKGROUND); // final Color fgColor = Display.getCurrent().getSystemColor(SWT.COLOR_MAGENTA); // final Color bgColor = Display.getCurrent().getSystemColor(SWT.COLOR_YELLOW); final Color selectionFgColor = colorRegistry.get(IPhotoPreferences.PHOTO_VIEWER_COLOR_SELECTION_FOREGROUND); final Color noFocusSelectionFgColor = Display.getCurrent().getSystemColor(SWT.COLOR_TITLE_INACTIVE_BACKGROUND); _galleryContainer.setForeground(fgColor); _galleryContainer.setBackground(bgColor); _photoGallery.updateColors(fgColor, bgColor, selectionFgColor, noFocusSelectionFgColor, true); }
private void updateColors(final boolean isRestore) { _isStateShowFileFolderInFolderItem = _prefStore.getBoolean(// IPhotoPreferences.PHOTO_VIEWER_IS_SHOW_FILE_FOLDER); final ColorRegistry colorRegistry = JFaceResources.getColorRegistry(); final Color fgColor = colorRegistry.get(IPhotoPreferences.PHOTO_VIEWER_COLOR_FOREGROUND); final Color bgColor = colorRegistry.get(IPhotoPreferences.PHOTO_VIEWER_COLOR_BACKGROUND); final Color selectionFgColor = colorRegistry.get(IPhotoPreferences.PHOTO_VIEWER_COLOR_SELECTION_FOREGROUND); final Color noFocusSelectionFgColor = Display.getCurrent().getSystemColor(SWT.COLOR_TITLE_INACTIVE_BACKGROUND); final Tree tree = _folderViewer.getTree(); tree.setForeground(fgColor); tree.setBackground(bgColor); _picDirImages.updateColors(fgColor, bgColor, selectionFgColor, noFocusSelectionFgColor, isRestore); }
/** * Set photo colors in the JFace color registry from the pref store */ public static void setPhotoColorsFromPrefStore() { // pref store var cannot be set from a static field because it can be null !!! final IPreferenceStore prefStore = Activator.getDefault().getPreferenceStore(); final ColorRegistry colorRegistry = JFaceResources.getColorRegistry(); colorRegistry.put(IPhotoPreferences.PHOTO_VIEWER_COLOR_FOREGROUND, // PreferenceConverter.getColor(prefStore, IPhotoPreferences.PHOTO_VIEWER_COLOR_FOREGROUND)); colorRegistry.put(IPhotoPreferences.PHOTO_VIEWER_COLOR_BACKGROUND, // PreferenceConverter.getColor(prefStore, IPhotoPreferences.PHOTO_VIEWER_COLOR_BACKGROUND)); colorRegistry.put(IPhotoPreferences.PHOTO_VIEWER_COLOR_SELECTION_FOREGROUND, // PreferenceConverter.getColor(prefStore, IPhotoPreferences.PHOTO_VIEWER_COLOR_SELECTION_FOREGROUND)); colorRegistry.put(IPhotoPreferences.PHOTO_VIEWER_COLOR_FOLDER, // PreferenceConverter.getColor(prefStore, IPhotoPreferences.PHOTO_VIEWER_COLOR_FOLDER)); colorRegistry.put(IPhotoPreferences.PHOTO_VIEWER_COLOR_FILE, // PreferenceConverter.getColor(prefStore, IPhotoPreferences.PHOTO_VIEWER_COLOR_FILE)); }
private void inititalizeColors() { if (getSite().getShell().isDisposed()) return; Display display= getSite().getShell().getDisplay(); if (display == null || display.isDisposed()) return; setForeground(display.getSystemColor(SWT.COLOR_INFO_FOREGROUND)); ColorRegistry registry= JFaceResources.getColorRegistry(); registry.addListener(this); fBackgroundColorRGB= registry.getRGB(getBackgroundColorKey()); Color bgColor; if (fBackgroundColorRGB == null) { bgColor= display.getSystemColor(SWT.COLOR_INFO_BACKGROUND); fBackgroundColorRGB= bgColor.getRGB(); } else { bgColor= new Color(display, fBackgroundColorRGB); fBackgroundColor= bgColor; } setBackground(bgColor); }
public static void setThemeBasedPreferences(IPreferenceStore store, boolean fireEvent) { ColorRegistry registry = null; if (PlatformUI.isWorkbenchRunning()) registry = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getColorRegistry(); setDefault(store, PreferenceConstants.EDITOR_CONFIG_COLORING_PROPERTY_KEY, findRGB(registry, IEditorConfigThemeConstants.EDITOR_CONFIG_COLORING_PROPERTY_KEY, new RGB(0, 0, 0)), fireEvent); setDefault(store, PreferenceConstants.EDITOR_CONFIG_COLORING_PROPERTY_VALUE, findRGB(registry, IEditorConfigThemeConstants.EDITOR_CONFIG_COLORING_PROPERTY_VALUE, new RGB(42, 0, 255)), fireEvent); setDefault(store, PreferenceConstants.EDITOR_CONFIG_COLORING_ASSIGNMENT, findRGB(registry, IEditorConfigThemeConstants.EDITOR_CONFIG_COLORING_ASSIGNMENT, new RGB(0, 0, 0)), fireEvent); setDefault(store, PreferenceConstants.EDITOR_CONFIG_COLORING_COMMENT, findRGB(registry, IEditorConfigThemeConstants.EDITOR_CONFIG_COLORING_COMMENT, new RGB(63, 127, 95)), fireEvent); setDefault(store, PreferenceConstants.EDITOR_CONFIG_COLORING_SECTION, findRGB(registry, IEditorConfigThemeConstants.EDITOR_CONFIG_COLORING_SECTION, new RGB(0, 0, 0)), fireEvent); }
/** * Return the Color that is stored in the Color table as rgb. */ public static Color getColor(RGB rgb) { Color color = null; if(rgb != null) { String rgbName = rgb.toString(); synchronized(rgbName.intern()) { ColorRegistry colorRegistry = getColorRegistry(); color = colorRegistry.get(rgbName); if (color == null) { colorRegistry.put(rgbName, rgb); color = colorRegistry.get(rgbName); } } } return color; }
/** * Initializes the given preference store with the default values. * * @param store * the preference store to be initialized * */ public static void initializeDefaultValues(IPreferenceStore store) { ColorRegistry registry = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getColorRegistry(); // JSX tag border setDefaultAndFireEvent(store, PreferenceConstants.EDITOR_TYPESCRIPT_DECORATOR_COLOR, findRGB(registry, ITypeScriptThemeConstants.EDITOR_TYPESCRIPT_DECORATOR_COLOR, new RGB(100, 100, 100))); store.setDefault(PreferenceConstants.EDITOR_TYPESCRIPT_DECORATOR_BOLD, false); store.setDefault(PreferenceConstants.EDITOR_TYPESCRIPT_DECORATOR_ITALIC, false); // JSX tag border setDefaultAndFireEvent(store, PreferenceConstants.EDITOR_JSX_TAG_BORDER_COLOR, findRGB(registry, ITypeScriptThemeConstants.EDITOR_JSX_TAG_BORDER_COLOR, new RGB(0, 128, 128))); store.setDefault(PreferenceConstants.EDITOR_JSX_TAG_BORDER_BOLD, false); store.setDefault(PreferenceConstants.EDITOR_JSX_TAG_BORDER_ITALIC, false); // JSX tag name setDefaultAndFireEvent(store, PreferenceConstants.EDITOR_JSX_TAG_NAME_COLOR, findRGB(registry, ITypeScriptThemeConstants.EDITOR_JSX_TAG_NAME_COLOR, new RGB(63, 127, 127))); store.setDefault(PreferenceConstants.EDITOR_JSX_TAG_NAME_BOLD, false); store.setDefault(PreferenceConstants.EDITOR_JSX_TAG_NAME_ITALIC, false); // JSX tag attribute name setDefaultAndFireEvent(store, PreferenceConstants.EDITOR_JSX_TAG_ATTRIBUTE_NAME_COLOR, findRGB(registry, ITypeScriptThemeConstants.EDITOR_JSX_TAG_ATTRIBUTE_NAME_COLOR, new RGB(127, 0, 127))); store.setDefault(PreferenceConstants.EDITOR_JSX_TAG_ATTRIBUTE_NAME_BOLD, false); store.setDefault(PreferenceConstants.EDITOR_JSX_TAG_ATTRIBUTE_NAME_ITALIC, false); // JSX tag attribute value setDefaultAndFireEvent(store, PreferenceConstants.EDITOR_JSX_TAG_ATTRIBUTE_VALUE_COLOR, findRGB(registry, ITypeScriptThemeConstants.EDITOR_JSX_TAG_ATTRIBUTE_VALUE_COLOR, new RGB(42, 0, 255))); store.setDefault(PreferenceConstants.EDITOR_JSX_TAG_ATTRIBUTE_VALUE_BOLD, false); store.setDefault(PreferenceConstants.EDITOR_JSX_TAG_ATTRIBUTE_VALUE_ITALIC, true); }
@Override public void applyStyles(TextStyle textStyle) { ColorRegistry colorRegistry = JFaceResources.getColorRegistry(); if (fontDescriptor != null) { textStyle.font = fontDescriptor.createFont(Display.getCurrent()); } if (foregroundColorName != null) { textStyle.foreground = colorRegistry.get(foregroundColorName); } if (backgroundColorName != null) { textStyle.background = colorRegistry.get(backgroundColorName); } }
/** * Starts a new {@link StyleRange} given a specific line type. */ private StyleRange initDiffStyleRangeForLineType(DiffLineType lineType, int startTextOffset) { ColorRegistry reg = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getColorRegistry(); StyleRange range = new StyleRange(); range.start = startTextOffset; switch (lineType) { case ADD: range.foreground = reg.get(THEME_DiffAddForegroundColor); range.background = reg.get(THEME_DiffAddBackgroundColor); break; case REMOVE: range.foreground = reg.get(THEME_DiffRemoveForegroundColor); range.background = reg.get(THEME_DiffRemoveBackgroundColor); break; case HUNK: range.foreground = reg.get(THEME_DiffHunkForegroundColor); range.background = reg.get(THEME_DiffHunkBackgroundColor); break; case HEADLINE: range.foreground = reg.get(THEME_DiffHeadlineForegroundColor); range.background = reg.get(THEME_DiffHeadlineBackgroundColor); FontRegistry fontReg = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getFontRegistry(); range.font = fontReg.get(THEME_DiffHeadlineFont); break; default: break; } return range; }
@Override public void applyStyles(TextStyle textStyle) { FontData fd = FontUtils.getTextEditorFontData(); textStyle.font = SWTResourceManager.getBoldFont(SWTResourceManager.getFont(fd.getName(), fd.getHeight(), fd.getStyle())); ColorRegistry colorRegistry = JFaceResources.getColorRegistry(); if (fForegroundColorName != null) textStyle.foreground = colorRegistry.get(fForegroundColorName); if (fBackgroundColorName != null) textStyle.background = colorRegistry.get(fBackgroundColorName); }
public void run() { ColorRegistry cm = JFaceResources.getColorRegistry(); RGB errorRGB = new RGB(255, 255, 180); cm.put("error", errorRGB); //$NON-NLS-1$ backgroundErrorColor = cm.get("error"); //$NON-NLS-1$ }
private Composite createUI(final Composite parent) { _shellContainer = new Composite(parent, SWT.NONE); GridLayoutFactory .fillDefaults()// .margins(SHELL_MARGIN, SHELL_MARGIN) .spacing(0, 0) .applyTo(_shellContainer); // _shellContainer.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_RED)); { createUI_10_ColorViewer(_shellContainer); createUI_20_Actions(_shellContainer); } // set color for all controls final ColorRegistry colorRegistry = JFaceResources.getColorRegistry(); final Color fgColor = colorRegistry.get(IPhotoPreferences.PHOTO_VIEWER_COLOR_FOREGROUND); final Color bgColor = colorRegistry.get(IPhotoPreferences.PHOTO_VIEWER_COLOR_BACKGROUND); net.tourbook.common.UI.setChildColors(_shellContainer, fgColor, bgColor); _shellContainer.addDisposeListener(new DisposeListener() { @Override public void widgetDisposed(final DisposeEvent e) { onDispose(); } }); return _shellContainer; }
/** * Set tag colors in the JFace color registry from the pref store */ public static void setViewColorsFromPrefStore() { // pref store var cannot be set from a static field because it can be null !!! final IPreferenceStore prefStore = TourbookPlugin.getDefault().getPreferenceStore(); final ColorRegistry colorRegistry = JFaceResources.getColorRegistry(); colorRegistry.put( VIEW_COLOR_CATEGORY, // PreferenceConverter.getColor(prefStore, ITourbookPreferences.VIEW_LAYOUT_COLOR_CATEGORY)); colorRegistry.put( VIEW_COLOR_TITLE, // PreferenceConverter.getColor(prefStore, ITourbookPreferences.VIEW_LAYOUT_COLOR_TITLE)); colorRegistry.put( VIEW_COLOR_SUB, // year PreferenceConverter.getColor(prefStore, ITourbookPreferences.VIEW_LAYOUT_COLOR_SUB)); colorRegistry.put( VIEW_COLOR_SUB_SUB, // month PreferenceConverter.getColor(prefStore, ITourbookPreferences.VIEW_LAYOUT_COLOR_SUB_SUB)); colorRegistry.put( VIEW_COLOR_TOUR, // PreferenceConverter.getColor(prefStore, ITourbookPreferences.VIEW_LAYOUT_COLOR_TOUR)); colorRegistry.put( VIEW_COLOR_BG_HISTORY_TOUR, // PreferenceConverter.getColor(prefStore, ITourbookPreferences.VIEW_LAYOUT_COLOR_BG_HISTORY_TOUR)); }
private static void init() { if (_bgColor != null) { return; } // ensure color registry is setup PhotoUI.init(); final ColorRegistry colorRegistry = JFaceResources.getColorRegistry(); _bgColor = colorRegistry.get(IPhotoPreferences.PHOTO_VIEWER_COLOR_BACKGROUND); _tourPaintConfig = TourPainterConfiguration.getInstance(); /** * this code optimizes the performance by reading from the pref store which is not very * efficient */ getTourPainterSettings(); // create pref listener _prefChangeListener = new IPropertyChangeListener() { @Override public void propertyChange(final PropertyChangeEvent event) { final String property = event.getProperty(); // test if the color or statistic data have changed if (property.equals(ITourbookPreferences.GRAPH_COLORS_HAS_CHANGED)) { getTourPainterSettings(); } } }; // add pref listener, dispose is not removing it because it is static !!! TourbookPlugin.getDefault().getPreferenceStore()// .addPropertyChangeListener(_prefChangeListener); }
private void updateUI_Colors() { final ColorRegistry colorRegistry = JFaceResources.getColorRegistry(); final Color fgColor = getShellColor_Foreground(colorRegistry); final Color bgColor = getShellColor_Background(colorRegistry); _rrShellNoResize.updateColors(fgColor, bgColor); _rrShellWithResize.updateColors(fgColor, bgColor); }
private void setFocusColors() { final ITheme theme = getTheme(); final ColorRegistry colorRegistry = theme.getColorRegistry(); final Color textColor = colorRegistry.get(IWorkbenchThemeConstants.ACTIVE_TAB_TEXT_COLOR); if (textColor != null) { tabFolder.setSelectionForeground(textColor); } final Color startBgColor = colorRegistry.get(IWorkbenchThemeConstants.ACTIVE_TAB_BG_START); final Color endBgColor = colorRegistry.get(IWorkbenchThemeConstants.ACTIVE_TAB_BG_END); if (startBgColor != null && endBgColor != null) { final int percent = theme.getInt(IWorkbenchThemeConstants.ACTIVE_TAB_PERCENT); final boolean vertical = theme.getBoolean(IWorkbenchThemeConstants.ACTIVE_TAB_VERTICAL); tabFolder.setSelectionBackground(new Color[] {startBgColor, endBgColor}, new int[] {percent}, vertical); } }
private void setNoFocusColors() { final ITheme theme = getTheme(); final ColorRegistry colorRegistry = theme.getColorRegistry(); final Color textColor = colorRegistry.get(IWorkbenchThemeConstants.ACTIVE_NOFOCUS_TAB_TEXT_COLOR); if (textColor != null) { tabFolder.setSelectionForeground(textColor); } final Color startBgColor = colorRegistry.get(IWorkbenchThemeConstants.ACTIVE_NOFOCUS_TAB_BG_START); final Color endBgColor = colorRegistry.get(IWorkbenchThemeConstants.ACTIVE_NOFOCUS_TAB_BG_END); if (startBgColor != null && endBgColor != null) { final int percent = theme.getInt(IWorkbenchThemeConstants.ACTIVE_NOFOCUS_TAB_PERCENT); final boolean vertical = theme.getBoolean(IWorkbenchThemeConstants.ACTIVE_NOFOCUS_TAB_VERTICAL); tabFolder.setSelectionBackground(new Color[] {startBgColor, endBgColor}, new int[] {percent}, vertical); } }
/** * Returns the RGB for the given key in the given color registry. * * @param key the key for the constant in the registry * @param defaultRGB the default RGB if no entry is found * @return RGB the RGB * @since 3.3 */ private static RGB findRGB(String key, RGB defaultRGB) { if (!PlatformUI.isWorkbenchRunning()) return defaultRGB; ColorRegistry registry= PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getColorRegistry(); RGB rgb= registry.getRGB(key); if (rgb != null) return rgb; return defaultRGB; }
/** * Returns the RGB for the given key in the given color registry. * * @param registry the color registry * @param key the key for the constant in the registry * @param defaultRGB the default RGB if no entry is found * @return RGB the RGB * @since 3.4 */ private static RGB findRGB(ColorRegistry registry, String key, RGB defaultRGB) { if (registry == null) return defaultRGB; RGB rgb= registry.getRGB(key); if (rgb != null) return rgb; return defaultRGB; }
public void applyStyles(TextStyle textStyle) { ColorRegistry colorRegistry = JFaceResources.getColorRegistry(); if (fForegroundColorName != null) { textStyle.foreground = colorRegistry.get(fForegroundColorName); } if (fBackgroundColorName != null) { textStyle.background = colorRegistry.get(fBackgroundColorName); } }
protected void initialize(String[] keywords) { ColorRegistry registry = JFaceResources.getColorRegistry(); IToken keyword = new Token(new TextAttribute(registry.get(KEYWORD_COLOR), null, SWT.BOLD)); IToken string = new Token(new TextAttribute(registry.get(STRING_COLOR))); IToken number = new Token(new TextAttribute(registry.get(NUMBER_COLOR))); IToken annotation = new Token(new TextAttribute(registry.get(ANNOTATION_COLOR))); IToken defaultToken = new Token(new TextAttribute(registry.get(DEFAULT_COLOR))); List<IRule> rules = new ArrayList<IRule>(); // strings rules.add(new SingleLineRule("\"", "\"", string, '\\')); // annotations rules.add(new MultiLineRule("[", "]", annotation)); // numbers rules.add(new NumberRule(number)); // keywords and normal (default) text WordRule wordRule = new WordRule(new WordDetector(), defaultToken); for (int i = 0; i < keywords.length; i++) { wordRule.addWord(keywords[i], keyword); } rules.add(wordRule); setRules(rules.toArray(new IRule[rules.size()])); }
private IRule[] createRules() { ColorRegistry colorRegistry = JFaceResources.getColorRegistry(); IToken tokenKeyword = new Token(new TextAttribute(colorRegistry.get(COLOR_KEY_KEYWORD), null, SWT.BOLD)); IToken tokenNumber = new Token(new TextAttribute(colorRegistry.get(COLOR_KEY_NUMBER))); IToken tokenParam = new Token(new TextAttribute(colorRegistry.get(COLOR_KEY_PARAM))); IToken tokenName = new Token(new TextAttribute(null)); return new IRule[] { createKeywordRule(tokenKeyword), new NumberRule(tokenNumber), createParamRule(tokenParam), createWhitespaceRule(), createNameRule(tokenName) }; }
/**Gets the color. * @param id * @param defaultRGB * @return */ public static Color getColor(String id, RGB defaultRGB) { ColorRegistry registry= null; if (PlatformUI.isWorkbenchRunning()) registry= PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getColorRegistry(); RGB rgb = findRGB(registry, id, defaultRGB); return getColor(rgb); }
private static RGB findRGB(ColorRegistry registry, String key, RGB defaultRGB) { if (registry == null) return defaultRGB; RGB rgb= registry.getRGB(key); if (rgb != null) return rgb; return defaultRGB; }
protected Color getSavedColor (int r, int g, int b) { String colorString = "SB_DEFAULT:" + r + "-" + g + "-" + b; ColorRegistry colorRegistry = JFaceResources.getColorRegistry(); if (!colorRegistry.hasValueFor(colorString)) { colorRegistry.put(colorString, new RGB(r, g, b)); } return colorRegistry.get(colorString); }
/** * Initializes the given preference store with the default values. */ public static void initializeDefaultValues() { IPreferenceStore store = getPreferenceStore(); ColorRegistry registry = PlatformUI.getWorkbench().getThemeManager() .getCurrentTheme().getColorRegistry(); // HTML Style Preferences String NOBACKGROUNDBOLD = " | null | false"; //$NON-NLS-1$ String JUSTITALIC = " | null | false | true"; //$NON-NLS-1$ String JUSTBOLD = " | null | true | false"; //$NON-NLS-1$ // SyntaxColoringPage String styleValue = ColorHelper.findRGBString(registry, IStyleConstantsForAngular.ANGULAR_EXPRESSION_BORDER, 0, 0, 128) + JUSTBOLD; store.setDefault(IStyleConstantsForAngular.ANGULAR_EXPRESSION_BORDER, styleValue); styleValue = " null|" + ColorHelper.findRGBString(registry, IStyleConstantsForAngular.ANGULAR_EXPRESSION, 232, 235, 255) + " | false | false"; store.setDefault(IStyleConstantsForAngular.ANGULAR_EXPRESSION, styleValue); styleValue = ColorHelper.findRGBString(registry, IStyleConstantsForAngular.ANGULAR_DIRECTIVE_NAME, 0, 0, 128) + JUSTBOLD; store.setDefault(IStyleConstantsForAngular.ANGULAR_DIRECTIVE_NAME, styleValue); // styleValue = ColorHelper.findRGBString(registry, // IStyleConstantsForAngular.ANGULAR_DIRECTIVE_PARAMETER_NAME, 14, // 140, 145) // + JUSTBOLD; // store.setDefault( // IStyleConstantsForAngular.ANGULAR_DIRECTIVE_PARAMETER_NAME, // styleValue); // Enable highlighting store.setDefault( AngularUIPreferenceNames.HIGHLIGHTING_DIRECTIVE_ENABLED, true); //$NON-NLS-1$ store.setDefault( AngularUIPreferenceNames.HIGHLIGHTING_EXPRESSION_ENABLED, true); //$NON-NLS-1$ // Defaults for the Typing preference page store.setDefault(AngularUIPreferenceNames.TYPING_COMPLETE_END_EL, true); }
protected Color getColor(String name) { final ColorRegistry cr = JFaceResources.getColorRegistry(); return cr.get(name); }
public void initializeDefaultPreferences() { IPreferenceStore store = JSONUIPlugin.getDefault().getPreferenceStore(); ColorRegistry registry = PlatformUI.getWorkbench().getThemeManager() .getCurrentTheme().getColorRegistry(); // JSON Style Preferences String NOBACKGROUNDBOLD = " | null | false"; //$NON-NLS-1$ String JUSTITALIC = " | null | false | true"; //$NON-NLS-1$ String JUSTBOLD = " | null | true"; //$NON-NLS-1$ String styleValue = "null" + NOBACKGROUNDBOLD; //$NON-NLS-1$ store.setDefault(IStyleConstantsJSON.NORMAL, styleValue); styleValue = ColorHelper.findRGBString(registry, IStyleConstantsJSON.COLON, 0, 0, 0) + NOBACKGROUNDBOLD; store.setDefault(IStyleConstantsJSON.COLON, styleValue); styleValue = ColorHelper.findRGBString(registry, IStyleConstantsJSON.CURLY_BRACE, 0, 0, 0) + NOBACKGROUNDBOLD; store.setDefault(IStyleConstantsJSON.CURLY_BRACE, styleValue); styleValue = ColorHelper.findRGBString(registry, IStyleConstantsJSON.COMMA, 0, 0, 0) + NOBACKGROUNDBOLD; store.setDefault(IStyleConstantsJSON.COMMA, styleValue); styleValue = ColorHelper.findRGBString(registry, IStyleConstantsJSON.COMMENT, 63, 95, 191) + NOBACKGROUNDBOLD; store.setDefault(IStyleConstantsJSON.COMMENT, styleValue); // JSON Key styleValue = ColorHelper.findRGBString(registry, IStyleConstantsJSON.OBJECT_KEY, 127, 0, 127) + NOBACKGROUNDBOLD; store.setDefault(IStyleConstantsJSON.OBJECT_KEY, styleValue); // JSON Value styleValue = ColorHelper.findRGBString(registry, IStyleConstantsJSON.VALUE_STRING, 42, 0, 255) + JUSTITALIC; store.setDefault(IStyleConstantsJSON.VALUE_STRING, styleValue); styleValue = ColorHelper.findRGBString(registry, IStyleConstantsJSON.VALUE_NUMBER, 255, 0, 0) + NOBACKGROUNDBOLD; store.setDefault(IStyleConstantsJSON.VALUE_NUMBER, styleValue); styleValue = ColorHelper.findRGBString(registry, IStyleConstantsJSON.VALUE_BOOLEAN, 255, 140, 0) + NOBACKGROUNDBOLD; store.setDefault(IStyleConstantsJSON.VALUE_BOOLEAN, styleValue); styleValue = ColorHelper.findRGBString(registry, IStyleConstantsJSON.VALUE_NULL, 150, 150, 150) + NOBACKGROUNDBOLD; store.setDefault(IStyleConstantsJSON.VALUE_NULL, styleValue); }
@Override protected Composite createToolTipContentArea(final Composite parent) { final Composite container = createUI(parent); final ColorRegistry colorRegistry = JFaceResources.getColorRegistry(); _fgColor = colorRegistry.get(IPhotoPreferences.PHOTO_VIEWER_COLOR_FOREGROUND); _bgColor = colorRegistry.get(IPhotoPreferences.PHOTO_VIEWER_COLOR_BACKGROUND); updateUI(); net.tourbook.common.UI.setChildColors(parent, _fgColor, _bgColor); if (_oldMapFilterData != null) { /* * _oldMapFilterData can be set before the UI is created */ updateFilterUI(_oldMapFilterData); } enableActions(); return container; }
@Override protected Color getShellColor_Background(final ColorRegistry colorRegistry) { return colorRegistry.get(IPhotoPreferences.PHOTO_VIEWER_COLOR_BACKGROUND); }
@Override protected Color getShellColor_Foreground(final ColorRegistry colorRegistry) { return colorRegistry.get(IPhotoPreferences.PHOTO_VIEWER_COLOR_FOREGROUND); }
protected Color getShellColor_Background(final ColorRegistry colorRegistry) { return Display.getCurrent().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND); }
protected Color getShellColor_Foreground(final ColorRegistry colorRegistry) { return Display.getCurrent().getSystemColor(SWT.COLOR_WIDGET_FOREGROUND); }
public TopLevelWindowAttributeContribution() { colorRegistry = new ColorRegistry(); }
ColorApplicator( ScrollableAdapterFactory factory ) { attributeApplicator = new AttributeApplicator( factory ); colorRegistry = new ColorRegistry(); }