Search in sources :

Example 6 with ColorRegistry

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);
}
Also used : ColorRegistry(org.eclipse.jface.resource.ColorRegistry) RGB(org.eclipse.swt.graphics.RGB)

Example 7 with ColorRegistry

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);
    });
}
Also used : ColorRegistry(org.eclipse.jface.resource.ColorRegistry) Color(org.eclipse.swt.graphics.Color) Label(org.eclipse.swt.widgets.Label) GridData(org.eclipse.swt.layout.GridData) Text(org.eclipse.swt.widgets.Text)

Example 8 with ColorRegistry

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;
}
Also used : CGCategory(org.eclipse.linuxtools.internal.gprof.view.histogram.CGCategory) ColorRegistry(org.eclipse.jface.resource.ColorRegistry) Color(org.eclipse.swt.graphics.Color) CGArc(org.eclipse.linuxtools.internal.gprof.view.histogram.CGArc)

Example 9 with ColorRegistry

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);
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) ModifyEvent(org.eclipse.swt.events.ModifyEvent) CTabFolder(org.eclipse.swt.custom.CTabFolder) Composite(org.eclipse.swt.widgets.Composite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) ColorRegistry(org.eclipse.jface.resource.ColorRegistry) CoreException(org.eclipse.core.runtime.CoreException) ModifyListener(org.eclipse.swt.events.ModifyListener) Color(org.eclipse.swt.graphics.Color) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) Text(org.eclipse.swt.widgets.Text)

Example 10 with ColorRegistry

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);
    }
}
Also used : DisposeListener(org.eclipse.swt.events.DisposeListener) ColorRegistry(org.eclipse.jface.resource.ColorRegistry) IAnnotationAccess(org.eclipse.jface.text.source.IAnnotationAccess) HorizontalRuleDrawingStrategy(org.eclipse.mylyn.internal.wikitext.ui.viewer.annotation.HorizontalRuleDrawingStrategy) ImageDrawingStrategy(org.eclipse.mylyn.internal.wikitext.ui.viewer.annotation.ImageDrawingStrategy) BulletDrawingStrategy(org.eclipse.mylyn.internal.wikitext.ui.viewer.annotation.BulletDrawingStrategy) DisposeEvent(org.eclipse.swt.events.DisposeEvent) AnnotationPainter(org.eclipse.jface.text.source.AnnotationPainter) Annotation(org.eclipse.jface.text.source.Annotation) HorizontalRuleAnnotation(org.eclipse.mylyn.internal.wikitext.ui.viewer.annotation.HorizontalRuleAnnotation) ImageAnnotation(org.eclipse.mylyn.internal.wikitext.ui.viewer.annotation.ImageAnnotation) BulletAnnotation(org.eclipse.mylyn.internal.wikitext.ui.viewer.annotation.BulletAnnotation) ImageManager(org.eclipse.mylyn.internal.wikitext.ui.viewer.ImageManager)

Aggregations

ColorRegistry (org.eclipse.jface.resource.ColorRegistry)48 Color (org.eclipse.swt.graphics.Color)14 IPreferenceStore (org.eclipse.jface.preference.IPreferenceStore)8 RGB (org.eclipse.swt.graphics.RGB)6 TextAttribute (org.eclipse.jface.text.TextAttribute)5 GridData (org.eclipse.swt.layout.GridData)4 GridLayout (org.eclipse.swt.layout.GridLayout)4 java.awt (java.awt)2 ArrayList (java.util.ArrayList)2 LinkedList (java.util.LinkedList)2 IPresentationReconciler (org.eclipse.jface.text.presentation.IPresentationReconciler)2 PresentationReconciler (org.eclipse.jface.text.presentation.PresentationReconciler)2 DefaultDamagerRepairer (org.eclipse.jface.text.rules.DefaultDamagerRepairer)2 ControlEvent (org.eclipse.swt.events.ControlEvent)2 Display (org.eclipse.swt.widgets.Display)2 Label (org.eclipse.swt.widgets.Label)2 Text (org.eclipse.swt.widgets.Text)2 ITheme (org.eclipse.ui.themes.ITheme)2 PlotterListener (io.sloeber.ui.monitor.internal.PlotterListener)1 CoreException (org.eclipse.core.runtime.CoreException)1