Search in sources :

Example 16 with ColorRegistry

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

the class JSPUIPreferenceInitializer method initializeDefaultPreferences.

/*
	 * (non-Javadoc)
	 * 
	 * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
	 */
public void initializeDefaultPreferences() {
    IPreferenceStore store = JSPUIPlugin.getDefault().getPreferenceStore();
    ColorRegistry registry = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getColorRegistry();
    // setting the same as HTML
    store.setDefault(JSPUIPreferenceNames.AUTO_PROPOSE, true);
    // $NON-NLS-1$
    store.setDefault(JSPUIPreferenceNames.AUTO_PROPOSE_CODE, "<=");
    // JSP Style Preferences
    // $NON-NLS-1$
    String NOBACKGROUNDBOLD = " | null | false";
    // $NON-NLS-1$
    String JUSTITALIC = " | null | false | true";
    String styleValue = ColorHelper.findRGBString(registry, IStyleConstantsXML.TAG_ATTRIBUTE_NAME, 127, 0, 127) + NOBACKGROUNDBOLD;
    store.setDefault(IStyleConstantsXML.TAG_ATTRIBUTE_NAME, styleValue);
    styleValue = ColorHelper.findRGBString(registry, IStyleConstantsXML.TAG_ATTRIBUTE_VALUE, 42, 0, 255) + JUSTITALIC;
    store.setDefault(IStyleConstantsXML.TAG_ATTRIBUTE_VALUE, styleValue);
    // $NON-NLS-1$
    styleValue = "null" + NOBACKGROUNDBOLD;
    // specified value is black; leaving as widget default
    store.setDefault(IStyleConstantsXML.TAG_ATTRIBUTE_EQUALS, styleValue);
    styleValue = ColorHelper.findRGBString(registry, IStyleConstantsXML.COMMENT_BORDER, 63, 95, 191) + NOBACKGROUNDBOLD;
    store.setDefault(IStyleConstantsXML.COMMENT_BORDER, styleValue);
    styleValue = ColorHelper.findRGBString(registry, IStyleConstantsXML.COMMENT_TEXT, 63, 95, 191) + NOBACKGROUNDBOLD;
    store.setDefault(IStyleConstantsXML.COMMENT_TEXT, styleValue);
    styleValue = ColorHelper.findRGBString(registry, IStyleConstantsXML.TAG_BORDER, 0, 128, 128) + NOBACKGROUNDBOLD;
    store.setDefault(IStyleConstantsXML.TAG_BORDER, styleValue);
    styleValue = ColorHelper.findRGBString(registry, IStyleConstantsXML.TAG_NAME, 63, 127, 127) + NOBACKGROUNDBOLD;
    store.setDefault(IStyleConstantsXML.TAG_NAME, styleValue);
    styleValue = ColorHelper.findRGBString(registry, IStyleConstantsHTML.SCRIPT_AREA_BORDER, 191, 95, 63) + NOBACKGROUNDBOLD;
    store.setDefault(IStyleConstantsHTML.SCRIPT_AREA_BORDER, styleValue);
    // $NON-NLS-1$
    styleValue = "null" + NOBACKGROUNDBOLD;
    store.setDefault(IStyleConstantsJSP.JSP_CONTENT, styleValue);
    // set default new jsp 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(JSPUIPreferenceNames.NEW_FILE_TEMPLATE_ID, "org.eclipse.jst.jsp.ui.templates.jsphtml");
    // set default new jsp tag file template to use in new tag file wizard
    // $NON-NLS-1$
    store.setDefault(JSPUIPreferenceNames.NEW_TAG_FILE_TEMPLATE_ID, "org.eclipse.jst.jsp.ui.templates.simpletag");
    store.setDefault(JSPUIPreferenceNames.TYPING_COMPLETE_EL_BRACES, true);
    store.setDefault(JSPUIPreferenceNames.TYPING_COMPLETE_SCRIPTLETS, true);
    store.setDefault(JSPUIPreferenceNames.TYPING_COMPLETE_COMMENTS, true);
    store.setDefault(JSPUIPreferenceNames.SUPPLY_JSP_SEARCH_RESULTS_TO_JAVA_SEARCH, true);
    store.setDefault(JSPUIPreferenceNames.TYPING_CLOSE_STRINGS, true);
    store.setDefault(JSPUIPreferenceNames.TYPING_CLOSE_BRACKETS, true);
    // Defaults for Content Assist preference page
    store.setDefault(JSPUIPreferenceNames.CONTENT_ASSIST_DO_NOT_DISPLAY_ON_DEFAULT_PAGE, "");
    store.setDefault(JSPUIPreferenceNames.CONTENT_ASSIST_DO_NOT_DISPLAY_ON_OWN_PAGE, "");
    store.setDefault(JSPUIPreferenceNames.CONTENT_ASSIST_DEFAULT_PAGE_SORT_ORDER, "org.eclipse.wst.html.ui.proposalCategory.htmlTags\0" + "org.eclipse.wst.xml.ui.proposalCategory.xmlTags\0" + "org.eclipse.wst.css.ui.proposalCategory.css\0" + "org.eclipse.jst.jsp.ui.proposalCategory.jsp\0" + "org.eclipse.jst.jsp.ui.proposalCategory.jspJava\0" + "org.eclipse.jst.jsp.ui.proposalCategory.jspTemplates\0" + "org.eclipse.wst.html.ui.proposalCategory.htmlTemplates\0" + "org.eclipse.wst.xml.ui.proposalCategory.xmlTemplates\0" + "org.eclipse.wst.css.ui.proposalCategory.cssTemplates");
    store.setDefault(JSPUIPreferenceNames.CONTENT_ASSIST_OWN_PAGE_SORT_ORDER, "org.eclipse.jst.jsp.ui.proposalCategory.jspTemplates\0" + "org.eclipse.wst.html.ui.proposalCategory.htmlTemplates\0" + "org.eclipse.wst.xml.ui.proposalCategory.xmlTemplates\0" + "org.eclipse.wst.css.ui.proposalCategory.cssTemplates\0" + "org.eclipse.wst.html.ui.proposalCategory.htmlTags\0" + "org.eclipse.wst.xml.ui.proposalCategory.xmlTags\0" + "org.eclipse.jst.jsp.ui.proposalCategory.jsp\0" + "org.eclipse.jst.jsp.ui.proposalCategory.jspJava\0" + "org.eclipse.wst.css.ui.proposalCategory.css");
    store.setDefault(JSPUIPreferenceNames.AUTO_IMPORT_INSERT, true);
    store.setDefault(JSPUIPreferenceNames.INSERT_SINGLE_SUGGESTION, true);
    store.setDefault(JSPUIPreferenceNames.USE_HTML_FORMATTER, true);
}
Also used : ColorRegistry(org.eclipse.jface.resource.ColorRegistry) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore)

