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); } } }
@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); } } }
synchronized (getLockObject()) {
synchronized (getLockObject()) {
@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); } } }
@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); } }
/** * 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; } } }
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); } }
/** * 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 removeAllAnnotations(boolean fireModelChanged) { super.removeAllAnnotations(fireModelChanged); synchronized (getLockObject()) { fReverseMap.clear(); } }
private Object getAnnotations(Position position) { synchronized (getLockObject()) { return fReverseMap.get(position); } }
private void internalEndReporting(ProblemRequestorState state) { int stateCount= 0; synchronized(getLockObject()) { -- fStateCount; stateCount= fStateCount; fProblemRequestorState.set(null); } if (stateCount == 0) reportProblems(state.fReportedProblems); }
private void internalEndReporting(ProblemRequestorState state) { int stateCount= 0; synchronized(getLockObject()) { -- fStateCount; stateCount= fStateCount; fProblemRequestorState.set(null); } if (stateCount == 0) reportProblems(state.fReportedProblems); }
private Object getAnnotations(Position position) { synchronized (getLockObject()) { return fReverseMap.get(position); } }
protected void removeAllAnnotations(boolean fireModelChanged) { super.removeAllAnnotations(fireModelChanged); synchronized (getLockObject()) { fReverseMap.clear(); } }
private Object getAnnotations(Position position) { synchronized (getLockObject()) { return fReverseMap.get(position); } }
@Override protected void removeAllAnnotations(boolean fireModelChanged) { super.removeAllAnnotations(fireModelChanged); synchronized (getLockObject()) { fReverseMap.clear(); } }
private void internalEndReporting(ProblemRequestorState state) { int stateCount= 0; synchronized(getLockObject()) { -- fStateCount; stateCount= fStateCount; fProblemRequestorState.set(null); } if (stateCount == 0) reportProblems(state.fReportedProblems); }