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]);
}
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;
}
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));
}
}
}
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));
}
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]);
}
Aggregations