use of org.eclipse.jface.text.source.IAnnotationAccessExtension in project eclipse.platform.text by eclipse.
the class SelectMarkerRulerAction method chooseMarker.
/**
* Chooses the marker with the highest layer. If there are multiple
* markers at the found layer, the first marker is taken.
*
* @param markers the list of markers to choose from
* @return the chosen marker or <code>null</code> if none of the given markers has a marker annotation in the model
*/
protected final IMarker chooseMarker(List<? extends IMarker> markers) {
AbstractMarkerAnnotationModel model = getAnnotationModel();
IAnnotationAccessExtension access = getAnnotationAccessExtension();
IMarker marker = null;
int maxLayer = 0;
Iterator<? extends IMarker> iter = markers.iterator();
while (iter.hasNext()) {
IMarker m = iter.next();
Annotation a = model.getMarkerAnnotation(m);
if (a != null) {
if (access == null) {
marker = m;
break;
}
int l = access.getLayer(a);
if (l == maxLayer) {
if (marker == null)
marker = m;
} else if (l > maxLayer) {
maxLayer = l;
marker = m;
}
}
}
return marker;
}
use of org.eclipse.jface.text.source.IAnnotationAccessExtension in project eclipse.platform.text by eclipse.
the class ProjectionSummary method findBagForType.
private AnnotationBag findBagForType(Map<String, AnnotationBag> bagMap, String annotationType) {
AnnotationBag bag = bagMap.get(annotationType);
if (bag == null && fAnnotationAccess instanceof IAnnotationAccessExtension) {
IAnnotationAccessExtension extension = (IAnnotationAccessExtension) fAnnotationAccess;
Object[] superTypes = extension.getSupertypes(annotationType);
for (int i = 0; i < superTypes.length && bag == null; i++) {
bag = bagMap.get(superTypes[i]);
}
}
return bag;
}
Aggregations