Example 17 with ColorRegistry

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

the class DTDUIPreferenceInitializer method initializeDefaultPreferences.

/*
	 * (non-Javadoc)
	 * 
	 * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
	 */
public void initializeDefaultPreferences() {
    IPreferenceStore store = DTDUIPlugin.getDefault().getPreferenceStore();
    ColorRegistry registry = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getColorRegistry();
    // DTD Style Preferences
    // $NON-NLS-1$
    String NOBACKGROUNDBOLD = " | null | false";
    // $NON-NLS-1$
    String JUSTITALIC = " | null | false | true";
    String styleValue = ColorHelper.findRGBString(registry, IStyleConstantsDTD.DTD_DEFAULT, 0, 0, 0) + NOBACKGROUNDBOLD;
    // black
    store.setDefault(IStyleConstantsDTD.DTD_DEFAULT, styleValue);
    styleValue = ColorHelper.findRGBString(registry, IStyleConstantsDTD.DTD_TAG, 63, 63, 191) + NOBACKGROUNDBOLD;
    // blue
    store.setDefault(IStyleConstantsDTD.DTD_TAG, styleValue);
    styleValue = ColorHelper.findRGBString(registry, IStyleConstantsDTD.DTD_TAGNAME, 63, 63, 191) + NOBACKGROUNDBOLD;
    // blue
    store.setDefault(IStyleConstantsDTD.DTD_TAGNAME, styleValue);
    styleValue = ColorHelper.findRGBString(registry, IStyleConstantsDTD.DTD_COMMENT, 127, 127, 127) + NOBACKGROUNDBOLD;
    // grey
    store.setDefault(IStyleConstantsDTD.DTD_COMMENT, styleValue);
    styleValue = ColorHelper.findRGBString(registry, IStyleConstantsDTD.DTD_KEYWORD, 128, 0, 0) + NOBACKGROUNDBOLD;
    // dark
    store.setDefault(IStyleConstantsDTD.DTD_KEYWORD, styleValue);
    // red
    styleValue = ColorHelper.findRGBString(registry, IStyleConstantsDTD.DTD_STRING, 63, 159, 95) + JUSTITALIC;
    // green
    store.setDefault(IStyleConstantsDTD.DTD_STRING, styleValue);
    styleValue = ColorHelper.findRGBString(registry, IStyleConstantsDTD.DTD_DATA, 191, 95, 95) + NOBACKGROUNDBOLD;
    // light
    store.setDefault(IStyleConstantsDTD.DTD_DATA, styleValue);
    // red
    styleValue = ColorHelper.findRGBString(registry, IStyleConstantsDTD.DTD_SYMBOL, 128, 0, 0) + NOBACKGROUNDBOLD;
    // dark
    store.setDefault(IStyleConstantsDTD.DTD_SYMBOL, styleValue);
    // red
    // set default new xml file template to use in new file wizard
    /*
		 * Need to find template name that goes with default template id (name
		 * may change for differnt language)
		 */
    // $NON-NLS-1$
    String templateName = "";
    // $NON-NLS-1$
    Template template = DTDUIPlugin.getDefault().getTemplateStore().findTemplateById("org.eclipse.wst.dtd.ui.internal.templates.xmldeclaration");
    if (template != null)
        templateName = template.getName();
    store.setDefault(DTDUIPreferenceNames.NEW_FILE_TEMPLATE_NAME, templateName);
    store.setDefault(DTDUIPreferenceNames.ACTIVATE_PROPERTIES, true);
}
Also used : ColorRegistry(org.eclipse.jface.resource.ColorRegistry) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore) Template(org.eclipse.jface.text.templates.Template)

