@Override public IAnnotationModel createAnnotationModel(IPath path) { IResource file= ResourcesPlugin.getWorkspace().getRoot().findMember(path); if (file instanceof IFile) return new CompilationUnitAnnotationModel(file); return new AnnotationModel(); }
synchronized (getLockObject()) { removeAnnotations(fGeneratedAnnotations, false, true); fGeneratedAnnotations.clear(); Position position= createPositionFromProblem(problem); if (position != null) { overlayMarkers(position, annotation); addAnnotation(annotation, position, false); fGeneratedAnnotations.add(annotation); removeMarkerOverlays(isCanceled); fPreviouslyOverlaid= null; fireModelChanged();
private void overlayMarkers(Position position, ProblemAnnotation problemAnnotation) { Object value= getAnnotations(position); if (value instanceof List) { List<?> list= (List<?>) value; for (Iterator<?> e = list.iterator(); e.hasNext();) setOverlay(e.next(), problemAnnotation); } else { setOverlay(value, problemAnnotation); } }
synchronized (getLockObject()) { removeAnnotations(fGeneratedAnnotations, false, true); fGeneratedAnnotations.clear(); Position position= createPositionFromProblem(problem); if (position != null) { overlayMarkers(position, annotation); addAnnotation(annotation, position, false); fGeneratedAnnotations.add(annotation); removeMarkerOverlays(isCanceled); fPreviouslyOverlaid= null; fireModelChanged();
synchronized (getLockObject()) { removeAnnotations(fGeneratedAnnotations, false, true); fGeneratedAnnotations.clear(); Position position= createPositionFromProblem(problem); if (position != null) { overlayMarkers(position, annotation); addAnnotation(annotation, position, false); fGeneratedAnnotations.add(annotation); removeMarkerOverlays(isCanceled); fPreviouslyOverlaid= null; fireModelChanged();
@Override protected void removeAnnotation(Annotation annotation, boolean fireModelChanged) { Position position= getPosition(annotation); synchronized (getLockObject()) { Object cached= fReverseMap.get(position); if (cached instanceof List) { @SuppressWarnings("unchecked") List<Object> list= (List<Object>) cached; list.remove(annotation); if (list.size() == 1) { fReverseMap.put(position, list.get(0)); list.clear(); } } else if (cached instanceof Annotation) { fReverseMap.remove(position); } } super.removeAnnotation(annotation, fireModelChanged); } }
@Override protected void addAnnotation(Annotation annotation, Position position, boolean fireModelChanged) throws BadLocationException { super.addAnnotation(annotation, position, fireModelChanged); synchronized (getLockObject()) { Object cached= fReverseMap.get(position); if (cached == null) fReverseMap.put(position, annotation); else if (cached instanceof List) { @SuppressWarnings("unchecked") List<Object> list= (List<Object>) cached; list.add(annotation); } else if (cached instanceof Annotation) { List<Object> list= new ArrayList<>(2); list.add(cached); list.add(annotation); fReverseMap.put(position, list); } } }
/** * Sets up the infrastructure necessary for problem reporting. * * @param insideReportingSequence <code>true</code> if this method * call is issued from inside a reporting sequence */ private void internalBeginReporting(boolean insideReportingSequence) { if (fCompilationUnit != null && fCompilationUnit.getJavaProject().isOnClasspath(fCompilationUnit)) { ProblemRequestorState state= new ProblemRequestorState(); state.fInsideReportingSequence= insideReportingSequence; state.fReportedProblems= new ArrayList<>(); synchronized (getLockObject()) { fProblemRequestorState.set(state); ++fStateCount; } } }
/** * Sets up the infrastructure necessary for problem reporting. * * @param insideReportingSequence <code>true</code> if this method * call is issued from inside a reporting sequence */ private void internalBeginReporting(boolean insideReportingSequence) { if (fCompilationUnit != null && fCompilationUnit.getJavaProject().isOnClasspath(fCompilationUnit)) { ProblemRequestorState state= new ProblemRequestorState(); state.fInsideReportingSequence= insideReportingSequence; state.fReportedProblems= new ArrayList(); synchronized (getLockObject()) { fProblemRequestorState.set(state); ++fStateCount; } } }
@Override protected void addAnnotation(Annotation annotation, Position position, boolean fireModelChanged) throws BadLocationException { super.addAnnotation(annotation, position, fireModelChanged); synchronized (getLockObject()) { Object cached= fReverseMap.get(position); if (cached == null) fReverseMap.put(position, annotation); else if (cached instanceof List) { @SuppressWarnings("unchecked") List<Object> list= (List<Object>) cached; list.add(annotation); } else if (cached instanceof Annotation) { List<Object> list= new ArrayList<>(2); list.add(cached); list.add(annotation); fReverseMap.put(position, list); } } }
@Override protected void removeAnnotation(Annotation annotation, boolean fireModelChanged) { Position position= getPosition(annotation); synchronized (getLockObject()) { Object cached= fReverseMap.get(position); if (cached instanceof List) { @SuppressWarnings("unchecked") List<Object> list= (List<Object>) cached; list.remove(annotation); if (list.size() == 1) { fReverseMap.put(position, list.get(0)); list.clear(); } } else if (cached instanceof Annotation) { fReverseMap.remove(position); } } super.removeAnnotation(annotation, fireModelChanged); } }
protected void addAnnotation(Annotation annotation, Position position, boolean fireModelChanged) throws BadLocationException { super.addAnnotation(annotation, position, fireModelChanged); synchronized (getLockObject()) { Object cached= fReverseMap.get(position); if (cached == null) fReverseMap.put(position, annotation); else if (cached instanceof List) { List list= (List) cached; list.add(annotation); } else if (cached instanceof Annotation) { List list= new ArrayList(2); list.add(cached); list.add(annotation); fReverseMap.put(position, list); } } }
protected void removeAnnotation(Annotation annotation, boolean fireModelChanged) { Position position= getPosition(annotation); synchronized (getLockObject()) { Object cached= fReverseMap.get(position); if (cached instanceof List) { List list= (List) cached; list.remove(annotation); if (list.size() == 1) { fReverseMap.put(position, list.get(0)); list.clear(); } } else if (cached instanceof Annotation) { fReverseMap.remove(position); } } super.removeAnnotation(annotation, fireModelChanged); } }
protected IAnnotationModel createAnnotationModel(IFile file) { return new CompilationUnitAnnotationModel(file); }
protected AnnotationModelEvent createAnnotationModelEvent() { return new CompilationUnitAnnotationModelEvent(this, getResource()); }
/** * Sets up the infrastructure necessary for problem reporting. * * @param insideReportingSequence <code>true</code> if this method * call is issued from inside a reporting sequence */ private void internalBeginReporting(boolean insideReportingSequence) { if (fCompilationUnit != null && fCompilationUnit.getJavaProject().isOnClasspath(fCompilationUnit)) { ProblemRequestorState state= new ProblemRequestorState(); state.fInsideReportingSequence= insideReportingSequence; state.fReportedProblems= new ArrayList<>(); synchronized (getLockObject()) { fProblemRequestorState.set(state); ++fStateCount; } } }
@Override protected AnnotationModelEvent createAnnotationModelEvent() { return new CompilationUnitAnnotationModelEvent(this, getResource()); }
@Override protected void removeAllAnnotations(boolean fireModelChanged) { super.removeAllAnnotations(fireModelChanged); synchronized (getLockObject()) { fReverseMap.clear(); } }
@Override public void endReporting() { ProblemRequestorState state= fProblemRequestorState.get(); if (state != null && !state.fInsideReportingSequence) internalEndReporting(state); }
private Object getAnnotations(Position position) { synchronized (getLockObject()) { return fReverseMap.get(position); } }