public Iterator getAnnotationIterator() { if(delegate != null) { return delegate.getAnnotationIterator(); } else { return null; } }
/** * Creates a new filter iterator with the given specification. * * @param annotationType the annotation type * @param style the style */ public FilterIterator(Object annotationType, int style) { fType= annotationType; fStyle= style; if (fModel != null) { fIterator= fModel.getAnnotationIterator(); skip(); } }
/** * Creates a new filter iterator with the given specification. * * @param annotationType the annotation type * @param style the style */ public FilterIterator(Object annotationType, int style) { fType= annotationType; fStyle= style; if (fModel != null) { fIterator= fModel.getAnnotationIterator(); skip(); } }
/** * Returns a new JavaAnnotationIterator. * @param model the annotation model * @param skipIrrelevants whether to skip irrelevant annotations * @param returnAllAnnotations Whether to return non IJavaAnnotations as well */ public JavaAnnotationIterator(IAnnotationModel model, boolean skipIrrelevants, boolean returnAllAnnotations) { fReturnAllAnnotations= returnAllAnnotations; if (model != null) fIterator= model.getAnnotationIterator(); else fIterator= Collections.EMPTY_LIST.iterator(); fSkipIrrelevants= skipIrrelevants; skip(); }
@SuppressWarnings("unchecked") protected Annotation[] getExistingOccurrenceAnnotations(IAnnotationModel annotationModel) { Set<Annotation> removeSet = newHashSet(); for (Iterator<Annotation> annotationIter = annotationModel.getAnnotationIterator(); annotationIter .hasNext();) { Annotation annotation = annotationIter.next(); if (occurrenceComputer.hasAnnotationType(annotation.getType())) { removeSet.add(annotation); } } return toArray(removeSet, Annotation.class); } }
private int getPortableFlagFromNode(Node node, IAnnotationModel model, IDocument document) throws CoreException { int info = 0; if (model != null) { Iterator iter = model.getAnnotationIterator(); while ((info != SQLImageDescriptor.PORTABLE) && iter.hasNext()) { Annotation curr = (Annotation) iter.next(); IMarker marker = isAnnotationInRange(model, curr, node, document, IMarker.TASK); if (marker != null) { info = SQLImageDescriptor.PORTABLE; } } } return info; }
private void cacheAnnotations() { fCachedAnnotations.clear(); if (fModel != null) { Iterator<Annotation> iter= fModel.getAnnotationIterator(); while (iter.hasNext()) { Annotation annotation= iter.next(); if (annotation.isMarkedDeleted()) continue; if (skip(annotation.getType())) continue; fCachedAnnotations.add(annotation); } } }
private void cacheAnnotations() { fCachedAnnotations.clear(); if (fModel != null) { Iterator<Annotation> iter= fModel.getAnnotationIterator(); while (iter.hasNext()) { Annotation annotation= iter.next(); if (annotation.isMarkedDeleted()) continue; if (skip(annotation.getType())) continue; fCachedAnnotations.add(annotation); } } }
private int getErrorTicksFromAnnotationModel(IAnnotationModel model, ISourceReference sourceElement) throws CoreException { int info= 0; int priority= -1; Iterator<Annotation> iter= model.getAnnotationIterator(); while ((info != ERRORTICK_ERROR) && iter.hasNext()) { Annotation annot= iter.next(); IMarker marker= isAnnotationInRange(model, annot, sourceElement); if (marker != null) { priority= Math.max(priority, marker.getAttribute(IMarker.SEVERITY, -1)); if (priority == IMarker.SEVERITY_INFO) { info= ERRORTICK_INFO; } else if (priority == IMarker.SEVERITY_WARNING) { info= ERRORTICK_WARNING; } else if (priority == IMarker.SEVERITY_ERROR) { info= ERRORTICK_ERROR; } } } return info; }
protected List<IMarker> getMarkersFor(ISourceViewer sourceViewer, int lineOffset, int lineLength) { List<IMarker> result = new ArrayList<>(); IAnnotationModel annotationModel = sourceViewer.getAnnotationModel(); Iterator annotationIter = annotationModel.getAnnotationIterator(); while (annotationIter.hasNext()) { Object annotation = annotationIter.next(); if (annotation instanceof MarkerAnnotation) { MarkerAnnotation markerAnnotation = (MarkerAnnotation) annotation; IMarker marker = markerAnnotation.getMarker(); Position markerPosition = annotationModel.getPosition(markerAnnotation); if (markerPosition != null && markerPosition.overlapsWith(lineOffset, lineLength)) { result.add(marker); } } } return result; }
private List<ICompletionProposal> computeProposals(IQuickAssistInvocationContext context, IAnnotationModel model) { int offset= context.getOffset(); ArrayList<SpellingProblem> annotationList= new ArrayList<>(); Iterator<Annotation> iter= model.getAnnotationIterator(); while (iter.hasNext()) { Annotation annotation= iter.next(); if (canFix(annotation)) { Position pos= model.getPosition(annotation); if (isAtPosition(offset, pos)) { collectSpellingProblems(annotation, annotationList); } } } SpellingProblem[] spellingProblems= annotationList.toArray(new SpellingProblem[annotationList.size()]); return computeProposals(context, spellingProblems); }
private List computeProposals(IQuickAssistInvocationContext context, IAnnotationModel model) { int offset= context.getOffset(); ArrayList annotationList= new ArrayList(); Iterator iter= model.getAnnotationIterator(); while (iter.hasNext()) { Annotation annotation= (Annotation)iter.next(); if (canFix(annotation)) { Position pos= model.getPosition(annotation); if (isAtPosition(offset, pos)) { collectSpellingProblems(annotation, pos, annotationList); } } } SpellingProblem[] spellingProblems= (SpellingProblem[]) annotationList.toArray(new SpellingProblem[annotationList.size()]); return computeProposals(context, spellingProblems); }
private List<ICompletionProposal> computeProposals(IQuickAssistInvocationContext context, IAnnotationModel model) { int offset= context.getOffset(); ArrayList<SpellingProblem> annotationList= new ArrayList<>(); Iterator<Annotation> iter= model.getAnnotationIterator(); while (iter.hasNext()) { Annotation annotation= iter.next(); if (canFix(annotation)) { Position pos= model.getPosition(annotation); if (isAtPosition(offset, pos)) { collectSpellingProblems(annotation, annotationList); } } } SpellingProblem[] spellingProblems= annotationList.toArray(new SpellingProblem[annotationList.size()]); return computeProposals(context, spellingProblems); }
private String getAnnotationModelHoverMessage(IAnnotationModel model, IRegion hoverRegion) { Iterator<Annotation> e = model.getAnnotationIterator(); while (e.hasNext()) { Annotation a = e.next(); if (a instanceof XMLProblemAnnotation) { Position p = model.getPosition(a); if (p.overlapsWith(hoverRegion.getOffset(), hoverRegion.getLength())) { String msg = a.getText(); if (msg != null && msg.trim().length() > 0) { return formatMessage(msg); } } } } return null; }
private boolean containsRelevantMarkers(IEditorPart editor) { IAnnotationModel model= JavaUI.getDocumentProvider().getAnnotationModel(editor.getEditorInput()); Iterator<Annotation> iterator= model.getAnnotationIterator(); while (iterator.hasNext()) { Annotation element= iterator.next(); if (element instanceof IJavaAnnotation) { IJavaAnnotation annot= (IJavaAnnotation) element; if (!annot.isMarkedDeleted() && annot.isPersistent() && !annot.isProblem()) return true; } } return false; }
private boolean containsRelevantMarkers(IEditorPart editor) { IAnnotationModel model= JavaUI.getDocumentProvider().getAnnotationModel(editor.getEditorInput()); Iterator iterator= model.getAnnotationIterator(); while (iterator.hasNext()) { Object element= iterator.next(); if (element instanceof IJavaAnnotation) { IJavaAnnotation annot= (IJavaAnnotation) element; if (!annot.isMarkedDeleted() && annot.isPersistent() && !annot.isProblem()) return true; } } return false; }
private boolean containsRelevantMarkers(IEditorPart editor) { IAnnotationModel model= JavaUI.getDocumentProvider().getAnnotationModel(editor.getEditorInput()); Iterator<Annotation> iterator= model.getAnnotationIterator(); while (iterator.hasNext()) { Annotation element= iterator.next(); if (element instanceof IJavaAnnotation) { IJavaAnnotation annot= (IJavaAnnotation) element; if (!annot.isMarkedDeleted() && annot.isPersistent() && !annot.isProblem()) return true; } } return false; }
private Node annotationFactory(StyledTextLine l) { //TODO Should use IAnnotationExtension2 @SuppressWarnings("unchecked") Iterator<Annotation> annotationIterator = this.fVisualAnnotationModel.getAnnotationIterator(); while( annotationIterator.hasNext() ) { Annotation a = annotationIterator.next(); Position position = this.fVisualAnnotationModel.getPosition(a); if( l.getLineIndex() == getTextWidget().getContent().getLineAtOffset(position.offset) ) { AnnotationPresenter annotationPresenter = this.presenterMap.get(a.getType()); if( annotationPresenter != null ) { return annotationPresenter.getPresentation(a); } return null; } } return null; }
/** * Deletes all the spelling annotations located inside the area marked by <code>region</code> */ private void deleteAllAnnotations(IRegion region) { IAnnotationModel model = getAnnotationModel(); if (model == null) return; Iterator<?> iter = model.getAnnotationIterator(); while (iter.hasNext()) { Annotation annotation = (Annotation) iter.next(); if (annotation instanceof SpellingAnnotation) { SpellingAnnotation spellingAnnotation = (SpellingAnnotation) annotation; Position position = model.getPosition(spellingAnnotation); if (position.overlapsWith(region.getOffset(), region.getLength())) { model.removeAnnotation(spellingAnnotation); } } } }
private String findSelectedOverviewRulerAnnotationLabel() { Point selection= getSourceViewer().getSelectedRange(); IAnnotationModel model= getSourceViewer().getAnnotationModel(); Annotation annotation= null; Iterator<Annotation> iter= model.getAnnotationIterator(); while (iter.hasNext()) { annotation= iter.next(); Position p= model.getPosition(annotation); if (p.getOffset() == selection.x && p.getLength() == selection.y) break; } if (annotation != null) { AnnotationPreference ap= getAnnotationPreferenceLookup().getAnnotationPreference(annotation); if (ap != null) return ap.getPreferenceLabel(); } return null; }