use of org.eclipse.ui.texteditor.AnnotationPreference in project eclipse.platform.text by eclipse.
the class QuickDiffConfigurationBlock method createQuickDiffModel.
private String[][] createQuickDiffModel(MarkerAnnotationPreferences preferences) {
String[][] items = new String[3][];
Iterator<AnnotationPreference> e = preferences.getAnnotationPreferences().iterator();
while (e.hasNext()) {
AnnotationPreference info = e.next();
if (// $NON-NLS-1$
info.getAnnotationType().equals("org.eclipse.ui.workbench.texteditor.quickdiffChange"))
items[0] = new String[] { info.getColorPreferenceKey(), info.getOverviewRulerPreferenceKey(), TextEditorMessages.QuickDiffConfigurationBlock_changeColor };
else if (// $NON-NLS-1$
info.getAnnotationType().equals("org.eclipse.ui.workbench.texteditor.quickdiffAddition"))
items[1] = new String[] { info.getColorPreferenceKey(), info.getOverviewRulerPreferenceKey(), TextEditorMessages.QuickDiffConfigurationBlock_additionColor };
else if (// $NON-NLS-1$
info.getAnnotationType().equals("org.eclipse.ui.workbench.texteditor.quickdiffDeletion"))
items[2] = new String[] { info.getColorPreferenceKey(), info.getOverviewRulerPreferenceKey(), TextEditorMessages.QuickDiffConfigurationBlock_deletionColor };
}
return items;
}
use of org.eclipse.ui.texteditor.AnnotationPreference in project eclipse.platform.text by eclipse.
the class AnnotationHoverDelegate method getDelegate.
private DefaultTextHover getDelegate(ISourceViewer sourceViewer) {
if (this.delegate == null || this.viewer != sourceViewer) {
this.delegate = new DefaultTextHover(sourceViewer) {
@Override
protected boolean isIncluded(Annotation annotation) {
if (annotation instanceof MarkerAnnotation) {
// this is handled by MarkerAnnotationHover
return false;
}
AnnotationPreference preference = EditorsUI.getAnnotationPreferenceLookup().getAnnotationPreference(annotation);
if (preference == null)
return false;
String key = preference.getTextPreferenceKey();
if (key != null) {
if (!EditorsUI.getPreferenceStore().getBoolean(key))
return false;
} else {
key = preference.getHighlightPreferenceKey();
if (key == null || !EditorsUI.getPreferenceStore().getBoolean(key))
return false;
}
return true;
}
};
this.viewer = sourceViewer;
}
return this.delegate;
}
use of org.eclipse.ui.texteditor.AnnotationPreference in project eclipse.platform.text by eclipse.
the class MarkerAnnotationHover method isIncluded.
protected static boolean isIncluded(Annotation annotation) {
if (!(annotation instanceof MarkerAnnotation)) {
return false;
}
AnnotationPreference preference = EditorsUI.getAnnotationPreferenceLookup().getAnnotationPreference(annotation);
if (preference == null) {
return false;
}
String key = preference.getTextPreferenceKey();
if (key != null) {
if (!EditorsUI.getPreferenceStore().getBoolean(key))
return false;
} else {
key = preference.getHighlightPreferenceKey();
if (key == null || !EditorsUI.getPreferenceStore().getBoolean(key))
return false;
}
return true;
}
use of org.eclipse.ui.texteditor.AnnotationPreference in project eclipse.platform.text by eclipse.
the class DelegatingAnnotationPreference method getAttributeValue.
private Object getAttributeValue(Object attribute) {
if (!isCached(attribute)) {
AnnotationPreference preference = getDefiningPreference(attribute);
if (preference != null)
setValue(attribute, preference.getValue(attribute));
markCached(attribute);
}
return super.getValue(attribute);
}
use of org.eclipse.ui.texteditor.AnnotationPreference in project eclipse.platform.text by eclipse.
the class DelegatingAnnotationPreference method getDefiningPreference.
private AnnotationPreference getDefiningPreference(Object attribute) {
AnnotationPreference p = fLookup.getAnnotationPreferenceFragment(fType.getType());
if (p != null && p.hasValue(attribute))
return p;
String[] superTypes = fType.getSuperTypes();
for (int i = 0; i < superTypes.length; i++) {
p = fLookup.getAnnotationPreferenceFragment(superTypes[i]);
if (p != null && p.hasValue(attribute))
return p;
}
return null;
}
Aggregations