Search in sources :

Example 26 with AnnotationPreference

use of org.eclipse.ui.texteditor.AnnotationPreference in project eclipse.platform.text by eclipse.

the class NextPreviousPulldownActionDelegate method getActionsFromDescriptors.

/**
 * Creates actions using marker
 * annotation preferences.
 *
 * @return the navigation enablement actions
 */
private IAction[] getActionsFromDescriptors() {
    MarkerAnnotationPreferences fMarkerAnnotationPreferences = EditorsPlugin.getDefault().getMarkerAnnotationPreferences();
    SortedSet<NavigationEnablementAction> containers = new TreeSet<>();
    Iterator<AnnotationPreference> iter = fMarkerAnnotationPreferences.getAnnotationPreferences().iterator();
    while (iter.hasNext()) {
        AnnotationPreference preference = iter.next();
        String key = preference.getShowInNextPrevDropdownToolbarActionKey();
        if (key != null && fStore.getBoolean(key)) {
            String preferenceKey = getPreferenceKey(preference);
            /*
				 * Fixes bug 41689
				 * This code can be simplified if we decide that
				 * we don't allow to use different settings for go to
				 * previous and go to next annotation.
				 */
            preferenceKey = preference.getIsGoToNextNavigationTargetKey();
            if (preferenceKey != null)
                containers.add(new NavigationEnablementAction(preference.getPreferenceLabel(), fStore, preferenceKey));
        }
    }
    return containers.toArray(new Action[containers.size()]);
}
Also used : TreeSet(java.util.TreeSet) MarkerAnnotationPreferences(org.eclipse.ui.texteditor.MarkerAnnotationPreferences) AnnotationPreference(org.eclipse.ui.texteditor.AnnotationPreference)

Example 27 with AnnotationPreference

use of org.eclipse.ui.texteditor.AnnotationPreference in project tmdm-studio-se by Talend.

the class ElementFKInfoFormatViewer method getSourceViewerDecorationSupport.

protected SourceViewerDecorationSupport getSourceViewerDecorationSupport(ISourceViewer viewer) {
    if (fSourceViewerDecorationSupport == null) {
        fSourceViewerDecorationSupport = new SourceViewerDecorationSupport(viewer, overviewRuler, XMLSourceViewerHelper.getInstance().getAnnotationAccess(), XMLSourceViewerHelper.getInstance().getSharedColors());
        // patch see SourceViewerDecorationSupport
        AnnotationPreference info = new AnnotationPreference();
        info.setAnnotationType(TYPE);
        // $NON-NLS-1$
        info.setTextPreferenceKey("errorIndication");
        // $NON-NLS-1$
        info.setTextStylePreferenceKey("errorTextStyle");
        // $NON-NLS-1$
        info.setColorPreferenceKey("errorIndicationColor");
        getPreferenceStore().setValue(info.getTextPreferenceKey(), true);
        // $NON-NLS-1$
        getPreferenceStore().setValue(info.getTextStylePreferenceKey(), "PROBLEM_UNDERLINE");
        // $NON-NLS-1$
        getPreferenceStore().setValue(info.getColorPreferenceKey(), "255, 0, 0");
        configureSourceViewerDecorationSupport(fSourceViewerDecorationSupport);
    }
    return fSourceViewerDecorationSupport;
}
Also used : AnnotationPreference(org.eclipse.ui.texteditor.AnnotationPreference) SourceViewerDecorationSupport(org.eclipse.ui.texteditor.SourceViewerDecorationSupport)

Example 28 with AnnotationPreference

use of org.eclipse.ui.texteditor.AnnotationPreference in project tmdm-studio-se by Talend.

the class XMLSourceViewer method getSourceViewerDecorationSupport.

