Search in sources :

Example 11 with ColorRegistry

use of org.eclipse.jface.resource.ColorRegistry in project mylyn.docs by eclipse.

the class WikiTextUiResources method getColors.

/**
 * get colors for use in the UI
 *
 * @see #COLOR_HR
 * @see #COLOR_HR_SHADOW
 */
public static ColorRegistry getColors() {
    ColorRegistry colorRegistry = (ColorRegistry) Display.getCurrent().getData(KEY_COLOR_REGISTRY);
    if (colorRegistry == null) {
        colorRegistry = new ColorRegistry();
        colorRegistry.put(COLOR_HR, new RGB(132, 132, 132));
        colorRegistry.put(COLOR_HR_SHADOW, new RGB(206, 206, 206));
        Display.getCurrent().setData(KEY_COLOR_REGISTRY, colorRegistry);
    }
    return colorRegistry;
}
Also used : ColorRegistry(org.eclipse.jface.resource.ColorRegistry) RGB(org.eclipse.swt.graphics.RGB)

Example 12 with ColorRegistry

use of org.eclipse.jface.resource.ColorRegistry in project egit by eclipse.

the class DiffViewer method refreshDiffStyles.

private void refreshDiffStyles() {
    ColorRegistry col = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getColorRegistry();
    FontRegistry reg = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getFontRegistry();
    // We do the foreground via syntax coloring and the background via a
    // line background listener. If we did the background also via the
    // TextAttributes, this would take precedence over the line background
    // resulting in strange display if the current line is highlighted:
    // that highlighting would appear only beyond the end of the actual
    // text content (i.e., beyond the end-of-line), while actual text
    // would still get the background from the attribute.
    tokens.put(IDocument.DEFAULT_CONTENT_TYPE, new Token(null));
    tokens.put(DiffDocument.HEADLINE_CONTENT_TYPE, new Token(new TextAttribute(col.get(THEME_DiffHeadlineForegroundColor), null, SWT.NORMAL, reg.get(THEME_DiffHeadlineFont))));
    tokens.put(DiffDocument.HUNK_CONTENT_TYPE, new Token(new TextAttribute(col.get(THEME_DiffHunkForegroundColor))));
    tokens.put(DiffDocument.ADDED_CONTENT_TYPE, new Token(new TextAttribute(col.get(THEME_DiffAddForegroundColor))));
    tokens.put(DiffDocument.REMOVED_CONTENT_TYPE, new Token(new TextAttribute(col.get(THEME_DiffRemoveForegroundColor))));
    backgroundColors.put(DiffDocument.HEADLINE_CONTENT_TYPE, col.get(THEME_DiffHeadlineBackgroundColor));
    backgroundColors.put(DiffDocument.HUNK_CONTENT_TYPE, col.get(THEME_DiffHunkBackgroundColor));
    backgroundColors.put(DiffDocument.ADDED_CONTENT_TYPE, col.get(THEME_DiffAddBackgroundColor));
    backgroundColors.put(DiffDocument.REMOVED_CONTENT_TYPE, col.get(THEME_DiffRemoveBackgroundColor));
}
Also used : ColorRegistry(org.eclipse.jface.resource.ColorRegistry) TextAttribute(org.eclipse.jface.text.TextAttribute) FontRegistry(org.eclipse.jface.resource.FontRegistry) IToken(org.eclipse.jface.text.rules.IToken) Token(org.eclipse.jface.text.rules.Token)

Example 13 with ColorRegistry

use of org.eclipse.jface.resource.ColorRegistry in project polymap4-core by Polymap4.

the class CommonFilterSelectionDialog method customize.

private void customize() {
    ColorRegistry reg = JFaceResources.getColorRegistry();
    Color // $NON-NLS-1$
    c1 = reg.get("org.eclipse.ui.workbench.ACTIVE_TAB_BG_START"), // $NON-NLS-1$
    c2 = reg.get("org.eclipse.ui.workbench.ACTIVE_TAB_BG_END");
    customizationsTabFolder.setSelectionBackground(new Color[] { c1, c2 }, new int[] { 100 }, true);
    // $NON-NLS-1$
    customizationsTabFolder.setSelectionForeground(reg.get("org.eclipse.ui.workbench.ACTIVE_TAB_TEXT_COLOR"));
// RAP [bmichalik]
// customizationsTabFolder.setSimple(true);
}
Also used : ColorRegistry(org.eclipse.jface.resource.ColorRegistry) Color(org.eclipse.swt.graphics.Color)

