IAnnotationModel annotationModel= documentProvider.getAnnotationModel(getEditorInput()); if (annotationModel == null) return Status.CANCEL_STATUS;   int length= fPositions.length; Map annotationMap= new HashMap(length); for (int i= 0; i < length; i++) {  if (isCancelled()) return Status.CANCEL_STATUS;  String message; Position position= fPositions[i];   try { message= document.get(position.offset, position.length); } catch (BadLocationException ex) {  continue;
if (isCanceled()) return Status.CANCEL_STATUS;  synchronized (getLockObject(annotationModel)) { if (annotationModel instanceof IAnnotationModelExtension) { ((IAnnotationModelExtension)annotationModel).replaceAnnotations(fOccurrenceAnnotations, annotationMap); } else { removeOccurrenceAnnotations(); Iterator iter= annotationMap.entrySet().iterator(); while (iter.hasNext()) { Map.Entry mapEntry= (Map.Entry)iter.next(); annotationModel.addAnnotation((Annotation)mapEntry.getKey(), (Position)mapEntry.getValue());
		public IStatus run(IProgressMonitor progressMonitor) {						fProgressMonitor= progressMonitor;						try {								if (isCancelled())					return Status.CANCEL_STATUS;								ITextViewer textViewer= getViewer(); 				if (textViewer == null)					return Status.CANCEL_STATUS;								IDocument document= textViewer.getDocument();				if (document == null)					return Status.CANCEL_STATUS;								IDocumentProvider documentProvider= getDocumentProvider();				if (documentProvider == null)					return Status.CANCEL_STATUS;							IAnnotationModel annotationModel= documentProvider.getAnnotationModel(getEditorInput());				if (annotationModel == null)					return Status.CANCEL_STATUS;								// Add occurrence annotations				int length= fPositions.length;				Map annotationMap= new HashMap(length);				for (int i= 0; i < length; i++) {										if (isCancelled())						return Status.CANCEL_STATUS; 										String message;					Position position= fPositions[i];										// Create & add annotation					try {						message= document.get(position.offset, position.length);					} catch (BadLocationException ex) {						// Skip this match						continue;					}					annotationMap.put(							new Annotation("org.eclipse.jdt.ui.occurrences", false, message), //$NON-NLS-1$							position);				}								if (isCancelled())					return Status.CANCEL_STATUS;								synchronized (getLockObject(annotationModel)) {					if (annotationModel instanceof IAnnotationModelExtension) {						((IAnnotationModelExtension)annotationModel).replaceAnnotations(fOccurrenceAnnotations, annotationMap);					} else {						removeOccurrenceAnnotations();						Iterator iter= annotationMap.entrySet().iterator();						while (iter.hasNext()) {							Map.Entry mapEntry= (Map.Entry)iter.next(); 							annotationModel.addAnnotation((Annotation)mapEntry.getKey(), (Position)mapEntry.getValue());						}					}					fOccurrenceAnnotations= (Annotation[])annotationMap.keySet().toArray(new Annotation[annotationMap.keySet().size()]);				}			} finally {				fDocument.removeDocumentListener(this);			}			return Status.OK_STATUS;		}