use of org.eclipse.ui.texteditor.AnnotationPreference in project webtools.sourceediting by eclipse.
the class GotoAnnotationAction 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
* @see Eclipse 3.0
*/
protected boolean isNavigationTarget(Annotation annotation) {
Preferences preferences = EditorsUI.getPluginPreferences();
AnnotationPreference preference = EditorsUI.getAnnotationPreferenceLookup().getAnnotationPreference(annotation);
// See bug 41689
// String key= forward ? preference.getIsGoToNextNavigationTargetKey()
// : preference.getIsGoToPreviousNavigationTargetKey();
String key = preference == null ? null : preference.getIsGoToNextNavigationTargetKey();
return (key != null && preferences.getBoolean(key));
}
use of org.eclipse.ui.texteditor.AnnotationPreference in project xtext-xtend by eclipse.
the class DerivedSourceView method createSourceViewer.
@Override
protected SourceViewer createSourceViewer(Composite parent) {
IPreferenceStore store = JavaPlugin.getDefault().getCombinedPreferenceStore();
IOverviewRuler overviewRuler = new OverviewRuler(defaultMarkerAnnotationAccess, OVERVIEW_RULER_WIDTH, getSharedTextColors());
AnnotationRulerColumn annotationRulerColumn = new AnnotationRulerColumn(VERTICAL_RULER_WIDTH, defaultMarkerAnnotationAccess);
List<AnnotationPreference> annotationPreferences = markerAnnotationPreferences.getAnnotationPreferences();
for (AnnotationPreference annotationPreference : annotationPreferences) {
String key = annotationPreference.getVerticalRulerPreferenceKey();
boolean showAnnotation = true;
if (key != null && store.contains(key)) {
showAnnotation = store.getBoolean(key);
}
if (showAnnotation) {
annotationRulerColumn.addAnnotationType(annotationPreference.getAnnotationType());
}
}
annotationRulerColumn.addAnnotationType(Annotation.TYPE_UNKNOWN);
lineNumberRulerColumn = new LineNumberRulerColumn();
CompositeRuler compositeRuler = new CompositeRuler();
compositeRuler.addDecorator(0, annotationRulerColumn);
compositeRuler.addDecorator(1, lineNumberRulerColumn);
javaSourceViewer = new JavaSourceViewer(parent, compositeRuler, overviewRuler, true, SWT.V_SCROLL | SWT.H_SCROLL, store);
javaSourceViewerConfiguration = new SimpleJavaSourceViewerConfiguration(JavaPlugin.getDefault().getJavaTextTools().getColorManager(), store, null, IJavaPartitions.JAVA_PARTITIONING, true) {
@Override
public IInformationControlCreator getInformationControlCreator(ISourceViewer sourceViewer) {
return new IInformationControlCreator() {
@Override
public IInformationControl createInformationControl(final Shell parent) {
return new DefaultInformationControl(parent, true);
}
};
}
@Override
public IAnnotationHover getAnnotationHover(ISourceViewer sourceViewer) {
return new DefaultAnnotationHover();
}
};
javaSourceViewer.configure(javaSourceViewerConfiguration);
javaSourceViewer.setEditable(false);
javaSourceViewer.showAnnotations(true);
sourceViewerDecorationSupport = new SourceViewerDecorationSupport(javaSourceViewer, overviewRuler, defaultMarkerAnnotationAccess, getSharedTextColors());
for (AnnotationPreference annotationPreference : annotationPreferences) {
sourceViewerDecorationSupport.setAnnotationPreference(annotationPreference);
}
sourceViewerDecorationSupport.install(preferenceStoreAccess.getPreferenceStore());
return javaSourceViewer;
}
use of org.eclipse.ui.texteditor.AnnotationPreference 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;
}
use of org.eclipse.ui.texteditor.AnnotationPreference in project eclipse.platform.text by eclipse.
the class AnnotationColumn method initialize.
/**
* Initializes the given line number ruler column from the preference store.
*/
private void initialize() {
if (fDelegate == null)
fDelegate = new AnnotationRulerColumn(VERTICAL_RULER_WIDTH, new DefaultMarkerAnnotationAccess());
IPreferenceStore store = getPreferenceStore();
if (store != null && fDelegate instanceof AnnotationRulerColumn) {
final AnnotationRulerColumn column = (AnnotationRulerColumn) fDelegate;
// initial set up
for (Iterator<AnnotationPreference> iter2 = fAnnotationPreferences.getAnnotationPreferences().iterator(); iter2.hasNext(); ) {
AnnotationPreference preference = iter2.next();
String key = preference.getVerticalRulerPreferenceKey();
boolean showAnnotation = true;
if (key != null && store.contains(key))
showAnnotation = store.getBoolean(key);
if (showAnnotation)
column.addAnnotationType(preference.getAnnotationType());
}
column.addAnnotationType(Annotation.TYPE_UNKNOWN);
// link to preference store
fPropertyListener = new IPropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent event) {
String property = event.getProperty();
AnnotationPreference annotationPreference = getVerticalRulerAnnotationPreference(property);
if (annotationPreference != null && property.equals(annotationPreference.getVerticalRulerPreferenceKey())) {
Object type = annotationPreference.getAnnotationType();
if (getPreferenceStore().getBoolean(property))
column.addAnnotationType(type);
else
column.removeAnnotationType(type);
column.redraw();
}
}
};
store.addPropertyChangeListener(fPropertyListener);
}
}
use of org.eclipse.ui.texteditor.AnnotationPreference in project eclipse.platform.text by eclipse.
the class DelegatingAnnotationPreference method getAnnotationImageProvider.
@Override
public IAnnotationImageProvider getAnnotationImageProvider() {
if (!isCached(IMAGE_PROVIDER)) {
AnnotationPreference preference = getDefiningPreference(IMAGE_PROVIDER);
if (preference != null) {
fAnnotationImageProvider = preference.fAnnotationImageProvider;
fAnnotationImageProviderAttribute = preference.fAnnotationImageProviderAttribute;
fConfigurationElement = preference.fConfigurationElement;
}
markCached(IMAGE_PROVIDER);
}
return super.getAnnotationImageProvider();
}
Aggregations