Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKai Maetzel2004-06-17 16:37:37 +0000
committerKai Maetzel2004-06-17 16:37:37 +0000
commitbc91958117a71973b49ea27220baa806fec81c22 (patch)
tree1f8ab1bbf1ded0114456981e3e23b34ef573e31c
parenta3cbaba3398d2e98c51b448fdd2bd1e72f9394a6 (diff)
downloadeclipse.platform.text-bc91958117a71973b49ea27220baa806fec81c22.tar.gz
eclipse.platform.text-bc91958117a71973b49ea27220baa806fec81c22.tar.xz
eclipse.platform.text-bc91958117a71973b49ea27220baa806fec81c22.zip
#66879
-rw-r--r--org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/ProjectionSummary.java53
1 files changed, 35 insertions, 18 deletions
diff --git a/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/ProjectionSummary.java b/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/ProjectionSummary.java
index 65c42535cec..a13f2639003 100644
--- a/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/ProjectionSummary.java
+++ b/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/ProjectionSummary.java
@@ -55,7 +55,8 @@ class ProjectionSummary {
public void run() {
while (true) {
synchronized (fLock) {
- if(!fReset) break;
+ if (!fReset)
+ break;
fReset= false;
}
internalUpdateSummaries(fProgressMonitor);
@@ -85,26 +86,32 @@ class ProjectionSummary {
}
public void addAnnotationType(String annotationType) {
- if (fConfiguredAnnotationTypes == null) {
- fConfiguredAnnotationTypes= new ArrayList();
- fConfiguredAnnotationTypes.add(annotationType);
- } else if (!fConfiguredAnnotationTypes.contains(annotationType))
- fConfiguredAnnotationTypes.add(annotationType);
+ synchronized(fLock) {
+ if (fConfiguredAnnotationTypes == null) {
+ fConfiguredAnnotationTypes= new ArrayList();
+ fConfiguredAnnotationTypes.add(annotationType);
+ } else if (!fConfiguredAnnotationTypes.contains(annotationType))
+ fConfiguredAnnotationTypes.add(annotationType);
+ }
}
public void removeAnnotationType(String annotationType) {
- if (fConfiguredAnnotationTypes != null) {
- fConfiguredAnnotationTypes.remove(annotationType);
- if (fConfiguredAnnotationTypes.size() == 0)
- fConfiguredAnnotationTypes= null;
+ synchronized (fLock) {
+ if (fConfiguredAnnotationTypes != null) {
+ fConfiguredAnnotationTypes.remove(annotationType);
+ if (fConfiguredAnnotationTypes.size() == 0)
+ fConfiguredAnnotationTypes= null;
+ }
}
}
public void updateSummaries(IProgressMonitor monitor) {
synchronized (fLock) {
- if (fSummarizer == null)
- fSummarizer= new Summarizer(monitor);
- fSummarizer.reset();
+ if (fConfiguredAnnotationTypes != null) {
+ if (fSummarizer == null)
+ fSummarizer= new Summarizer(monitor);
+ fSummarizer.reset();
+ }
}
}
@@ -220,14 +227,24 @@ class ProjectionSummary {
}
private void createSummary(Map additions, IRegion summaryRange, Position summaryAnchor) {
- Map map= new HashMap();
- int size= fConfiguredAnnotationTypes.size();
- for (int i= 0; i < size; i++) {
- String type= (String) fConfiguredAnnotationTypes.get(i);
- map.put(type, new AnnotationBag(type));
+ int size= 0;
+ Map map= null;
+
+ synchronized (fLock) {
+ if (fConfiguredAnnotationTypes != null) {
+ size= fConfiguredAnnotationTypes.size();
+ map= new HashMap();
+ for (int i= 0; i < size; i++) {
+ String type= (String) fConfiguredAnnotationTypes.get(i);
+ map.put(type, new AnnotationBag(type));
+ }
+ }
}
+ if (map == null)
+ return;
+
IAnnotationModel model= fProjectionViewer.getAnnotationModel();
Iterator e= model.getAnnotationIterator();
while (e.hasNext()) {

Back to the top