use of org.eclipse.wst.sse.ui.internal.ITemporaryAnnotation in project webtools.sourceediting by eclipse.
the class AnnotationHoverProcessor method getHoverInfo.
public String getHoverInfo(ITextViewer viewer, IRegion hoverRegion) {
IAnnotationModel model = ((SourceViewer) viewer).getAnnotationModel();
if (model != null) {
List messages = new ArrayList();
Iterator e = model.getAnnotationIterator();
while (e.hasNext()) {
Annotation a = (Annotation) e.next();
if (!isAnnotationValid(a))
continue;
Position p = model.getPosition(a);
// concerned with
if (p.overlapsWith(hoverRegion.getOffset(), hoverRegion.getLength())) {
String msg = a.getText();
if ((msg != null) && msg.trim().length() > 0) {
// dups
if (a instanceof ITemporaryAnnotation) {
boolean duplicated = false;
int j = 0;
while (j < messages.size() && !duplicated) {
duplicated = messages.get(j).equals(msg);
++j;
}
if (!duplicated) {
messages.add(msg);
}
} else {
messages.add(msg);
}
}
}
}
if (messages.size() > 1) {
return formatMessages(messages);
} else if (messages.size() > 0) {
return formatMessage(messages.get(0).toString());
}
}
return null;
}
use of org.eclipse.wst.sse.ui.internal.ITemporaryAnnotation in project webtools.sourceediting by eclipse.
the class AbstractStructuredTextReconcilingStrategy method getAllAnnotationsToRemove.
/**
* Remove ALL temporary annotations that this strategy can handle.
*/
protected TemporaryAnnotation[] getAllAnnotationsToRemove() {
List removals = new ArrayList();
IAnnotationModel annotationModel = getAnnotationModel();
if (annotationModel != null) {
Iterator i = annotationModel.getAnnotationIterator();
while (i.hasNext()) {
Object obj = i.next();
if (!(obj instanceof ITemporaryAnnotation))
continue;
ITemporaryAnnotation annotation = (ITemporaryAnnotation) obj;
ReconcileAnnotationKey key = (ReconcileAnnotationKey) annotation.getKey();
// partition type
if (canHandlePartition(key.getPartitionType()))
/*
* &&
* containsStep(key.getStep())
*/
removals.add(annotation);
}
}
return (TemporaryAnnotation[]) removals.toArray(new TemporaryAnnotation[removals.size()]);
}
Aggregations