Search in sources :

Example 31 with ColorRegistry

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

the class EntityFigure method add.

@Override
public void add(IFigure figure, Object constraint, int index) {
    if (figure instanceof AttributeItemFigure) {
        ColorRegistry colorRegistry = UIUtils.getColorRegistry();
        figure.setForegroundColor(colorRegistry.get(ERDConstants.COLOR_ERD_ATTR_FOREGROUND));
        figure.setBackgroundColor(colorRegistry.get(ERDConstants.COLOR_ERD_ATTR_BACKGROUND));
        if (((AttributeItemFigure) figure).getAttribute().isInPrimaryKey()) {
            keyFigure.add(figure, constraint, -1);
        } else {
            attributeFigure.add(figure, constraint, -1);
        }
    } else {
        super.add(figure, constraint, index);
    }
}
Also used : ColorRegistry(org.eclipse.jface.resource.ColorRegistry)

Example 32 with ColorRegistry

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

the class SpreadsheetPresentation method applyThemeSettings.

// /////////////////////////////////////////////
// Themes
@Override
protected void applyThemeSettings() {
    ITheme currentTheme = themeManager.getCurrentTheme();
    Font rsFont = currentTheme.getFontRegistry().get(ThemeConstants.FONT_SQL_RESULT_SET);
    if (rsFont != null) {
        this.spreadsheet.setFont(rsFont);
    }
    final ColorRegistry colorRegistry = currentTheme.getColorRegistry();
    Color previewBack = colorRegistry.get(ThemeConstants.COLOR_SQL_RESULT_SET_PREVIEW_BACK);
    if (previewBack != null) {
    // this.previewPane.getViewPlaceholder().setBackground(previewBack);
    // for (Control control : this.previewPane.getViewPlaceholder().getChildren()) {
    // control.setBackground(previewBack);
    // }
    }
    // this.foregroundDefault = currentTheme.getColorRegistry().get(ThemeConstants.COLOR_SQL_RESULT_CELL_FORE);
    this.backgroundAdded = colorRegistry.get(ThemeConstants.COLOR_SQL_RESULT_CELL_NEW_BACK);
    this.backgroundDeleted = colorRegistry.get(ThemeConstants.COLOR_SQL_RESULT_CELL_DELETED_BACK);
    this.backgroundModified = colorRegistry.get(ThemeConstants.COLOR_SQL_RESULT_CELL_MODIFIED_BACK);
    this.backgroundOdd = colorRegistry.get(ThemeConstants.COLOR_SQL_RESULT_CELL_ODD_BACK);
    this.backgroundReadOnly = colorRegistry.get(ThemeConstants.COLOR_SQL_RESULT_CELL_READ_ONLY);
    this.foregroundSelected = colorRegistry.get(ThemeConstants.COLOR_SQL_RESULT_SET_SELECTION_FORE);
    this.backgroundSelected = colorRegistry.get(ThemeConstants.COLOR_SQL_RESULT_SET_SELECTION_BACK);
    this.backgroundMatched = colorRegistry.get(ThemeConstants.COLOR_SQL_RESULT_CELL_MATCHED);
    this.cellHeaderForeground = colorRegistry.get(ThemeConstants.COLOR_SQL_RESULT_HEADER_FOREGROUND);
    this.cellHeaderBackground = colorRegistry.get(ThemeConstants.COLOR_SQL_RESULT_HEADER_BACKGROUND);
    {
        if (this.cellHeaderSelectionBackground != null) {
            UIUtils.dispose(this.cellHeaderSelectionBackground);
            this.cellHeaderSelectionBackground = null;
        }
        Color headerSelectionBackground = colorRegistry.get(ThemeConstants.COLOR_SQL_RESULT_HEADER_SELECTED_BACKGROUND);
        RGB cellSel = UIUtils.blend(headerSelectionBackground.getRGB(), new RGB(255, 255, 255), 50);
        this.cellHeaderSelectionBackground = new Color(getSpreadsheet().getDisplay(), cellSel);
    }
    this.foregroundNull = colorRegistry.get(ThemeConstants.COLOR_SQL_RESULT_NULL_FOREGROUND);
    this.dataTypesForegrounds.put(DBPDataKind.BINARY, colorRegistry.get(ThemeConstants.COLOR_SQL_RESULT_BINARY_FOREGROUND));
    this.dataTypesForegrounds.put(DBPDataKind.BOOLEAN, colorRegistry.get(ThemeConstants.COLOR_SQL_RESULT_BOOLEAN_FOREGROUND));
    this.dataTypesForegrounds.put(DBPDataKind.DATETIME, colorRegistry.get(ThemeConstants.COLOR_SQL_RESULT_DATETIME_FOREGROUND));
    this.dataTypesForegrounds.put(DBPDataKind.NUMERIC, colorRegistry.get(ThemeConstants.COLOR_SQL_RESULT_NUMERIC_FOREGROUND));
    this.dataTypesForegrounds.put(DBPDataKind.STRING, colorRegistry.get(ThemeConstants.COLOR_SQL_RESULT_STRING_FOREGROUND));
    this.spreadsheet.setLineColor(colorRegistry.get(ThemeConstants.COLOR_SQL_RESULT_LINES_NORMAL));
    this.spreadsheet.setLineSelectedColor(colorRegistry.get(ThemeConstants.COLOR_SQL_RESULT_LINES_SELECTED));
    this.spreadsheet.recalculateSizes();
}
Also used : ITheme(org.eclipse.ui.themes.ITheme) ColorRegistry(org.eclipse.jface.resource.ColorRegistry)

