use of org.eclipse.ui.themes.ITheme in project dbeaver by serge-rider.
the class SpreadsheetPresentation method applyThemeSettings.
///////////////////////////////////////////////
// Themes
private 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.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.ui.themes.ITheme in project dbeaver by dbeaver.
the class ERDGraphicalViewer method applyThemeSettings.
private void applyThemeSettings() {
ITheme currentTheme = themeManager.getCurrentTheme();
Font erdFont = currentTheme.getFontRegistry().get("org.jkiss.dbeaver.erd.diagram.font");
if (erdFont != null) {
this.getControl().setFont(erdFont);
}
editor.refreshDiagram(true, false);
/*
DiagramPart diagramPart = editor.getDiagramPart();
if (diagramPart != null) {
diagramPart.resetFonts();
diagramPart.refresh();
}
*/
}
use of org.eclipse.ui.themes.ITheme in project dbeaver by dbeaver.
the class SQLRuleManager method getColor.
public Color getColor(String colorKey, int colorDefault) {
ITheme currentTheme = themeManager.getCurrentTheme();
Color color = currentTheme.getColorRegistry().get(colorKey);
if (color == null) {
color = Display.getDefault().getSystemColor(colorDefault);
}
return color;
}
use of org.eclipse.ui.themes.ITheme in project arduino-eclipse-plugin by Sloeber.
the class SerialMonitor method createPartControl.
/**
* This is a callback that will allow us to create the viewer and initialize
* it.
*/
@Override
public void createPartControl(Composite parent1) {
this.parent = parent1;
parent1.setLayout(new GridLayout());
GridLayout layout = new GridLayout(5, false);
layout.marginHeight = 0;
layout.marginWidth = 0;
Composite top = new Composite(parent1, SWT.NONE);
top.setLayout(layout);
top.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
this.serialPorts = new ComboViewer(top, SWT.READ_ONLY | SWT.DROP_DOWN);
GridData minSizeGridData = new GridData(SWT.LEFT, SWT.CENTER, false, false);
minSizeGridData.widthHint = 150;
this.serialPorts.getControl().setLayoutData(minSizeGridData);
this.serialPorts.setContentProvider(new IStructuredContentProvider() {
@Override
public void dispose() {
// no need to do something here
}
@Override
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
// no need to do something here
}
@Override
public Object[] getElements(Object inputElement) {
@SuppressWarnings("unchecked") Map<Serial, SerialListener> items = (Map<Serial, SerialListener>) inputElement;
return items.keySet().toArray();
}
});
this.serialPorts.setLabelProvider(new LabelProvider());
this.serialPorts.setInput(this.serialConnections);
this.serialPorts.addSelectionChangedListener(new ComPortChanged(this));
this.sendString = new Text(top, SWT.SINGLE | SWT.BORDER);
this.sendString.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
this.lineTerminator = new ComboViewer(top, SWT.READ_ONLY | SWT.DROP_DOWN);
this.lineTerminator.setContentProvider(new ArrayContentProvider());
this.lineTerminator.setLabelProvider(new LabelProvider());
this.lineTerminator.setInput(SerialManager.listLineEndings());
this.lineTerminator.getCombo().select(MyPreferences.getLastUsedSerialLineEnd());
this.lineTerminator.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
MyPreferences.setLastUsedSerialLineEnd(SerialMonitor.this.lineTerminator.getCombo().getSelectionIndex());
}
});
this.send = new Button(top, SWT.BUTTON1);
this.send.setText(Messages.serialMonitorSend);
this.send.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
int index = SerialMonitor.this.lineTerminator.getCombo().getSelectionIndex();
GetSelectedSerial().write(SerialMonitor.this.sendString.getText(), SerialManager.getLineEnding(index));
// $NON-NLS-1$
SerialMonitor.this.sendString.setText("");
SerialMonitor.this.sendString.setFocus();
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
// nothing needs to be done here
}
});
this.send.setEnabled(false);
this.reset = new Button(top, SWT.BUTTON1);
this.reset.setText(Messages.serialMonitorReset);
this.reset.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
GetSelectedSerial().reset();
SerialMonitor.this.sendString.setFocus();
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
// nothing needs to be done here
}
});
this.reset.setEnabled(false);
// register the combo as a Selection Provider
getSite().setSelectionProvider(this.serialPorts);
this.monitorOutput = new StyledText(top, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
this.monitorOutput.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 5, 1));
this.monitorOutput.setEditable(false);
IThemeManager themeManager = PlatformUI.getWorkbench().getThemeManager();
ITheme currentTheme = themeManager.getCurrentTheme();
FontRegistry fontRegistry = currentTheme.getFontRegistry();
// $NON-NLS-1$
this.monitorOutput.setFont(fontRegistry.get("io.sloeber.serial.fontDefinition"));
this.monitorOutput.setText(Messages.serialMonitorNoInput);
this.parent.getShell().setDefaultButton(this.send);
makeActions();
contributeToActionBars();
}
use of org.eclipse.ui.themes.ITheme in project egit by eclipse.
the class LabelEventJob method ensureFontAndColorsCreated.
/**
* This method will ensure that the fonts and colors used by the decorator
* are cached in the registries. This avoids having to syncExec when
* decorating since we ensure that the fonts and colors are pre-created.
*
* @param actFonts fonts ids to cache
* @param actColors color ids to cache
*/
private void ensureFontAndColorsCreated(final List<String> actFonts, final List<String> actColors) {
final Display display = PlatformUI.getWorkbench().getDisplay();
display.syncExec(new Runnable() {
@Override
public void run() {
ITheme theme = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme();
for (int i = 0; i < actColors.size(); i++) {
theme.getColorRegistry().get(actColors.get(i));
}
for (int i = 0; i < actFonts.size(); i++) {
theme.getFontRegistry().get(actFonts.get(i));
}
defaultBackgroundRgb = display.getSystemColor(SWT.COLOR_LIST_BACKGROUND).getRGB();
}
});
}
Aggregations