Search in sources :

Example 21 with ColorRegistry

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

the class BaseChartDrawingSupplier method getChartColorsDefinitions.

private static Paint[] getChartColorsDefinitions() {
    ColorRegistry colorRegistry = UIUtils.getActiveWorkbenchWindow().getWorkbench().getThemeManager().getCurrentTheme().getColorRegistry();
    List<Paint> result = new ArrayList<>();
    for (int i = 1; ; i++) {
        Color swtColor = colorRegistry.get(COLOR_PREF_ID_PREFIX + i);
        if (swtColor == null) {
            break;
        }
        result.add(new java.awt.Color(swtColor.getRed(), swtColor.getGreen(), swtColor.getBlue()));
    }
    if (result.isEmpty()) {
        // Something went wrong - no color constants
        log.warn("Chart colors configuration not found");
        Collections.addAll(result, BaseChartConstants.DBEAVER_DEFAULT_COLOR_SERIES);
    }
    return result.toArray(new Paint[0]);
}
Also used : ColorRegistry(org.eclipse.jface.resource.ColorRegistry) Color(org.eclipse.swt.graphics.Color) ArrayList(java.util.ArrayList) java.awt(java.awt)

Example 22 with ColorRegistry

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

the class JSONSourceViewerConfiguration method getPresentationReconciler.

@Override
public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {
    ColorRegistry colorRegistry = UIUtils.getColorRegistry();
    PresentationReconciler reconciler = new PresentationReconciler();
    reconciler.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));
    DefaultDamagerRepairer dr = new DefaultDamagerRepairer(jsonScanner);
    reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
    reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);
    NonRuleBasedDamagerRepairer ndr = new NonRuleBasedDamagerRepairer(new TextAttribute(colorRegistry.get(SQLConstants.CONFIG_COLOR_STRING)));
    reconciler.setDamager(ndr, JSONPartitionScanner.JSON_STRING);
    reconciler.setRepairer(ndr, JSONPartitionScanner.JSON_STRING);
    return reconciler;
}
Also used : ColorRegistry(org.eclipse.jface.resource.ColorRegistry) TextAttribute(org.eclipse.jface.text.TextAttribute) DefaultDamagerRepairer(org.eclipse.jface.text.rules.DefaultDamagerRepairer) IPresentationReconciler(org.eclipse.jface.text.presentation.IPresentationReconciler) PresentationReconciler(org.eclipse.jface.text.presentation.PresentationReconciler) NonRuleBasedDamagerRepairer(org.jkiss.dbeaver.ui.editors.text.NonRuleBasedDamagerRepairer)

Example 23 with ColorRegistry

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

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)

Example 24 with ColorRegistry

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

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 25 with ColorRegistry

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

the class BaseChartDrawingSupplier method getChartColorsDefinitions.

private static Paint[] getChartColorsDefinitions() {
    ColorRegistry colorRegistry = UIUtils.getActiveWorkbenchWindow().getWorkbench().getThemeManager().getCurrentTheme().getColorRegistry();
    List<Paint> result = new ArrayList<>();
    for (int i = 1; ; i++) {
        Color swtColor = colorRegistry.get(COLOR_PREF_ID_PREFIX + i);
        if (swtColor == null) {
            break;
        }
        result.add(new java.awt.Color(swtColor.getRed(), swtColor.getGreen(), swtColor.getBlue()));
    }
    if (result.isEmpty()) {
        // Something went wrong - no color constants
        log.warn("Chart colors configuration not found");
        Collections.addAll(result, BaseChartConstants.DBEAVER_DEFAULT_COLOR_SERIES);
    }
    return result.toArray(new Paint[0]);
}
Also used : ColorRegistry(org.eclipse.jface.resource.ColorRegistry) Color(org.eclipse.swt.graphics.Color) ArrayList(java.util.ArrayList) java.awt(java.awt)

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