use of org.eclipse.jface.resource.ColorRegistry 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.jface.resource.ColorRegistry in project xtext-eclipse by eclipse.
the class DefaultEObjectHoverProvider method getHoverInfo.
protected XtextBrowserInformationControlInput getHoverInfo(EObject element, IRegion hoverRegion, XtextBrowserInformationControlInput previous) {
String html = getHoverInfoAsHtml(element);
if (html != null) {
StringBuffer buffer = new StringBuffer(html);
ColorRegistry registry = JFaceResources.getColorRegistry();
// $NON-NLS-1$
RGB fgRGB = registry.getRGB("org.eclipse.ui.workbench.HOVER_FOREGROUND");
// $NON-NLS-1$
RGB bgRGB = registry.getRGB("org.eclipse.ui.workbench.HOVER_BACKGROUND");
if (fgRGB != null && bgRGB != null) {
HTMLPrinter.insertPageProlog(buffer, 0, fgRGB, bgRGB, getStyleSheet());
} else {
HTMLPrinter.insertPageProlog(buffer, 0, getStyleSheet());
}
HTMLPrinter.addPageEpilog(buffer);
html = buffer.toString();
return new XtextBrowserInformationControlInput(previous, element, html, labelProvider);
}
return null;
}
use of org.eclipse.jface.resource.ColorRegistry in project xtext-eclipse by eclipse.
the class XbaseHoverProvider method getHoverInfo.
@Override
protected XtextBrowserInformationControlInput getHoverInfo(EObject element, IRegion hoverRegion, XtextBrowserInformationControlInput previous) {
// TODO remove this check when the typesystem works without a java project
if (isValidationDisabled(element))
return null;
EObject objectToView = getObjectToView(element);
if (objectToView == null || objectToView.eIsProxy())
return null;
String html = getHoverInfoAsHtml(element, objectToView, hoverRegion);
if (html != null) {
StringBuffer buffer = new StringBuffer(html);
ColorRegistry registry = JFaceResources.getColorRegistry();
// $NON-NLS-1$
RGB fgRGB = registry.getRGB("org.eclipse.ui.workbench.HOVER_FOREGROUND");
// $NON-NLS-1$
RGB bgRGB = registry.getRGB("org.eclipse.ui.workbench.HOVER_BACKGROUND");
if (fgRGB != null && bgRGB != null) {
HTMLPrinter.insertPageProlog(buffer, 0, fgRGB, bgRGB, getStyleSheet());
} else {
HTMLPrinter.insertPageProlog(buffer, 0, getStyleSheet());
}
HTMLPrinter.addPageEpilog(buffer);
html = buffer.toString();
IJavaElement javaElement = null;
if (objectToView != element && objectToView instanceof JvmIdentifiableElement) {
javaElement = javaElementFinder.findElementFor((JvmIdentifiableElement) objectToView);
}
return new XbaseInformationControlInput(previous, objectToView, javaElement, html, labelProvider);
}
return null;
}
use of org.eclipse.jface.resource.ColorRegistry in project xtext-eclipse by eclipse.
the class XbaseInformationControl method createContent.
/**
* Xbase - modification+ added detailPane
*/
@Override
protected void createContent(Composite parent) {
fSashForm = new SashForm(parent, parent.getStyle());
fSashForm.setOrientation(SWT.VERTICAL);
fBrowser = new Browser(fSashForm, SWT.NONE);
fBrowser.setJavascriptEnabled(false);
Display display = getShell().getDisplay();
ColorRegistry registry = JFaceResources.getColorRegistry();
// $NON-NLS-1$
Color foreground = registry.get("org.eclipse.ui.workbench.HOVER_FOREGROUND");
// $NON-NLS-1$
Color background = registry.get("org.eclipse.ui.workbench.HOVER_BACKGROUND");
if (background != null && foreground != null) {
fBrowser.setForeground(foreground);
fBrowser.setBackground(background);
} else {
fBrowser.setForeground(display.getSystemColor(SWT.COLOR_INFO_FOREGROUND));
fBrowser.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND));
}
fBrowser.addProgressListener(new ProgressAdapter() {
@Override
public void completed(ProgressEvent event) {
fCompleted = true;
}
});
fBrowser.addOpenWindowListener(new OpenWindowListener() {
@Override
public void open(WindowEvent event) {
// Cancel opening of new windows
event.required = true;
}
});
// Replace browser's built-in context menu with none
fSashForm.setMenu(new Menu(getShell(), SWT.NONE));
detailPaneComposite = createComposite(fSashForm, 1, 1, GridData.FILL_BOTH);
Layout layout = detailPaneComposite.getLayout();
if (layout instanceof GridLayout) {
GridLayout gl = (GridLayout) layout;
gl.marginHeight = 0;
gl.marginWidth = 0;
gl.numColumns = 1;
}
if (background != null && foreground != null) {
detailPaneComposite.setForeground(foreground);
detailPaneComposite.setBackground(background);
} else {
detailPaneComposite.setForeground(display.getSystemColor(SWT.COLOR_INFO_FOREGROUND));
detailPaneComposite.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND));
}
resourceProvider = new HoverEditedResourceProvider();
embeddedEditor = xbaseHoverConfiguration.getEditorFactory().newEditor(resourceProvider).readOnly().processIssuesBy(new IValidationIssueProcessor() {
@Override
public void processIssues(List<Issue> issues, IProgressMonitor monitor) {
}
}).withParent(detailPaneComposite);
Control viewerControl = embeddedEditor.getViewer().getControl();
if (background != null && foreground != null) {
viewerControl.setForeground(foreground);
viewerControl.setBackground(background);
} else {
viewerControl.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND));
viewerControl.setForeground(display.getSystemColor(SWT.COLOR_INFO_FOREGROUND));
}
embeddedEditor.getDocument().setValidationJob(null);
createTextLayout();
}
use of org.eclipse.jface.resource.ColorRegistry in project xtext-eclipse by eclipse.
the class RenameRefactoringPopup method createContent.
protected void createContent(Composite parent) {
Display display = parent.getDisplay();
ColorRegistry registry = JFaceResources.getColorRegistry();
// $NON-NLS-1$
Color foreground = registry.get("org.eclipse.ui.workbench.HOVER_FOREGROUND");
if (foreground == null) {
foreground = display.getSystemColor(SWT.COLOR_INFO_FOREGROUND);
}
// $NON-NLS-1$
Color background = registry.get("org.eclipse.ui.workbench.HOVER_BACKGROUND");
if (background == null) {
background = display.getSystemColor(SWT.COLOR_INFO_BACKGROUND);
}
StyledText hint = new StyledText(popup, SWT.READ_ONLY | SWT.SINGLE);
String enterKeyName = getEnterBinding();
String hintTemplate = "Enter new name, press {0} to refactor";
hint.setText(Messages.format(hintTemplate, enterKeyName));
hint.setForeground(foreground);
// $NON-NLS-1$
hint.setStyleRange(new StyleRange(hintTemplate.indexOf("{0}"), enterKeyName.length(), null, null, SWT.BOLD));
// text must not be selectable
hint.setEnabled(false);
addViewMenu(parent);
recursiveSetBackgroundColor(parent, background);
}
Aggregations