public void addAnnotation(Annotation annotation, Position position) { if(delegate != null) { delegate.addAnnotation(annotation, position); } }
@Override public void endCollecting() { synchronized (fLockObject) { for (Entry<SpellingAnnotation, Position> entry : fAddAnnotations.entrySet()) { fAnnotationModel.addAnnotation(entry.getKey(), entry.getValue()); } deleteNonstringSpellingAnnotations(fAddAnnotations.keySet().iterator()); } fAddAnnotations = null; } }
private void addAnnotations(Map<Annotation, Position> annotationToPositionMap) { if (fModel instanceof IAnnotationModelExtension) { IAnnotationModelExtension ame= (IAnnotationModelExtension) fModel; ame.replaceAnnotations(new Annotation[0], annotationToPositionMap); } else { Set<Entry<Annotation, Position>> entrySet = annotationToPositionMap.entrySet(); for (Entry<Annotation, Position> entry : entrySet) { fModel.addAnnotation(entry.getKey(), entry.getValue()); } } }
private void addAnnotations(IAnnotationModel model, Map annotationToPositionMap) { if (model instanceof IAnnotationModelExtension) { IAnnotationModelExtension ame= (IAnnotationModelExtension) model; ame.replaceAnnotations(new Annotation[0], annotationToPositionMap); } else { for (Iterator elements= annotationToPositionMap.keySet().iterator(); elements.hasNext();) { Annotation element= (Annotation) elements.next(); Position p= (Position) annotationToPositionMap.get(element); model.addAnnotation(element, p); } } }
private void addAnnotations(Map annotationToPositionMap) { if (fModel instanceof IAnnotationModelExtension) { IAnnotationModelExtension ame= (IAnnotationModelExtension) fModel; ame.replaceAnnotations(new Annotation[0], annotationToPositionMap); } else { for (Iterator elements= annotationToPositionMap.keySet().iterator(); elements.hasNext();) { Annotation element= (Annotation) elements.next(); Position p= (Position) annotationToPositionMap.get(element); fModel.addAnnotation(element, p); } } }
private void addAnnotations(IAnnotationModel model, Map<Annotation, Position> annotationToPositionMap) { if (model instanceof IAnnotationModelExtension) { IAnnotationModelExtension ame= (IAnnotationModelExtension) model; ame.replaceAnnotations(new Annotation[0], annotationToPositionMap); } else { for (Entry<Annotation, Position> entry : annotationToPositionMap.entrySet()) { model.addAnnotation(entry.getKey(), entry.getValue()); } } }
private void updateAnnotations(IAnnotationModel annotationModel, Map<Annotation, Position> annotationMap) { if (annotationModel instanceof IAnnotationModelExtension) { ((IAnnotationModelExtension) annotationModel).replaceAnnotations(fOccurrenceAnnotations, annotationMap); } else { removeOccurrenceAnnotations(); Iterator<Map.Entry<Annotation, Position>> iter = annotationMap.entrySet().iterator(); while (iter.hasNext()) { Entry<Annotation, Position> mapEntry = iter.next(); annotationModel.addAnnotation(mapEntry.getKey(), mapEntry.getValue()); } } fOccurrenceAnnotations = annotationMap.keySet().toArray(new Annotation[annotationMap.keySet().size()]); } }
protected void updateAnnotations(IProgressMonitor monitor, List<Annotation> toBeRemoved, Map<Annotation, Position> annotationToPosition) { if (monitor.isCanceled()) { return; } if (annotationModel instanceof IAnnotationModelExtension) { Annotation[] removedAnnotations = toBeRemoved.toArray(new Annotation[toBeRemoved.size()]); ((IAnnotationModelExtension) annotationModel).replaceAnnotations(removedAnnotations, annotationToPosition); } else { for (Annotation annotation : toBeRemoved) { if (monitor.isCanceled()) { return; } annotationModel.removeAnnotation(annotation); } for (Map.Entry<Annotation, Position> entry : annotationToPosition.entrySet()) { if (monitor.isCanceled()) { return; } annotationModel.addAnnotation(entry.getKey(), entry.getValue()); } } }
private void addAnnotations(Map<Annotation, Position> annotationToPositionMap) { IAnnotationModel model = getDocumentProvider().getAnnotationModel(getEditorInput()); for (Annotation a : annotationToPositionMap.keySet()) { Position p = annotationToPositionMap.get(a); model.addAnnotation(a, p); } }
public void endDocument() throws SAXException { // ORDER DEPENDENCY: do this first if (annotationModel != null) { for (Map.Entry<Annotation, Position> a : annotationToPosition.entrySet()) { annotationModel.addAnnotation(a.getKey(), a.getValue()); } } // bug# 236787 trim trailing whitespace and adjust style ranges. trimTrailingWhitespace(); text = out.toString(); presentation.replaceStyleRanges(styleRanges.toArray(new StyleRange[styleRanges.size()])); if (annotationModel != null) { String idPrefix = IdAnnotation.class.getPackage().getName(); Iterator<?> annotationIterator = annotationModel.getAnnotationIterator(); while (annotationIterator.hasNext()) { Annotation annotation = (Annotation) annotationIterator.next(); if (annotation.getType().startsWith(idPrefix) && !annotationToPosition.containsKey(annotation)) { annotationIterator.remove(); } } } state.clear(); }
public void endCollecting() { List toRemove= new ArrayList(); synchronized (fLockObject) { Iterator iter= fAnnotationModel.getAnnotationIterator(); while (iter.hasNext()) { Annotation annotation= (Annotation)iter.next(); if (SpellingAnnotation.TYPE.equals(annotation.getType())) toRemove.add(annotation); } Annotation[] annotationsToRemove= (Annotation[])toRemove.toArray(new Annotation[toRemove.size()]); if (fAnnotationModel instanceof IAnnotationModelExtension) ((IAnnotationModelExtension)fAnnotationModel).replaceAnnotations(annotationsToRemove, fAddAnnotations); else { for (int i= 0; i < annotationsToRemove.length; i++) fAnnotationModel.removeAnnotation(annotationsToRemove[i]); for (iter= fAddAnnotations.keySet().iterator(); iter.hasNext();) { Annotation annotation= (Annotation)iter.next(); fAnnotationModel.addAnnotation(annotation, (Position)fAddAnnotations.get(annotation)); } } } fAddAnnotations= null; } }
@Override public void endCollecting() { List<Annotation> toRemove= new ArrayList<>(); synchronized (fLockObject) { Iterator<Annotation> iter= fAnnotationModel.getAnnotationIterator(); while (iter.hasNext()) { Annotation annotation= iter.next(); if (SpellingAnnotation.TYPE.equals(annotation.getType())) toRemove.add(annotation); } Annotation[] annotationsToRemove= toRemove.toArray(new Annotation[toRemove.size()]); if (fAnnotationModel instanceof IAnnotationModelExtension) ((IAnnotationModelExtension)fAnnotationModel).replaceAnnotations(annotationsToRemove, fAddAnnotations); else { for (Annotation element : annotationsToRemove) { fAnnotationModel.removeAnnotation(element); } for (Entry<Annotation, Position> entry : fAddAnnotations.entrySet()) { fAnnotationModel.addAnnotation(entry.getKey(), entry.getValue()); } } } fAddAnnotations= null; } }
@Override public void endCollecting() { List<Annotation> toRemove= new ArrayList<>(); synchronized (fLockObject) { Iterator<Annotation> iter= fAnnotationModel.getAnnotationIterator(); while (iter.hasNext()) { Annotation annotation= iter.next(); if (SpellingAnnotation.TYPE.equals(annotation.getType())) toRemove.add(annotation); } Annotation[] annotationsToRemove= toRemove.toArray(new Annotation[toRemove.size()]); if (fAnnotationModel instanceof IAnnotationModelExtension) ((IAnnotationModelExtension)fAnnotationModel).replaceAnnotations(annotationsToRemove, fAddAnnotations); else { for (int i= 0; i < annotationsToRemove.length; i++) fAnnotationModel.removeAnnotation(annotationsToRemove[i]); for (iter= fAddAnnotations.keySet().iterator(); iter.hasNext();) { Annotation annotation= iter.next(); fAnnotationModel.addAnnotation(annotation, fAddAnnotations.get(annotation)); } } } fAddAnnotations= null; } }
protected void announceAnnotationChanged(Annotation annotation) { if (annotationModel instanceof XtextResourceMarkerAnnotationModel) ((XtextResourceMarkerAnnotationModel) annotationModel).fireAnnotationChangedEvent(annotation); else { Position position = annotationModel.getPosition(annotation); if (annotationModel instanceof IAnnotationModelExtension) ((IAnnotationModelExtension) annotationModel).modifyAnnotationPosition(annotation, position); else { annotationModel.removeAnnotation(annotation); annotationModel.addAnnotation(annotation, position); } } }
private void calculateLightBulb(IAnnotationModel model, IInvocationContext context) { boolean needsAnnotation= JavaCorrectionProcessor.hasAssists(context); if (fIsAnnotationShown) { model.removeAnnotation(fAnnotation); } if (needsAnnotation) { model.addAnnotation(fAnnotation, new Position(context.getSelectionOffset(), context.getSelectionLength())); } fIsAnnotationShown= needsAnnotation; }
if (isCanceled(monitor)) return; visualAnnotationModel.addAnnotation(bag, position);
private void calculateLightBulb(IAnnotationModel model, IInvocationContext context) { boolean needsAnnotation= JavaCorrectionProcessor.hasAssists(context); if (fIsAnnotationShown) { model.removeAnnotation(fAnnotation); } if (needsAnnotation) { model.addAnnotation(fAnnotation, new Position(context.getSelectionOffset(), context.getSelectionLength())); } fIsAnnotationShown= needsAnnotation; }
private void calculateLightBulb(IAnnotationModel model, IInvocationContext context) { boolean needsAnnotation= JavaCorrectionProcessor.hasAssists(context); if (fIsAnnotationShown) { model.removeAnnotation(fAnnotation); } if (needsAnnotation) { model.addAnnotation(fAnnotation, new Position(context.getSelectionOffset(), context.getSelectionLength())); } fIsAnnotationShown= needsAnnotation; }
if (isCanceled(monitor)) return; visualAnnotationModel.addAnnotation(bag, position);
while (iter.hasNext()) { Entry<Annotation, Position> mapEntry= iter.next(); annotationModel.addAnnotation(mapEntry.getKey(), mapEntry.getValue());