Example 33 with ColorRegistry

use of org.eclipse.jface.resource.ColorRegistry in project eclipse.platform.text by eclipse.

the class CompletionProposalPopup2 method createProposalSelector.

/**
 * Creates the proposal selector.
 */
private void createProposalSelector() {
    if (Helper2.okToUse(fProposalShell))
        return;
    Control control = fViewer.getTextWidget();
    fProposalShell = new Shell(control.getShell(), SWT.ON_TOP);
    // fProposalShell= new Shell(control.getShell(), SWT.ON_TOP | SWT.RESIZE );
    fProposalTable = new Table(fProposalShell, SWT.H_SCROLL | SWT.V_SCROLL);
    // fProposalTable= new Table(fProposalShell, SWT.H_SCROLL | SWT.V_SCROLL);
    fIsColoredLabelsSupportEnabled = fContentAssistant.isColoredLabelsSupportEnabled();
    if (fIsColoredLabelsSupportEnabled)
        TableOwnerDrawSupport.install(fProposalTable);
    fProposalTable.setLocation(0, 0);
    if (fAdditionalInfoController != null)
        fAdditionalInfoController.setSizeConstraints(50, 10, true, false);
    GridLayout layout = new GridLayout();
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    fProposalShell.setLayout(layout);
    GridData data = new GridData(GridData.FILL_BOTH);
    fProposalTable.setLayoutData(data);
    fProposalShell.pack();
    // set location
    Point currentLocation = fProposalShell.getLocation();
    Point newLocation = getLocation();
    if ((newLocation.x < currentLocation.x && newLocation.y == currentLocation.y) || newLocation.y < currentLocation.y)
        fProposalShell.setLocation(newLocation);
    if (fAdditionalInfoController != null) {
        fProposalShell.addControlListener(new ControlListener() {

            @Override
            public void controlMoved(ControlEvent e) {
            }

            @Override
            public void controlResized(ControlEvent e) {
                // resets the cached resize constraints
                fAdditionalInfoController.setSizeConstraints(50, 10, true, false);
            }
        });
    }
    ColorRegistry colorRegistry = JFaceResources.getColorRegistry();
    Color background = colorRegistry.get(JFacePreferences.CONTENT_ASSIST_BACKGROUND_COLOR);
    if (background == null) {
        background = JFaceColors.getInformationViewerBackgroundColor(Display.getDefault());
    }
    Color foreground = colorRegistry.get(JFacePreferences.CONTENT_ASSIST_FOREGROUND_COLOR);
    if (foreground == null) {
        foreground = JFaceColors.getInformationViewerBackgroundColor(Display.getDefault());
    }
    fProposalShell.setBackground(background);
    fProposalTable.setBackground(background);
    fProposalTable.setForeground(foreground);
    fProposalTable.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
            selectProposalWithMask(e.stateMask);
        }
    });
    fPopupCloser.install(fContentAssistant, fProposalTable);
    fProposalShell.addDisposeListener(new DisposeListener() {

        @Override
        public void widgetDisposed(DisposeEvent e) {
            // but don't dispose the shell, since we're being called from its disposal event!
            unregister();
        }
    });
    fProposalTable.setHeaderVisible(false);
    fContentAssistant.addToLayout(this, fProposalShell, ContentAssistant2.LayoutManager.LAYOUT_PROPOSAL_SELECTOR, fContentAssistant.getSelectionOffset());
}
Also used : DisposeListener(org.eclipse.swt.events.DisposeListener) Table(org.eclipse.swt.widgets.Table) Color(org.eclipse.swt.graphics.Color) Point(org.eclipse.swt.graphics.Point) DisposeEvent(org.eclipse.swt.events.DisposeEvent) Control(org.eclipse.swt.widgets.Control) Shell(org.eclipse.swt.widgets.Shell) GridLayout(org.eclipse.swt.layout.GridLayout) ColorRegistry(org.eclipse.jface.resource.ColorRegistry) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ControlListener(org.eclipse.swt.events.ControlListener) ControlEvent(org.eclipse.swt.events.ControlEvent) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 34 with ColorRegistry

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

