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