Example 18 with ColorRegistry

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

the class XMLUIPreferenceInitializer method initializeDefaultPreferences.

/*
	 * (non-Javadoc)
	 * 
	 * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
	 */
public void initializeDefaultPreferences() {
    IPreferenceStore store = XMLUIPlugin.getDefault().getPreferenceStore();
    ColorRegistry registry = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getColorRegistry();
    store.setDefault(XMLUIPreferenceNames.INSERT_SINGLE_SUGGESTION, true);
    store.setDefault(XMLUIPreferenceNames.AUTO_PROPOSE, true);
    // $NON-NLS-1$
    store.setDefault(XMLUIPreferenceNames.AUTO_PROPOSE_CODE, "<=:");
    store.setDefault(XMLUIPreferenceNames.AUTO_PROPOSE_DELAY, 500);
    // https://bugs.eclipse.org/bugs/show_bug.cgi?id=140946
    store.setDefault(XMLUIPreferenceNames.SUGGESTION_STRATEGY, XMLUIPreferenceNames.SUGGESTION_STRATEGY_VALUE_STRICT);
    store.setDefault(XMLUIPreferenceNames.USE_INFERRED_GRAMMAR, true);
    // XML Style Preferences
    // $NON-NLS-1$
    String NOBACKGROUNDBOLD = " | null | false";
    // $NON-NLS-1$
    String JUSTITALIC = " | null | false | true";
    String styleValue = ColorHelper.findRGBString(registry, IStyleConstantsXML.TAG_ATTRIBUTE_NAME, 127, 0, 127) + NOBACKGROUNDBOLD;
    store.setDefault(IStyleConstantsXML.TAG_ATTRIBUTE_NAME, styleValue);
    styleValue = ColorHelper.findRGBString(registry, IStyleConstantsXML.TAG_ATTRIBUTE_VALUE, 42, 0, 255) + JUSTITALIC;
    store.setDefault(IStyleConstantsXML.TAG_ATTRIBUTE_VALUE, styleValue);
    // $NON-NLS-1$
    styleValue = "null" + NOBACKGROUNDBOLD;
    // specified
    store.setDefault(IStyleConstantsXML.TAG_ATTRIBUTE_EQUALS, styleValue);
    // value is black; leaving as widget default
    styleValue = ColorHelper.findRGBString(registry, IStyleConstantsXML.COMMENT_BORDER, 63, 95, 191) + NOBACKGROUNDBOLD;
    store.setDefault(IStyleConstantsXML.COMMENT_BORDER, styleValue);
    styleValue = ColorHelper.findRGBString(registry, IStyleConstantsXML.COMMENT_TEXT, 63, 95, 191) + NOBACKGROUNDBOLD;
    store.setDefault(IStyleConstantsXML.COMMENT_TEXT, styleValue);
    styleValue = ColorHelper.findRGBString(registry, IStyleConstantsXML.DECL_BORDER, 0, 128, 128) + NOBACKGROUNDBOLD;
    store.setDefault(IStyleConstantsXML.DECL_BORDER, styleValue);
    styleValue = ColorHelper.findRGBString(registry, IStyleConstantsXML.DOCTYPE_NAME, 0, 0, 128) + NOBACKGROUNDBOLD;
    store.setDefault(IStyleConstantsXML.DOCTYPE_NAME, styleValue);
    styleValue = ColorHelper.findRGBString(registry, IStyleConstantsXML.DOCTYPE_EXTERNAL_ID_PUBREF, 0, 0, 128) + NOBACKGROUNDBOLD;
    store.setDefault(IStyleConstantsXML.DOCTYPE_EXTERNAL_ID_PUBREF, styleValue);
    styleValue = ColorHelper.findRGBString(registry, IStyleConstantsXML.DOCTYPE_EXTERNAL_ID, 128, 128, 128) + NOBACKGROUNDBOLD;
    store.setDefault(IStyleConstantsXML.DOCTYPE_EXTERNAL_ID, styleValue);
    styleValue = ColorHelper.findRGBString(registry, IStyleConstantsXML.DOCTYPE_EXTERNAL_ID_SYSREF, 63, 127, 95) + NOBACKGROUNDBOLD;
    store.setDefault(IStyleConstantsXML.DOCTYPE_EXTERNAL_ID_SYSREF, styleValue);
    // $NON-NLS-1$
    styleValue = "null" + NOBACKGROUNDBOLD;
    // specified
    store.setDefault(IStyleConstantsXML.XML_CONTENT, styleValue);
    // value is black; leaving as widget default
    styleValue = ColorHelper.findRGBString(registry, IStyleConstantsXML.TAG_BORDER, 0, 128, 128) + NOBACKGROUNDBOLD;
    store.setDefault(IStyleConstantsXML.TAG_BORDER, styleValue);
    styleValue = ColorHelper.findRGBString(registry, IStyleConstantsXML.TAG_NAME, 63, 127, 127) + NOBACKGROUNDBOLD;
    store.setDefault(IStyleConstantsXML.TAG_NAME, styleValue);
    styleValue = ColorHelper.findRGBString(registry, IStyleConstantsXML.PI_BORDER, 0, 128, 128) + NOBACKGROUNDBOLD;
    store.setDefault(IStyleConstantsXML.PI_BORDER, styleValue);
    // $NON-NLS-1$
    styleValue = "null" + NOBACKGROUNDBOLD;
    // specified
    store.setDefault(IStyleConstantsXML.PI_CONTENT, styleValue);
    // value is black; leaving as widget default
    styleValue = ColorHelper.findRGBString(registry, IStyleConstantsXML.CDATA_BORDER, 0, 128, 128) + NOBACKGROUNDBOLD;
    store.setDefault(IStyleConstantsXML.CDATA_BORDER, styleValue);
    styleValue = ColorHelper.findRGBString(registry, IStyleConstantsXML.CDATA_TEXT, 0, 0, 0) + NOBACKGROUNDBOLD;
    store.setDefault(IStyleConstantsXML.CDATA_TEXT, styleValue);
    styleValue = ColorHelper.findRGBString(registry, IStyleConstantsXML.ENTITY_REFERENCE, 42, 0, 255) + NOBACKGROUNDBOLD;
    store.setDefault(IStyleConstantsXML.ENTITY_REFERENCE, styleValue);
    // set default new xml 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(XMLUIPreferenceNames.NEW_FILE_TEMPLATE_ID, "org.eclipse.wst.xml.ui.internal.templates.xmldeclaration");
    // Defaults for the Typing preference page
    store.setDefault(XMLUIPreferenceNames.TYPING_COMPLETE_COMMENTS, true);
    store.setDefault(XMLUIPreferenceNames.TYPING_COMPLETE_END_TAGS, true);
    store.setDefault(XMLUIPreferenceNames.TYPING_COMPLETE_ELEMENTS, true);
    store.setDefault(XMLUIPreferenceNames.TYPING_REMOVE_END_TAGS, true);
    store.setDefault(XMLUIPreferenceNames.TYPING_CLOSE_STRINGS, true);
    store.setDefault(XMLUIPreferenceNames.TYPING_CLOSE_BRACKETS, true);
    // Defaults for Content Assist preference page
    store.setDefault(XMLUIPreferenceNames.CONTENT_ASSIST_DO_NOT_DISPLAY_ON_DEFAULT_PAGE, "");
    store.setDefault(XMLUIPreferenceNames.CONTENT_ASSIST_DO_NOT_DISPLAY_ON_OWN_PAGE, "");
    store.setDefault(XMLUIPreferenceNames.CONTENT_ASSIST_DEFAULT_PAGE_SORT_ORDER, "org.eclipse.wst.xml.ui.proposalCategory.xmlTags\0" + "org.eclipse.wst.xml.ui.proposalCategory.xmlTemplates");
    store.setDefault(XMLUIPreferenceNames.CONTENT_ASSIST_OWN_PAGE_SORT_ORDER, "org.eclipse.wst.xml.ui.proposalCategory.xmlTemplates\0" + "org.eclipse.wst.xml.ui.proposalCategory.xmlTags");
}
Also used : ColorRegistry(org.eclipse.jface.resource.ColorRegistry) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore)