protected SourceViewerDecorationSupport getSourceViewerDecorationSupport(ISourceViewer viewer) {
    if (fSourceViewerDecorationSupport == null) {
        fSourceViewerDecorationSupport = new SourceViewerDecorationSupport(viewer, getOverviewRuler(), XMLSourceViewerHelper.getInstance().getAnnotationAccess(), XMLSourceViewerHelper.getInstance().getSharedColors());
        // patch see SourceViewerDecorationSupport
        AnnotationPreference info = new AnnotationPreference();
        info.setAnnotationType(XMLValidator.TYPE);
        // $NON-NLS-1$
        info.setTextPreferenceKey("errorIndication");
        // $NON-NLS-1$
        info.setTextStylePreferenceKey("errorTextStyle");
        // $NON-NLS-1$
        info.setColorPreferenceKey("errorIndicationColor");
        getPreferenceStore().setValue(info.getTextPreferenceKey(), true);
        // $NON-NLS-1$
        getPreferenceStore().setValue(info.getTextStylePreferenceKey(), "PROBLEM_UNDERLINE");
        // $NON-NLS-1$
        getPreferenceStore().setValue(info.getColorPreferenceKey(), "255, 0, 0");
        configureSourceViewerDecorationSupport(fSourceViewerDecorationSupport);
    }
    return fSourceViewerDecorationSupport;
}
Also used : AnnotationPreference(org.eclipse.ui.texteditor.AnnotationPreference) SourceViewerDecorationSupport(org.eclipse.ui.texteditor.SourceViewerDecorationSupport)

Example 29 with AnnotationPreference

use of org.eclipse.ui.texteditor.AnnotationPreference in project webtools.sourceediting by eclipse.

the class AnnotationHoverProcessor method isAnnotationValid.

boolean isAnnotationValid(Annotation a) {
    AnnotationPreference preference = getAnnotationPreference(a);
    if (preference == null)
        return false;
    String textPreferenceKey = preference.getTextPreferenceKey();
    String highlightPreferenceKey = preference.getHighlightPreferenceKey();
    if (textPreferenceKey == null || !(getPreferenceStore().getBoolean(textPreferenceKey)) || highlightPreferenceKey == null || getPreferenceStore().getBoolean(highlightPreferenceKey))
        return false;
    return true;
}
Also used : AnnotationPreference(org.eclipse.ui.texteditor.AnnotationPreference)

Example 30 with AnnotationPreference

use of org.eclipse.ui.texteditor.AnnotationPreference in project webtools.sourceediting by eclipse.

the class TemporaryAnnotation method computeLayer.

private static int computeLayer(String annotationType, AnnotationPreferenceLookup lookup) {
    Annotation annotation = new Annotation(annotationType, false, null);
    AnnotationPreference preference = lookup.getAnnotationPreference(annotation);
    if (preference != null)
        return preference.getPresentationLayer() + 1;
    else
        return IAnnotationAccessExtension.DEFAULT_LAYER + 1;
}
Also used : AnnotationPreference(org.eclipse.ui.texteditor.AnnotationPreference) IQuickFixableAnnotation(org.eclipse.jface.text.quickassist.IQuickFixableAnnotation) Annotation(org.eclipse.jface.text.source.Annotation) ITemporaryAnnotation(org.eclipse.wst.sse.ui.internal.ITemporaryAnnotation)

Aggregations

AnnotationPreference (org.eclipse.ui.texteditor.AnnotationPreference)32 ArrayList (java.util.ArrayList)6 SourceViewerDecorationSupport (org.eclipse.ui.texteditor.SourceViewerDecorationSupport)5 IPreferenceStore (org.eclipse.jface.preference.IPreferenceStore)4 IOverviewRuler (org.eclipse.jface.text.source.IOverviewRuler)4 OverviewRuler (org.eclipse.jface.text.source.OverviewRuler)4 DefaultMarkerAnnotationAccess (org.eclipse.ui.texteditor.DefaultMarkerAnnotationAccess)4 MarkerAnnotationPreferences (org.eclipse.ui.texteditor.MarkerAnnotationPreferences)4 Iterator (java.util.Iterator)3 Annotation (org.eclipse.jface.text.source.Annotation)2 AnnotationRulerColumn (org.eclipse.jface.text.source.AnnotationRulerColumn)2 CompositeRuler (org.eclipse.jface.text.source.CompositeRuler)2 IAnnotationAccess (org.eclipse.jface.text.source.IAnnotationAccess)2 ISharedTextColors (org.eclipse.jface.text.source.ISharedTextColors)2 ISourceViewer (org.eclipse.jface.text.source.ISourceViewer)2 IPropertyChangeListener (org.eclipse.jface.util.IPropertyChangeListener)2 PropertyChangeEvent (org.eclipse.jface.util.PropertyChangeEvent)2 Image (org.eclipse.swt.graphics.Image)2 OverlayKey (org.eclipse.ui.internal.editors.text.OverlayPreferenceStore.OverlayKey)2 MarkerAnnotation (org.eclipse.ui.texteditor.MarkerAnnotation)2