Search in sources :

Example 41 with ColorRegistry

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

the class SpreadsheetPresentation method applyThemeSettings.

// /////////////////////////////////////////////
// Themes
@Override
protected void applyThemeSettings(ITheme currentTheme) {
    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.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 : ColorRegistry(org.eclipse.jface.resource.ColorRegistry)

Example 42 with ColorRegistry

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

the class ResultSetLabelProviderDefault method applyThemeSettings.

protected void applyThemeSettings(ITheme currentTheme) {
    this.colorizeDataTypes = viewer.getPreferenceStore().getBoolean(ResultSetPreferences.RESULT_SET_COLORIZE_DATA_TYPES);
    final ColorRegistry colorRegistry = currentTheme.getColorRegistry();
    this.foregroundNull = colorRegistry.get(ThemeConstants.COLOR_SQL_RESULT_NULL_FOREGROUND);
    this.backgroundError = colorRegistry.get(ThemeConstants.COLOR_SQL_RESULT_CELL_ERROR_BACK);
    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));
}
Also used : ColorRegistry(org.eclipse.jface.resource.ColorRegistry)

Example 43 with ColorRegistry

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

the class JSONScanner method initScanner.

private void initScanner() {
    ColorRegistry colorRegistry = UIUtils.getColorRegistry();
    Color colorKey = colorRegistry.get(SQLConstants.CONFIG_COLOR_KEYWORD);
    Color colorString = colorRegistry.get(SQLConstants.CONFIG_COLOR_STRING);
    Color colorValue = colorRegistry.get(SQLConstants.CONFIG_COLOR_NUMBER);
    IToken string = new Token(new TextAttribute(colorString));
    IToken value = new Token(new TextAttribute(colorValue));
    IToken defaultText = new Token(new TextAttribute(colorKey));
    // IToken nullValue = new Token(new TextAttribute(colorKey));
    List<IRule> rules = new LinkedList<>();
    rules.add(new NumberRule(value));
    // rules.add(new MultiLineRule(":\"", "\"", value, '\\'));  //$NON-NLS-1$//$NON-NLS-2$
    // rules.add(new MultiLineRule(": \"", "\"", value, '\\'));  //$NON-NLS-1$//$NON-NLS-2$
    // $NON-NLS-2$ //$NON-NLS-1$
    rules.add(new MultiLineRule("\"", "\"", string, '\\'));
    WordRule wordRule = new WordRule(new WordDetector(), defaultText);
    wordRule.addWord("null", value);
    wordRule.addWord("true", value);
    wordRule.addWord("false", value);
    rules.add(wordRule);
    rules.add(new WhitespaceRule(new WhitespaceDetector()));
    setRules(rules.toArray(new IRule[0]));
}
Also used : TextAttribute(org.eclipse.jface.text.TextAttribute) Color(org.eclipse.swt.graphics.Color) LinkedList(java.util.LinkedList) ColorRegistry(org.eclipse.jface.resource.ColorRegistry)

Example 44 with ColorRegistry

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

the class SQLScriptStatusDialog method endObjectProcessing.

@Override
public void endObjectProcessing(@NotNull T object, Exception error) {
    UIUtils.packColumns(objectTree, false, null);
    TreeItem treeItem = getTreeItem(object);
    if (treeItem != null) {
        treeItem.setText(1, error == null ? "Done" : error.getMessage());
        if (error != null) {
            ColorRegistry colorRegistry = UIUtils.getActiveWorkbenchWindow().getWorkbench().getThemeManager().getCurrentTheme().getColorRegistry();
            Color colorError = colorRegistry.get(QueryLogViewer.COLOR_REVERTED);
            treeItem.setForeground(1, colorError);
        }
    }
}
Also used : ColorRegistry(org.eclipse.jface.resource.ColorRegistry) Color(org.eclipse.swt.graphics.Color)

Example 45 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(ERDUIConstants.COLOR_ERD_ATTR_FOREGROUND));
        figure.setBackgroundColor(colorRegistry.get(ERDUIConstants.COLOR_ERD_ATTR_BACKGROUND));
        IFigure attrExtra = createRightPanel();
        AttributeItemFigure attributeItemFigure = (AttributeItemFigure) figure;
        attributeItemFigure.setRightPanel(attrExtra);
        if (attributeItemFigure.getAttribute().isInPrimaryKey()) {
            keyFigure.add(figure, new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING, GridData.VERTICAL_ALIGN_BEGINNING, true, false));
            keyFigure.add(attrExtra, new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.VERTICAL_ALIGN_BEGINNING));
        } else {
            attributeFigure.add(figure, new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING, GridData.VERTICAL_ALIGN_BEGINNING, true, false));
            attributeFigure.add(attrExtra, new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.VERTICAL_ALIGN_BEGINNING));
        }
    } else {
        super.add(figure, constraint, index);
    }
}
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