Search in sources :

Example 1 with ISharedTextColors

use of org.eclipse.jface.text.source.ISharedTextColors in project eclipse.platform.text by eclipse.

the class LineNumberColumn method updateForegroundColor.

private void updateForegroundColor(IPreferenceStore store, IVerticalRulerColumn column) {
    RGB rgb = getColorFromStore(store, FG_COLOR_KEY);
    if (rgb == null)
        rgb = new RGB(0, 0, 0);
    ISharedTextColors sharedColors = getSharedColors();
    if (column instanceof LineNumberRulerColumn)
        ((LineNumberRulerColumn) column).setForeground(sharedColors.getColor(rgb));
}
Also used : ISharedTextColors(org.eclipse.jface.text.source.ISharedTextColors) LineNumberRulerColumn(org.eclipse.jface.text.source.LineNumberRulerColumn) RGB(org.eclipse.swt.graphics.RGB)

Example 2 with ISharedTextColors

use of org.eclipse.jface.text.source.ISharedTextColors in project egit by eclipse.

the class SpellcheckableMessageArea method configureAnnotationPreferences.

private SourceViewerDecorationSupport configureAnnotationPreferences() {
    ISharedTextColors textColors = EditorsUI.getSharedTextColors();
    IAnnotationAccess annotationAccess = new DefaultMarkerAnnotationAccess();
    final SourceViewerDecorationSupport support = new SourceViewerDecorationSupport(sourceViewer, null, annotationAccess, textColors);
    List annotationPreferences = new MarkerAnnotationPreferences().getAnnotationPreferences();
    Iterator e = annotationPreferences.iterator();
    while (e.hasNext()) support.setAnnotationPreference((AnnotationPreference) e.next());
    support.install(EditorsUI.getPreferenceStore());
    return support;
}
Also used : ISharedTextColors(org.eclipse.jface.text.source.ISharedTextColors) DefaultMarkerAnnotationAccess(org.eclipse.ui.texteditor.DefaultMarkerAnnotationAccess) IAnnotationAccess(org.eclipse.jface.text.source.IAnnotationAccess) Iterator(java.util.Iterator) IntList(org.eclipse.jgit.util.IntList) List(java.util.List) ArrayList(java.util.ArrayList) MarkerAnnotationPreferences(org.eclipse.ui.texteditor.MarkerAnnotationPreferences) AnnotationPreference(org.eclipse.ui.texteditor.AnnotationPreference) SourceViewerDecorationSupport(org.eclipse.ui.texteditor.SourceViewerDecorationSupport)

Example 3 with ISharedTextColors

use of org.eclipse.jface.text.source.ISharedTextColors in project dbeaver by serge-rider.

the class TabbedFolderList method initColours.

/**
 * Initialize the colours used in the list.
 */