Example 19 with ColorRegistry

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

the class BoldStyler method applyStyles.

@Override
public void applyStyles(TextStyle textStyle) {
    ColorRegistry colorRegistry = JFaceResources.getColorRegistry();
    Font font = JFaceResources.getFontRegistry().getBold(fontName);
    if (fForegroundColorName != null) {
        textStyle.foreground = colorRegistry.get(fForegroundColorName);
    }
    if (fBackgroundColorName != null) {
        textStyle.background = colorRegistry.get(fBackgroundColorName);
    }
    textStyle.font = font;
}
Also used : ColorRegistry(org.eclipse.jface.resource.ColorRegistry) Font(org.eclipse.swt.graphics.Font)

Example 20 with ColorRegistry

use of org.eclipse.jface.resource.ColorRegistry in project dbeaver by serge-rider.

the class EntityFigure method refreshColors.

public void refreshColors() {
    ColorRegistry colorRegistry = UIUtils.getColorRegistry();
    setForegroundColor(colorRegistry.get(ERDUIConstants.COLOR_ERD_ENTITY_NAME_FOREGROUND));
    if (part.getEntity().isPrimary()) {
        setBackgroundColor(colorRegistry.get(ERDUIConstants.COLOR_ERD_ENTITY_PRIMARY_BACKGROUND));
    } else if (part.getEntity().getObject().getEntityType() == DBSEntityType.ASSOCIATION) {
        setBackgroundColor(colorRegistry.get(ERDUIConstants.COLOR_ERD_ENTITY_ASSOCIATION_BACKGROUND));
    } else {
        boolean changeHeaderColors = ERDUIActivator.getDefault().getPreferenceStore().getBoolean(ERDUIConstants.PREF_DIAGRAM_CHANGE_HEADER_COLORS);
        if (changeHeaderColors) {
            changeHeaderColor(colorRegistry);
        } else {
            setBackgroundColor(colorRegistry.get(ERDUIConstants.COLOR_ERD_ENTITY_REGULAR_BACKGROUND));
        }
    }
}
Also used : ColorRegistry(org.eclipse.jface.resource.ColorRegistry)

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