the class JSONUIPreferenceInitializer method initializeDefaultPreferences.

/*
	 * (non-Javadoc)
	 *
	 * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#
	 * initializeDefaultPreferences()
	 */
@Override
public void initializeDefaultPreferences() {
    IPreferenceStore store = JSONUIPlugin.getDefault().getPreferenceStore();
    ColorRegistry registry = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getColorRegistry();
    // JSON Style Preferences
    // $NON-NLS-1$
    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;
    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);
}
Also used : ColorRegistry(org.eclipse.jface.resource.ColorRegistry) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore)

Example 35 with ColorRegistry

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

the class HTMLUIPreferenceInitializer method initializeDefaultPreferences.

/*
	 * (non-Javadoc)
	 * 
	 * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
	 */
public void initializeDefaultPreferences() {
    IPreferenceStore store = HTMLUIPlugin.getDefault().getPreferenceStore();
    ColorRegistry registry = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getColorRegistry();
    store.setDefault(HTMLUIPreferenceNames.AUTO_PROPOSE, true);
    // $NON-NLS-1$
    store.setDefault(HTMLUIPreferenceNames.AUTO_PROPOSE_CODE, "<=");
    store.setDefault(HTMLUIPreferenceNames.AUTO_PROPOSE_DELAY, 500);
    store.setDefault(HTMLUIPreferenceNames.INSERT_SINGLE_SUGGESTION, true);
    // HTML 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.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 value is black; leaving as widget default
    store.setDefault(IStyleConstantsXML.XML_CONTENT, 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, IStyleConstantsXML.PI_BORDER, 0, 128, 128) + NOBACKGROUNDBOLD;
    store.setDefault(IStyleConstantsXML.PI_BORDER, styleValue);
    // $NON-NLS-1$
    styleValue = "null" + NOBACKGROUNDBOLD;
    // specified value is black; leaving as widget default
    store.setDefault(IStyleConstantsXML.PI_CONTENT, styleValue);
    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, IStyleConstantsHTML.SCRIPT_AREA_BORDER, 191, 95, 63) + NOBACKGROUNDBOLD;
    store.setDefault(IStyleConstantsHTML.SCRIPT_AREA_BORDER, styleValue);
    styleValue = ColorHelper.findRGBString(registry, IStyleConstantsXML.ENTITY_REFERENCE, 42, 0, 255) + NOBACKGROUNDBOLD;
    store.setDefault(IStyleConstantsXML.ENTITY_REFERENCE, styleValue);
    // set default new html 5 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(HTMLUIPreferenceNames.NEW_FILE_TEMPLATE_ID, "org.eclipse.wst.html.ui.templates.html5");
    // Defaults for the Typing preference page
    store.setDefault(HTMLUIPreferenceNames.TYPING_COMPLETE_COMMENTS, true);
    store.setDefault(HTMLUIPreferenceNames.TYPING_COMPLETE_END_TAGS, true);
    store.setDefault(HTMLUIPreferenceNames.TYPING_COMPLETE_ELEMENTS, true);
    store.setDefault(HTMLUIPreferenceNames.TYPING_REMOVE_END_TAGS, true);
    store.setDefault(HTMLUIPreferenceNames.TYPING_CLOSE_STRINGS, true);
    store.setDefault(HTMLUIPreferenceNames.TYPING_CLOSE_BRACKETS, true);
    // Defaults for Content Assist preference page
    store.setDefault(HTMLUIPreferenceNames.CONTENT_ASSIST_DO_NOT_DISPLAY_ON_DEFAULT_PAGE, "");
    store.setDefault(HTMLUIPreferenceNames.CONTENT_ASSIST_DO_NOT_DISPLAY_ON_OWN_PAGE, "");
    store.setDefault(HTMLUIPreferenceNames.CONTENT_ASSIST_DEFAULT_PAGE_SORT_ORDER, "org.eclipse.wst.html.ui.proposalCategory.htmlTags\0" + "org.eclipse.wst.css.ui.proposalCategory.css\0" + "org.eclipse.wst.html.ui.proposalCategory.htmlTemplates\0" + "org.eclipse.wst.css.ui.proposalCategory.cssTemplates");
    store.setDefault(HTMLUIPreferenceNames.CONTENT_ASSIST_OWN_PAGE_SORT_ORDER, "org.eclipse.wst.html.ui.proposalCategory.htmlTemplates\0" + "org.eclipse.wst.css.ui.proposalCategory.cssTemplates\0" + "org.eclipse.wst.html.ui.proposalCategory.htmlTags\0" + "org.eclipse.wst.css.ui.proposalCategory.css");
}
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