private void initColours() {
    Display display = Display.getCurrent();
    ISharedTextColors sharedColors = UIUtils.getSharedTextColors();
    listBackground = UIStyles.getDefaultTextBackground();
    Color widgetBackground;
    if (UIStyles.isDarkTheme()) {
        // By some reason E4 sets white background in dark theme.
        widgetBackground = UIStyles.getDefaultTextBackground();
        super.setBackground(widgetBackground);
        topNavigationElement.setBackground(widgetBackground);
        bottomNavigationElement.setBackground(widgetBackground);
    } else {
        widgetBackground = getBackground();
    }
    widgetForeground = UIStyles.getDefaultTextForeground();
    widgetDarkShadow = display.getSystemColor(SWT.COLOR_WIDGET_DARK_SHADOW);
    widgetNormalShadow = display.getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW);
    RGB white = display.getSystemColor(SWT.COLOR_WHITE).getRGB();
    RGB black = display.getSystemColor(SWT.COLOR_BLACK).getRGB();
    /*
        defaultGradientStart = sharedColors.getColor(
            UIUtils.blend(infoBackground,
                UIUtils.blend(white, widgetNormalShadow.getRGB(), 20), 60)
        );
        defaultGradientEnd = sharedColors.getColor(UIUtils.blend(infoBackground, widgetNormalShadow.getRGB(), 40));
        */
    if (widgetNormalShadow.hashCode() < widgetBackground.hashCode()) {
        // Foreground darker than background - make element background darker
        elementBackground = sharedColors.getColor(UIUtils.blend(black, widgetBackground.getRGB(), 15));
    } else {
        // Make element background lighter
        elementBackground = sharedColors.getColor(UIUtils.blend(white, widgetBackground.getRGB(), 15));
    }
    navigationElementShadowStroke = sharedColors.getColor(UIUtils.blend(white, widgetNormalShadow.getRGB(), 55));
    bottomNavigationElementShadowStroke1 = sharedColors.getColor(UIUtils.blend(black, widgetBackground.getRGB(), 10));
    bottomNavigationElementShadowStroke2 = sharedColors.getColor(UIUtils.blend(black, widgetBackground.getRGB(), 5));
    /*
		 * gradient in the hover tab: start colour WIDGET_BACKGROUND 100% +
		 * white 20% end colour WIDGET_BACKGROUND 100% + WIDGET_NORMAL_SHADOW
		 * 10%
		 */
    hoverGradientStart = sharedColors.getColor(UIUtils.blend(white, widgetBackground.getRGB(), 20));
    hoverGradientEnd = sharedColors.getColor(UIUtils.blend(widgetNormalShadow.getRGB(), widgetBackground.getRGB(), 10));
    indentedDefaultBackground = sharedColors.getColor(UIUtils.blend(white, widgetBackground.getRGB(), 10));
    indentedHoverBackground = sharedColors.getColor(UIUtils.blend(white, widgetBackground.getRGB(), 75));
}
Also used : ISharedTextColors(org.eclipse.jface.text.source.ISharedTextColors)

Example 4 with ISharedTextColors

use of org.eclipse.jface.text.source.ISharedTextColors in project dbeaver by dbeaver.

the class TabbedFolderList method initColours.

/**
 * Initialize the colours used in the list.
 */
private void initColours() {
    Display display = Display.getCurrent();
    ISharedTextColors sharedColors = UIUtils.getSharedTextColors();
    listBackground = UIStyles.getDefaultTextBackground();
    Color widgetBackground;
    if (UIStyles.isDarkTheme()) {
        // By some reason E4 sets white background in dark theme.
        widgetBackground = UIStyles.getDefaultTextBackground();
        super.setBackground(widgetBackground);
        topNavigationElement.setBackground(widgetBackground);
        bottomNavigationElement.setBackground(widgetBackground);
    } else {
        widgetBackground = getBackground();
    }
    widgetForeground = UIStyles.getDefaultTextForeground();
    widgetDarkShadow = display.getSystemColor(SWT.COLOR_WIDGET_DARK_SHADOW);
    widgetNormalShadow = display.getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW);
    RGB white = display.getSystemColor(SWT.COLOR_WHITE).getRGB();
    RGB black = display.getSystemColor(SWT.COLOR_BLACK).getRGB();
    /*
        defaultGradientStart = sharedColors.getColor(
            UIUtils.blend(infoBackground,
                UIUtils.blend(white, widgetNormalShadow.getRGB(), 20), 60)
        );
        defaultGradientEnd = sharedColors.getColor(UIUtils.blend(infoBackground, widgetNormalShadow.getRGB(), 40));
        */
    if (widgetNormalShadow.hashCode() < widgetBackground.hashCode()) {
        // Foreground darker than background - make element background darker
        elementBackground = sharedColors.getColor(UIUtils.blend(black, widgetBackground.getRGB(), 15));
    } else {
        // Make element background lighter
        elementBackground = sharedColors.getColor(UIUtils.blend(white, widgetBackground.getRGB(), 15));
    }
    navigationElementShadowStroke = sharedColors.getColor(UIUtils.blend(white, widgetNormalShadow.getRGB(), 55));
    bottomNavigationElementShadowStroke1 = sharedColors.getColor(UIUtils.blend(black, widgetBackground.getRGB(), 10));
    bottomNavigationElementShadowStroke2 = sharedColors.getColor(UIUtils.blend(black, widgetBackground.getRGB(), 5));
    /*
		 * gradient in the hover tab: start colour WIDGET_BACKGROUND 100% +
		 * white 20% end colour WIDGET_BACKGROUND 100% + WIDGET_NORMAL_SHADOW
		 * 10%
		 */
    hoverGradientStart = sharedColors.getColor(UIUtils.blend(white, widgetBackground.getRGB(), 20));
    hoverGradientEnd = sharedColors.getColor(UIUtils.blend(widgetNormalShadow.getRGB(), widgetBackground.getRGB(), 10));
    indentedDefaultBackground = sharedColors.getColor(UIUtils.blend(white, widgetBackground.getRGB(), 10));
    indentedHoverBackground = sharedColors.getColor(UIUtils.blend(white, widgetBackground.getRGB(), 75));
}
Also used : ISharedTextColors(org.eclipse.jface.text.source.ISharedTextColors)