Example 14 with ColorRegistry

use of org.eclipse.jface.resource.ColorRegistry in project webtools.sourceediting by eclipse.

the class PreferenceInitializer method initializeDefaultPreferences.

/* (non-Javadoc)
	 * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
	 */
public void initializeDefaultPreferences() {
    IPreferenceStore store = SSEUIPlugin.getDefault().getPreferenceStore();
    ColorRegistry registry = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getColorRegistry();
    // use the base annotation & quick diff preference page
    EditorsUI.useAnnotationsPreferencePage(store);
    EditorsUI.useQuickDiffPreferencePage(store);
    // let annotations show up in the vertical ruler if that's what the
    // preference is
    // // these annotation preferences have a different default value than
    // the one the base provides
    // store.setDefault("errorIndicationInVerticalRuler", false);
    // //$NON-NLS-1$
    // store.setDefault("warningIndicationInVerticalRuler", false);
    // //$NON-NLS-1$
    // these annotation preferences are not part of base text editor
    // preference
    store.setDefault(CommonEditorPreferenceNames.EVALUATE_TEMPORARY_PROBLEMS, true);
    setMatchingBracketsPreferences(store, registry);
    // hover help preferences are not part of base text editor preference
    // SWT.COMMAND
    String mod2Name = Action.findModifierString(SWT.MOD2);
    // on Mac;
    // SWT.CONTROL
    // elsewhere
    // $NON-NLS-1$
    store.setDefault(EditorPreferenceNames.EDITOR_TEXT_HOVER_MODIFIERS, "combinationHover|true|0;problemHover|false|0;documentationHover|false|0;annotationHover|true|" + mod2Name);
    // set default read-only foreground color scale value
    store.setDefault(EditorPreferenceNames.READ_ONLY_FOREGROUND_SCALE, 30);
    // set default enable folding value
    store.setDefault(AbstractStructuredFoldingStrategy.FOLDING_ENABLED, true);
    // set default for show message dialog when unknown content type in editor
    store.setDefault(EditorPreferenceNames.SHOW_UNKNOWN_CONTENT_TYPE_MSG, true);
    // set content assist defaults
    store.setDefault(EditorPreferenceNames.CODEASSIST_AUTOACTIVATION_DELAY, 500);
    PreferenceConverter.setDefault(store, EditorPreferenceNames.CODEASSIST_PROPOSALS_BACKGROUND, ColorHelper.findRGB(registry, EditorPreferenceNames.CODEASSIST_PROPOSALS_BACKGROUND, new RGB(255, 255, 255)));
    PreferenceConverter.setDefault(store, EditorPreferenceNames.CODEASSIST_PROPOSALS_FOREGROUND, ColorHelper.findRGB(registry, EditorPreferenceNames.CODEASSIST_PROPOSALS_FOREGROUND, new RGB(0, 0, 0)));
    PreferenceConverter.setDefault(store, EditorPreferenceNames.CODEASSIST_PARAMETERS_BACKGROUND, ColorHelper.findRGB(registry, EditorPreferenceNames.CODEASSIST_PARAMETERS_BACKGROUND, new RGB(255, 255, 255)));
    PreferenceConverter.setDefault(store, EditorPreferenceNames.CODEASSIST_PARAMETERS_FOREGROUND, ColorHelper.findRGB(registry, EditorPreferenceNames.CODEASSIST_PARAMETERS_FOREGROUND, new RGB(0, 0, 0)));
    store.setDefault(EditorPreferenceNames.SEMANTIC_HIGHLIGHTING, true);
}
Also used : ColorRegistry(org.eclipse.jface.resource.ColorRegistry) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore) RGB(org.eclipse.swt.graphics.RGB)

Example 15 with ColorRegistry

use of org.eclipse.jface.resource.ColorRegistry in project webtools.sourceediting by eclipse.

the class CSSUIPreferenceInitializer method initializeDefaultPreferences.

/* (non-Javadoc)
	 * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
	 */
