Search in sources :

Example 31 with AnnotationPreference

use of org.eclipse.ui.texteditor.AnnotationPreference in project statecharts by Yakindu.

the class StyledTextXtextAdapter method configureSourceViewerDecorationSupport.

/**
 * Creates decoration support for the sourceViewer. code is entirely copied from
 * {@link XtextEditor} and its super class {@link AbstractDecoratedTextEditor}.
 */
protected void configureSourceViewerDecorationSupport(SourceViewerDecorationSupport support) {
    MarkerAnnotationPreferences annotationPreferences = new MarkerAnnotationPreferences();
    List<AnnotationPreference> prefs = annotationPreferences.getAnnotationPreferences();
    for (AnnotationPreference annotationPreference : prefs) {
        support.setAnnotationPreference(annotationPreference);
    }
    support.setCharacterPairMatcher(getCharacterPairMatcher());
    support.setMatchingCharacterPainterPreferenceKeys(BracketMatchingPreferencesInitializer.IS_ACTIVE_KEY, BracketMatchingPreferencesInitializer.COLOR_KEY);
    support.install(getPreferenceStoreAccess().getPreferenceStore());
}
Also used : MarkerAnnotationPreferences(org.eclipse.ui.texteditor.MarkerAnnotationPreferences) AnnotationPreference(org.eclipse.ui.texteditor.AnnotationPreference)

Example 32 with AnnotationPreference

use of org.eclipse.ui.texteditor.AnnotationPreference in project erlide_eclipse by erlang.

the class AnnotationSupport method isNavigationTarget.

/**
 * Returns whether the given annotation is configured as a target for the "Go to
 * Next/Previous Annotation" actions
 *
 * @param annotation
 *            the annotation
 * @return <code>true</code> if this is a target, <code>false</code> otherwise
 * @since 3.0
 */
public boolean isNavigationTarget(final Annotation annotation) {
    final IPreferenceStore preferences = EditorsUI.getPreferenceStore();
    final AnnotationPreference preference = annotationPreferenceLookup.getAnnotationPreference(annotation);
    final String key = preference == null ? null : preference.getIsGoToNextNavigationTargetKey();
    return key != null && preferences.getBoolean(key);
}
Also used : IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore) 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