Example 5 with ISharedTextColors

use of org.eclipse.jface.text.source.ISharedTextColors in project tdi-studio-se by Talend.

the class TalendJavaSourceViewer method initializeViewer.

private static ReconcilerViewer initializeViewer(Composite composite, int styles, boolean checkCode, IDocument document, int visibleOffset) {
    IAnnotationAccess annotationAccess = new DefaultMarkerAnnotationAccess();
    ISharedTextColors sharedColors = JavaPlugin.getDefault().getJavaTextTools().getColorManager();
    IOverviewRuler overviewRuler = null;
    IVerticalRuler verticalRuler = null;
    if (checkCode) {
        overviewRuler = new OverviewRuler(annotationAccess, 12, sharedColors);
        Iterator e = EditorsPlugin.getDefault().getMarkerAnnotationPreferences().getAnnotationPreferences().iterator();
        while (e.hasNext()) {
            AnnotationPreference preference = (AnnotationPreference) e.next();
            if (preference.contributesToHeader()) {
                overviewRuler.addHeaderAnnotationType(preference.getAnnotationType());
            }
        }
    }
    verticalRuler = new CompositeRuler(12);
    ReconcilerViewer viewer = new TalendJavaSourceViewer(composite, verticalRuler, overviewRuler, checkCode, styles, annotationAccess, sharedColors, checkCode, document);
    if (visibleOffset != -1) {
        viewer.setVisibleRegion(visibleOffset, 0);
    }
    return viewer;
}
Also used : IOverviewRuler(org.eclipse.jface.text.source.IOverviewRuler) ISharedTextColors(org.eclipse.jface.text.source.ISharedTextColors) DefaultMarkerAnnotationAccess(org.eclipse.ui.texteditor.DefaultMarkerAnnotationAccess) IAnnotationAccess(org.eclipse.jface.text.source.IAnnotationAccess) IVerticalRuler(org.eclipse.jface.text.source.IVerticalRuler) Iterator(java.util.Iterator) OverviewRuler(org.eclipse.jface.text.source.OverviewRuler) IOverviewRuler(org.eclipse.jface.text.source.IOverviewRuler) CompositeRuler(org.eclipse.jface.text.source.CompositeRuler) AnnotationPreference(org.eclipse.ui.texteditor.AnnotationPreference) ReconcilerViewer(org.talend.designer.core.ui.viewer.ReconcilerViewer)

Aggregations

ISharedTextColors (org.eclipse.jface.text.source.ISharedTextColors)6 Iterator (java.util.Iterator)2 IAnnotationAccess (org.eclipse.jface.text.source.IAnnotationAccess)2 LineNumberRulerColumn (org.eclipse.jface.text.source.LineNumberRulerColumn)2 RGB (org.eclipse.swt.graphics.RGB)2 AnnotationPreference (org.eclipse.ui.texteditor.AnnotationPreference)2 DefaultMarkerAnnotationAccess (org.eclipse.ui.texteditor.DefaultMarkerAnnotationAccess)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 CompositeRuler (org.eclipse.jface.text.source.CompositeRuler)1 IOverviewRuler (org.eclipse.jface.text.source.IOverviewRuler)1 IVerticalRuler (org.eclipse.jface.text.source.IVerticalRuler)1 OverviewRuler (org.eclipse.jface.text.source.OverviewRuler)1 IntList (org.eclipse.jgit.util.IntList)1 MarkerAnnotationPreferences (org.eclipse.ui.texteditor.MarkerAnnotationPreferences)1 SourceViewerDecorationSupport (org.eclipse.ui.texteditor.SourceViewerDecorationSupport)1 ReconcilerViewer (org.talend.designer.core.ui.viewer.ReconcilerViewer)1