IAnnotationMap annotationMap= getAnnotationMap(); installMarkerUpdaters(); listenToMarkerChanges(false); for (Iterator<Annotation> e= getAnnotationIterator(false); e.hasNext();) { Object o= e.next(); if (o instanceof MarkerAnnotation) { IMarker marker= a.getMarker(); Position position= annotationMap.get(a); if ( !updateMarker(marker, document, position)) { if ( !fDeletedAnnotations.contains(a)) fDeletedAnnotations.add(a); removeAnnotations(fDeletedAnnotations, true, true); fDeletedAnnotations.clear(); listenToMarkerChanges(true);
@Override public void reinitialize(IDocument document) { resetMarkers(); } }
public void commit(IDocument document) throws CoreException { updateMarkers(document); }
/** * Creates an annotation for the given marker and adds it to this model. * Does nothing if the marker is not acceptable to this model. * * @param marker the marker * @see #isAcceptable(IMarker) */ protected final void addMarkerAnnotation(IMarker marker) { if (isAcceptable(marker)) { Position p= createPositionFromMarker(marker); if (p != null) try { MarkerAnnotation annotation= createMarkerAnnotation(marker); if (annotation != null) addAnnotation(annotation, p, false); } catch (BadLocationException e) { // ignore invalid position } } }
/** * Updates the given marker according to the given position in the given * document. If the given position is <code>null</code>, the marker is * assumed to carry the correct positional information. If it is detected * that the marker is invalid and should thus be deleted, this method * returns <code>false</code>. * * @param marker the marker to be updated * @param document the document into which the given position points * @param position the current position of the marker inside the given document * @return <code>false</code> if the marker is invalid * @throws CoreException if there is a problem updating the marker * @since 3.0 */ public boolean updateMarker(IDocument document, IMarker marker, Position position) throws CoreException { listenToMarkerChanges(false); try { return updateMarker(marker, document, position); } finally { listenToMarkerChanges(true); } }
/** * Re-populates this model with annotations for all markers retrieved * from the maker source via <code>retrieveMarkers</code>. * * @throws CoreException if there is a problem getting the markers */ private void catchupWithMarkers() throws CoreException { for (Iterator e=getAnnotationIterator(false); e.hasNext();) { Annotation a= (Annotation) e.next(); if (a instanceof MarkerAnnotation) removeAnnotation(a, false); } IMarker[] markers= retrieveMarkers(); if (markers != null) { for (int i= 0; i < markers.length; i++) addMarkerAnnotation(markers[i]); } }
return; Iterator<?> iter = model.getAnnotationIterator(); int layer = Integer.MIN_VALUE; continue; Position position = model.getPosition(annotation); if (!includesRulerLine(position, document)) continue;
for (Iterator e= getAnnotationIterator(false); e.hasNext();) { Object o= e.next(); if (o instanceof MarkerAnnotation) { MarkerAnnotation a= (MarkerAnnotation) o; Position p= createPositionFromMarker(a.getMarker()); if (p != null) { removeAnnotation(a, false); try { addAnnotation(a, p, false); } catch (BadLocationException e1) { if (o instanceof MarkerAnnotation) { MarkerAnnotation a= (MarkerAnnotation) o; Position p= createPositionFromMarker(a.getMarker()); if (p != null) try { addAnnotation(a, p, false); } catch (BadLocationException e1) { fireModelChanged();
model.updateMarkers(document); AbstractMarkerAnnotationModel model= (AbstractMarkerAnnotationModel) info.fModel; for (int i= 0; i < markers.length; i++) model.updateMarker(document, markers[i], null);
/** * Returns this model's annotation for the given marker. * * @param marker the marker * @return the annotation, or <code>null</code> if none */ public final MarkerAnnotation getMarkerAnnotation(IMarker marker) { Iterator e= getAnnotationIterator(false); while (e.hasNext()) { Object o= e.next(); if (o instanceof MarkerAnnotation) { MarkerAnnotation a= (MarkerAnnotation) o; if (marker.equals(a.getMarker())) { return a; } } } return null; }
/** * Returns all markers which include the ruler's line of activity. * * @return all a list of markers which include the ruler's line of activity */ protected List getMarkers() { List markers= new ArrayList(); IResource resource= getResource(); IDocument document= getDocument(); AbstractMarkerAnnotationModel model= getAnnotationModel(); if (resource != null && model != null && resource.exists()) { try { IMarker[] allMarkers= resource.findMarkers(fMarkerType, true, IResource.DEPTH_ZERO); if (allMarkers != null) { for (int i= 0; i < allMarkers.length; i++) { if (includesRulerLine(model.getMarkerPosition(allMarkers[i]), document)) { markers.add(allMarkers[i]); } } } } catch (CoreException x) { handleCoreException(x, TextEditorMessages.MarkerRulerAction_getMarker); } } return markers; }
try { IRegion line= document.getLineInformation(activeLine); it= model.getAnnotationIterator(line.getOffset(), line.getLength() + 1, true, true); } catch (BadLocationException e) { Bundle bundle= Platform.getBundle(PlatformUI.PLUGIN_ID); Platform.getLog(bundle).log(new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, IStatus.OK, e.getLocalizedMessage(), e)); it= model.getAnnotationIterator(); Annotation annotation= it.next(); if (annotation instanceof MarkerAnnotation) { Position position= model.getPosition(annotation); if (includesLine(position, document, activeLine)) { if (markers == null)
for (Iterator<Annotation> e= getAnnotationIterator(false); e.hasNext();) { Object o= e.next(); if (o instanceof MarkerAnnotation) { MarkerAnnotation a= (MarkerAnnotation) o; Position p= createPositionFromMarker(a.getMarker()); if (p != null) { removeAnnotation(a, false); try { addAnnotation(a, p, false); } catch (BadLocationException e1) { if (o instanceof MarkerAnnotation) { MarkerAnnotation a= (MarkerAnnotation) o; Position p= createPositionFromMarker(a.getMarker()); if (p != null) try { addAnnotation(a, p, false); } catch (BadLocationException e1) { fireModelChanged();
/** * Re-populates this model with annotations for all markers retrieved * from the maker source via <code>retrieveMarkers</code>. * * @throws CoreException if there is a problem getting the markers */ private void catchupWithMarkers() throws CoreException { for (Iterator<Annotation> e=getAnnotationIterator(false); e.hasNext();) { Annotation a= e.next(); if (a instanceof MarkerAnnotation) removeAnnotation(a, false); } IMarker[] markers= retrieveMarkers(); if (markers != null) { for (int i= 0; i < markers.length; i++) addMarkerAnnotation(markers[i]); } }
model.updateMarkers(document); AbstractMarkerAnnotationModel model= (AbstractMarkerAnnotationModel) info.fModel; for (int i= 0; i < markers.length; i++) model.updateMarker(document, markers[i], null);
/** * Returns this model's annotation for the given marker. * * @param marker the marker * @return the annotation, or <code>null</code> if none */ public final MarkerAnnotation getMarkerAnnotation(IMarker marker) { Iterator<Annotation> e= getAnnotationIterator(false); while (e.hasNext()) { Object o= e.next(); if (o instanceof MarkerAnnotation) { MarkerAnnotation a= (MarkerAnnotation) o; if (marker.equals(a.getMarker())) { return a; } } } return null; }
/** * Creates an annotation for the given marker and adds it to this model. * Does nothing if the marker is not acceptable to this model. * * @param marker the marker * @see #isAcceptable(IMarker) */ protected final void addMarkerAnnotation(IMarker marker) { if (isAcceptable(marker)) { Position p= createPositionFromMarker(marker); if (p != null) try { MarkerAnnotation annotation= createMarkerAnnotation(marker); if (annotation != null) addAnnotation(annotation, p, false); } catch (BadLocationException e) { // ignore invalid position } } }
/** * Updates the given marker according to the given position in the given * document. If the given position is <code>null</code>, the marker is * assumed to carry the correct positional information. If it is detected * that the marker is invalid and should thus be deleted, this method * returns <code>false</code>. * * @param marker the marker to be updated * @param document the document into which the given position points * @param position the current position of the marker inside the given document * @return <code>false</code> if the marker is invalid * @throws CoreException if there is a problem updating the marker * @since 3.0 */ public boolean updateMarker(IDocument document, IMarker marker, Position position) throws CoreException { listenToMarkerChanges(false); try { return updateMarker(marker, document, position); } finally { listenToMarkerChanges(true); } }
/** * Returns all markers which include the ruler's line of activity. * * @return all a list of markers which include the ruler's line of activity */ protected List<IMarker> getMarkers() { List<IMarker> markers= new ArrayList<>(); IResource resource= getResource(); IDocument document= getDocument(); AbstractMarkerAnnotationModel model= getAnnotationModel(); if (resource != null && model != null && resource.exists()) { try { IMarker[] allMarkers= resource.findMarkers(fMarkerType, true, IResource.DEPTH_ZERO); if (allMarkers != null) { for (int i= 0; i < allMarkers.length; i++) { if (includesRulerLine(model.getMarkerPosition(allMarkers[i]), document)) { markers.add(allMarkers[i]); } } } } catch (CoreException x) { handleCoreException(x, TextEditorMessages.MarkerRulerAction_getMarker); } } return markers; }
for (Iterator it= model.getAnnotationIterator(); it.hasNext();) { Annotation annotation= (Annotation) it.next(); if (annotation instanceof MarkerAnnotation) { Position position= model.getPosition(annotation); if (includesLine(position, document, activeLine)) { if (markers == null)