public void initializeDefaultPreferences() {
    IPreferenceStore store = CSSUIPlugin.getDefault().getPreferenceStore();
    ColorRegistry registry = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getColorRegistry();
    // CSS Style Preferences
    // $NON-NLS-1$
    String NOBACKGROUNDBOLD = " | null | false";
    // $NON-NLS-1$
    String JUSTITALIC = " | null | false | true";
    String JUSTBOLD = " | null | true";
    // $NON-NLS-1$
    String styleValue = "null" + NOBACKGROUNDBOLD;
    store.setDefault(IStyleConstantsCSS.NORMAL, styleValue);
    styleValue = ColorHelper.findRGBString(registry, IStyleConstantsCSS.ATMARK_RULE, 63, 127, 127) + NOBACKGROUNDBOLD;
    store.setDefault(IStyleConstantsCSS.ATMARK_RULE, styleValue);
    styleValue = ColorHelper.findRGBString(registry, IStyleConstantsCSS.SELECTOR, 63, 127, 127) + JUSTBOLD;
    store.setDefault(IStyleConstantsCSS.SELECTOR, styleValue);
    styleValue = ColorHelper.findRGBString(registry, IStyleConstantsCSS.UNIVERSAL, 63, 127, 127) + NOBACKGROUNDBOLD;
    store.setDefault(IStyleConstantsCSS.UNIVERSAL, styleValue);
    styleValue = ColorHelper.findRGBString(registry, IStyleConstantsCSS.COMBINATOR, 63, 127, 127) + NOBACKGROUNDBOLD;
    store.setDefault(IStyleConstantsCSS.COMBINATOR, styleValue);
    styleValue = ColorHelper.findRGBString(registry, IStyleConstantsCSS.SELECTOR_CLASS, 63, 127, 127) + JUSTITALIC;
    store.setDefault(IStyleConstantsCSS.SELECTOR_CLASS, styleValue);
    styleValue = ColorHelper.findRGBString(registry, IStyleConstantsCSS.ID, 63, 127, 127) + JUSTITALIC;
    store.setDefault(IStyleConstantsCSS.ID, styleValue);
    styleValue = ColorHelper.findRGBString(registry, IStyleConstantsCSS.PSEUDO, 63, 127, 127) + JUSTITALIC;
    store.setDefault(IStyleConstantsCSS.PSEUDO, styleValue);
    /* Attribute selector */
    styleValue = ColorHelper.findRGBString(registry, IStyleConstantsCSS.ATTRIBUTE_DELIM, 63, 127, 127) + NOBACKGROUNDBOLD;
    store.setDefault(IStyleConstantsCSS.ATTRIBUTE_DELIM, styleValue);
    styleValue = ColorHelper.findRGBString(registry, IStyleConstantsCSS.ATTRIBUTE_NAME, 63, 127, 127) + NOBACKGROUNDBOLD;
    store.setDefault(IStyleConstantsCSS.ATTRIBUTE_NAME, styleValue);
    styleValue = ColorHelper.findRGBString(registry, IStyleConstantsCSS.ATTRIBUTE_OPERATOR, 63, 127, 127) + NOBACKGROUNDBOLD;
    store.setDefault(IStyleConstantsCSS.ATTRIBUTE_OPERATOR, styleValue);
    styleValue = ColorHelper.findRGBString(registry, IStyleConstantsCSS.ATTRIBUTE_VALUE, 63, 127, 127) + NOBACKGROUNDBOLD;
    store.setDefault(IStyleConstantsCSS.ATTRIBUTE_VALUE, styleValue);
    styleValue = ColorHelper.findRGBString(registry, IStyleConstantsCSS.MEDIA, 42, 0, 225) + NOBACKGROUNDBOLD;
    store.setDefault(IStyleConstantsCSS.MEDIA, styleValue);
    styleValue = ColorHelper.findRGBString(registry, IStyleConstantsCSS.COMMENT, 63, 95, 191) + NOBACKGROUNDBOLD;
    store.setDefault(IStyleConstantsCSS.COMMENT, styleValue);
    styleValue = ColorHelper.findRGBString(registry, IStyleConstantsCSS.PROPERTY_NAME, 127, 0, 127) + NOBACKGROUNDBOLD;
    store.setDefault(IStyleConstantsCSS.PROPERTY_NAME, styleValue);
    styleValue = ColorHelper.findRGBString(registry, IStyleConstantsCSS.PROPERTY_VALUE, 42, 0, 225) + JUSTITALIC;
    store.setDefault(IStyleConstantsCSS.PROPERTY_VALUE, styleValue);
    styleValue = ColorHelper.findRGBString(registry, IStyleConstantsCSS.URI, 42, 0, 225) + JUSTITALIC;
    store.setDefault(IStyleConstantsCSS.URI, styleValue);
    styleValue = ColorHelper.findRGBString(registry, IStyleConstantsCSS.STRING, 42, 0, 225) + JUSTITALIC;
    store.setDefault(IStyleConstantsCSS.STRING, styleValue);
    // $NON-NLS-1$
    styleValue = "null" + NOBACKGROUNDBOLD;
    store.setDefault(IStyleConstantsCSS.COLON, styleValue);
    store.setDefault(IStyleConstantsCSS.SEMI_COLON, styleValue);
    store.setDefault(IStyleConstantsCSS.CURLY_BRACE, styleValue);
    styleValue = ColorHelper.findRGBString(registry, IStyleConstantsCSS.ERROR, 191, 63, 63) + NOBACKGROUNDBOLD;
    store.setDefault(IStyleConstantsCSS.ERROR, styleValue);
    // set default new css file template to use in new file wizard
    /*
		 * Need to find template name that goes with default template id (name
		 * may change for different language)
		 */
    // $NON-NLS-1$
    store.setDefault(CSSUIPreferenceNames.NEW_FILE_TEMPLATE_ID, "org.eclipse.wst.css.ui.internal.templates.newcss");
    // Defaults for Content Assist preference page
    store.setDefault(CSSUIPreferenceNames.CONTENT_ASSIST_DO_NOT_DISPLAY_ON_DEFAULT_PAGE, "");
    store.setDefault(CSSUIPreferenceNames.CONTENT_ASSIST_DO_NOT_DISPLAY_ON_OWN_PAGE, "");
    store.setDefault(CSSUIPreferenceNames.CONTENT_ASSIST_DEFAULT_PAGE_SORT_ORDER, "org.eclipse.wst.css.ui.proposalCategory.css\0" + "org.eclipse.wst.css.ui.proposalCategory.cssTemplates");
    store.setDefault(CSSUIPreferenceNames.CONTENT_ASSIST_OWN_PAGE_SORT_ORDER, "org.eclipse.wst.css.ui.proposalCategory.cssTemplates\0" + "org.eclipse.wst.css.ui.proposalCategory.css");
    store.setDefault(CSSUIPreferenceNames.INSERT_SINGLE_SUGGESTION, true);
}
Also used : ColorRegistry(org.eclipse.jface.resource.ColorRegistry) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore)

