use of org.eclipse.jface.resource.ColorRegistry in project eclipse.platform.text by eclipse.
the class EditorsPluginPreferenceInitializer method setThemeBasedPreferences.
public static void setThemeBasedPreferences(IPreferenceStore store, boolean fireEvent) {
ColorRegistry registry = null;
if (PlatformUI.isWorkbenchRunning())
registry = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getColorRegistry();
setDefault(store, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_CURRENT_LINE_COLOR, findRGB(registry, ITextEditorThemeConstants.CURRENT_LINE_COLOR, new RGB(232, 242, 254)), fireEvent);
setDefault(store, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLOR, findRGB(registry, ITextEditorThemeConstants.PRINT_MARGIN_COLOR, new RGB(176, 180, 185)), fireEvent);
setDefault(store, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_LINE_NUMBER_RULER_COLOR, findRGB(registry, ITextEditorThemeConstants.LINE_NUMBER_RULER_COLOR, new RGB(120, 120, 120)), fireEvent);
setDefault(store, AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND, findRGB(registry, ITextEditorThemeConstants.PREFERENCE_COLOR_BACKGROUND, new RGB(255, 255, 255)), fireEvent);
setDefault(store, AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND, findRGB(registry, ITextEditorThemeConstants.PREFERENCE_COLOR_FOREGROUND, new RGB(0, 0, 0)), fireEvent);
setDefault(store, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_HYPERLINK_COLOR, findRGB(registry, ITextEditorThemeConstants.HYPERLINK_COLOR, new RGB(0, 0, 255)), fireEvent);
setDefault(store, AbstractTextEditor.PREFERENCE_COLOR_FIND_SCOPE, findRGB(registry, ITextEditorThemeConstants.FIND_SCOPE_COLOR, new RGB(185, 176, 180)), fireEvent);
}
use of org.eclipse.jface.resource.ColorRegistry in project linuxtools by eclipse.
the class GmonView method createTitle.
@Override
protected void createTitle(Composite parent) {
ColorRegistry colorRegistry = JFaceResources.getColorRegistry();
// $NON-NLS-1$
Color background = colorRegistry.get("org.eclipse.ui.workbench.INACTIVE_TAB_BG_START");
label = new Label(parent, SWT.WRAP);
if (background != null) {
label.setBackground(background);
}
GridData data = new GridData(SWT.FILL, SWT.BEGINNING, true, false, 1, 1);
label.setLayoutData(data);
fFilterText = new Text(parent, SWT.BORDER | SWT.SINGLE | SWT.SEARCH | SWT.ICON_SEARCH | SWT.ICON_CANCEL);
fFilterText.setMessage(Messages.GmonView_type_filter_text);
fFilterText.setToolTipText(Messages.GmonView_filter_by_name);
fFilterText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
fFilterText.addModifyListener(e -> {
String text = fFilterText.getText();
fViewerFilter.setMatchingText(text);
});
}
use of org.eclipse.jface.resource.ColorRegistry in project linuxtools by eclipse.
the class GmonView method getBackground.
/*
* I do not know where to put this static method. It is used by all ProfFields
*/
public static Color getBackground(Object element) {
ColorRegistry colorRegistry = JFaceResources.getColorRegistry();
// FIXME: Not sure if color1-color4 are ever used...picked colors found in JFacesResources ColorRegistry
// not tied to any particular language (e.g. didn't choose CDT or Java colors)
// Color5 seems to work ok as bg in the one dark theme I tried (Nissl-Adwaita-dark-4) and as well
// in default light adwaita, but it is much simpler to just return null and let the table color default
// appropriately.
// $NON-NLS-1$
Color color1 = colorRegistry.get("org.eclipse.ui.editors.currentLineColor");
// $NON-NLS-1$
Color color2 = colorRegistry.get("org.eclipse.ui.workbench.INACTIVE_TAB_BG_START");
// $NON-NLS-1$
Color color3 = colorRegistry.get("org.eclipse.ui.workbench.ACTIVE_NOFOCUS_TAB_BG_END");
// $NON-NLS-1$
Color color4 = colorRegistry.get("org.eclipse.ui.workbench.ACTIVE_TAB_BG_END");
if (element instanceof CGCategory) {
CGCategory cat = (CGCategory) element;
if (CGCategory.CHILDREN.equals(cat.category)) {
return color1 == null ? BLUE1 : color1;
} else {
return color2 == null ? GREEN1 : color2;
}
} else if (element instanceof CGArc) {
CGArc arc = (CGArc) element;
CGCategory cat = (CGCategory) arc.getParent();
if (CGCategory.CHILDREN.equals(cat.category)) {
return color3 == null ? BLUE2 : color3;
} else {
return color4 == null ? GREEN2 : color4;
}
}
// default background
return null;
// return color5 == null ? DEFAULT_BG : color5;
}
use of org.eclipse.jface.resource.ColorRegistry in project jbosstools-hibernate by jbosstools.
the class ConsoleConfigurationWizardPage method createControl.
/**
* @see IDialogPage#createControl(Composite)
*/
public void createControl(Composite parent) {
final ScrolledComposite sc = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL);
sc.setExpandHorizontal(true);
sc.setExpandVertical(true);
Composite container = new Composite(sc, SWT.NONE);
GridLayout layout = new GridLayout(2, false);
layout.verticalSpacing = 10;
layout.horizontalSpacing = 5;
container.setLayout(layout);
GridData gd = new GridData(GridData.FILL_BOTH);
container.setLayoutData(gd);
nameLabel = new Label(container, SWT.HORIZONTAL | SWT.LEFT);
nameLabel.setText(HibernateConsoleMessages.ConsoleConfigurationWizardPage_name);
nameLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
nameWidget = new Text(container, SWT.SINGLE | SWT.BORDER);
nameWidget.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
tabFolder = new CTabFolder(container, SWT.TOP | SWT.NO_REDRAW_RESIZE | SWT.NO_TRIM | SWT.FLAT);
gd = new GridData(GridData.FILL_BOTH);
gd.horizontalSpan = 2;
ColorRegistry reg = JFaceResources.getColorRegistry();
Color // $NON-NLS-1$
c1 = reg.get("org.eclipse.ui.workbench.ACTIVE_TAB_BG_START"), // $NON-NLS-1$
c2 = reg.get("org.eclipse.ui.workbench.ACTIVE_TAB_BG_END");
tabFolder.setSelectionBackground(new Color[] { c1, c2 }, new int[] { 100 }, true);
tabFolder.setSelectionForeground(reg.get(// $NON-NLS-1$
"org.eclipse.ui.workbench.ACTIVE_TAB_TEXT_COLOR"));
tabFolder.setSimple(PlatformUI.getPreferenceStore().getBoolean(IWorkbenchPreferenceConstants.SHOW_TRADITIONAL_STYLE_TABS));
tabFolder.setLayoutData(gd);
tabFolder.setBorderVisible(true);
tabFolder.setFont(parent.getFont());
sc.setContent(container);
initTabs(tabFolder);
try {
performStart();
} catch (CoreException ce) {
HibernateConsolePlugin.getDefault().showError(getShell(), HibernateConsoleMessages.AddConfigurationAction_problem_add_console_config, ce);
}
try {
initialize(currentLaunchConfig, selection);
} catch (CoreException ce) {
HibernateConsolePlugin.getDefault().logErrorMessage(HibernateConsoleMessages.ConsoleConfigurationWizardPage_problem_while_initializing_cc, ce);
}
performInit();
ModifyListener modifyListener = new ModifyListener() {
public void modifyText(ModifyEvent e) {
dialogChanged();
}
};
nameWidget.addModifyListener(modifyListener);
setActiveTab(0);
sc.setMinSize(tabFolder.computeSize(SWT.DEFAULT, SWT.DEFAULT));
setControl(sc);
dialogChanged();
parent.layout(true, false);
}
use of org.eclipse.jface.resource.ColorRegistry in project mylyn.docs by eclipse.
the class HtmlViewer method initPainter.
@SuppressWarnings("deprecation")
private void initPainter() {
if (haveInit) {
return;
}
haveInit = true;
// bug# 245759: must work outside of an Eclipse runtime
ColorRegistry colorRegistry = WikiTextUiResources.getColors();
IAnnotationAccess annotationAccess = new IAnnotationAccess() {
public Object getType(Annotation annotation) {
return annotation.getType();
}
public boolean isMultiLine(Annotation annotation) {
return true;
}
public boolean isTemporary(Annotation annotation) {
return true;
}
};
AnnotationPainter painter = new AnnotationPainter(this, annotationAccess);
// paint bullets
painter.addDrawingStrategy(BulletAnnotation.TYPE, new BulletDrawingStrategy());
painter.addAnnotationType(BulletAnnotation.TYPE, BulletAnnotation.TYPE);
painter.setAnnotationTypeColor(BulletAnnotation.TYPE, getTextWidget().getForeground());
// paint HR
painter.addDrawingStrategy(HorizontalRuleAnnotation.TYPE, new HorizontalRuleDrawingStrategy());
painter.addAnnotationType(HorizontalRuleAnnotation.TYPE, HorizontalRuleAnnotation.TYPE);
painter.setAnnotationTypeColor(HorizontalRuleAnnotation.TYPE, colorRegistry.get(WikiTextUiResources.COLOR_HR));
if (displayImages) {
// paint images
painter.addDrawingStrategy(ImageAnnotation.TYPE, new ImageDrawingStrategy(this));
painter.addAnnotationType(ImageAnnotation.TYPE, ImageAnnotation.TYPE);
painter.setAnnotationTypeColor(ImageAnnotation.TYPE, getTextWidget().getForeground());
}
addTextPresentationListener(painter);
addPainter(painter);
getTextWidget().addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent e) {
imageCache.dispose();
}
});
if (displayImages) {
new ImageManager(this, imageCache, painter);
}
}
Aggregations