Search in sources :

Example 21 with AnnotationPreference

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

the class LineNumberColumn method getAnnotationPreferenceMap.

private Map<Object, AnnotationPreference> getAnnotationPreferenceMap() {
    Map<Object, AnnotationPreference> annotationPrefs = new HashMap<>();
    Iterator<AnnotationPreference> iter = fAnnotationPreferences.getAnnotationPreferences().iterator();
    while (iter.hasNext()) {
        AnnotationPreference pref = iter.next();
        Object type = pref.getAnnotationType();
        annotationPrefs.put(type, pref);
    }
    return annotationPrefs;
}
Also used : HashMap(java.util.HashMap) AnnotationPreference(org.eclipse.ui.texteditor.AnnotationPreference)

Example 22 with AnnotationPreference

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

the class TextSourceViewerConfiguration method isShowInVerticalRuler.

/*
	 * @see DefaultAnnotationHover#isIncluded(Annotation)
	 * @since 3.2
	 */
protected boolean isShowInVerticalRuler(Annotation annotation) {
    AnnotationPreference preference = getAnnotationPreference(annotation);
    if (preference == null)
        return true;
    String key = preference.getVerticalRulerPreferenceKey();
    // backward compatibility
    if (key != null && !fPreferenceStore.getBoolean(key))
        return false;
    return true;
}
Also used : AnnotationPreference(org.eclipse.ui.texteditor.AnnotationPreference)

Example 23 with AnnotationPreference

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

the class AnnotationsConfigurationBlock method createOverlayStoreKeys.

private OverlayPreferenceStore.OverlayKey[] createOverlayStoreKeys(MarkerAnnotationPreferences preferences) {
    ArrayList<OverlayKey> overlayKeys = new ArrayList<>();
    Iterator<AnnotationPreference> e = preferences.getAnnotationPreferences().iterator();
    while (e.hasNext()) {
        AnnotationPreference info = e.next();
        overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, info.getColorPreferenceKey()));
        overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, info.getTextPreferenceKey()));
        if (info.getHighlightPreferenceKey() != null)
            overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, info.getHighlightPreferenceKey()));
        overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, info.getOverviewRulerPreferenceKey()));
        if (info.getVerticalRulerPreferenceKey() != null)
            overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, info.getVerticalRulerPreferenceKey()));
        if (info.getTextStylePreferenceKey() != null)
            overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, info.getTextStylePreferenceKey()));
        if (info.getIsGoToNextNavigationTargetKey() != null)
            overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, info.getIsGoToNextNavigationTargetKey()));
    }
    OverlayPreferenceStore.OverlayKey[] keys = new OverlayPreferenceStore.OverlayKey[overlayKeys.size()];
    overlayKeys.toArray(keys);
    return keys;
}
Also used : OverlayKey(org.eclipse.ui.internal.editors.text.OverlayPreferenceStore.OverlayKey) OverlayKey(org.eclipse.ui.internal.editors.text.OverlayPreferenceStore.OverlayKey) ArrayList(java.util.ArrayList) AnnotationPreference(org.eclipse.ui.texteditor.AnnotationPreference)

Example 24 with AnnotationPreference

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

the class LinkedModeConfigurationBlock method createOverlayStoreKeys.

private OverlayPreferenceStore.OverlayKey[] createOverlayStoreKeys(MarkerAnnotationPreferences preferences) {
    ArrayList<OverlayKey> overlayKeys = new ArrayList<>();
    Iterator<AnnotationPreference> e = preferences.getAnnotationPreferences().iterator();
    while (e.hasNext()) {
        AnnotationPreference info = e.next();
        if (isLinkedModeAnnotation(info)) {
            overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, info.getColorPreferenceKey()));
            overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, info.getTextPreferenceKey()));
            overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, info.getTextStylePreferenceKey()));
            overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, info.getHighlightPreferenceKey()));
        }
    }
    OverlayPreferenceStore.OverlayKey[] keys = new OverlayPreferenceStore.OverlayKey[overlayKeys.size()];
    overlayKeys.toArray(keys);
    return keys;
}
Also used : OverlayKey(org.eclipse.ui.internal.editors.text.OverlayPreferenceStore.OverlayKey) OverlayKey(org.eclipse.ui.internal.editors.text.OverlayPreferenceStore.OverlayKey) ArrayList(java.util.ArrayList) AnnotationPreference(org.eclipse.ui.texteditor.AnnotationPreference)

Example 25 with AnnotationPreference

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

the class LinkedModeConfigurationBlock method createAnnotationTypeListModel.

private ListItem[] createAnnotationTypeListModel(MarkerAnnotationPreferences preferences) {
    ArrayList<ListItem> listModelItems = new ArrayList<>();
    Iterator<AnnotationPreference> e = preferences.getAnnotationPreferences().iterator();
    while (e.hasNext()) {
        AnnotationPreference info = e.next();
        if (isLinkedModeAnnotation(info)) {
            String label = info.getPreferenceLabel();
            List<String[]> styles = getStyles(info.getAnnotationType());
            listModelItems.add(new ListItem(label, info.getColorPreferenceKey(), info.getTextPreferenceKey(), info.getHighlightPreferenceKey(), info.getTextStylePreferenceKey(), styles));
        }
    }
    ListItem[] items = new ListItem[listModelItems.size()];
    listModelItems.toArray(items);
    return items;
}
Also used : ArrayList(java.util.ArrayList) AnnotationPreference(org.eclipse.ui.texteditor.AnnotationPreference)

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