Aggregations

ColorRegistry (org.eclipse.jface.resource.ColorRegistry)48 Color (org.eclipse.swt.graphics.Color)14 IPreferenceStore (org.eclipse.jface.preference.IPreferenceStore)8 RGB (org.eclipse.swt.graphics.RGB)6 TextAttribute (org.eclipse.jface.text.TextAttribute)5 GridData (org.eclipse.swt.layout.GridData)4 GridLayout (org.eclipse.swt.layout.GridLayout)4 java.awt (java.awt)2 ArrayList (java.util.ArrayList)2 LinkedList (java.util.LinkedList)2 IPresentationReconciler (org.eclipse.jface.text.presentation.IPresentationReconciler)2 PresentationReconciler (org.eclipse.jface.text.presentation.PresentationReconciler)2 DefaultDamagerRepairer (org.eclipse.jface.text.rules.DefaultDamagerRepairer)2 ControlEvent (org.eclipse.swt.events.ControlEvent)2 Display (org.eclipse.swt.widgets.Display)2 Label (org.eclipse.swt.widgets.Label)2 Text (org.eclipse.swt.widgets.Text)2 ITheme (org.eclipse.ui.themes.ITheme)2 PlotterListener (io.sloeber.ui.monitor.internal.PlotterListener)1 CoreException (org.eclipse.core.runtime.CoreException)1