Author: scabanovich
Date: 2010-08-12 08:03:05 -0400 (Thu, 12 Aug 2010)
New Revision: 24091
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java
Log:
https://jira.jboss.org/browse/JBIDE-6820
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java 2010-08-12
11:42:42 UTC (rev 24090)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java 2010-08-12
12:03:05 UTC (rev 24091)
@@ -13,7 +13,9 @@
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collection;
+import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
@@ -1984,7 +1986,9 @@
sc = new HashSet<SeamComponentDeclaration>();
declarationsBySource.put(path, sc);
}
- sc.add(d);
+ synchronized(sc) {
+ sc.add(d);
+ }
if(d instanceof ISeamJavaComponentDeclaration) {
SeamJavaComponentDeclaration jd = (SeamJavaComponentDeclaration)d;
for (ISeamContextVariable v: jd.getDeclaredVariables()) addVariable(v);
@@ -2006,14 +2010,24 @@
IPath path = d.getSourcePath();
Set<SeamComponentDeclaration> sc = declarationsBySource.get(path);
if(sc != null) {
- sc.remove(d);
+ synchronized(sc) {
+ sc.remove(d);
+ }
if(sc.isEmpty()) declarationsBySource.remove(path);
}
removeDeclarationWithClass(d);
}
public Set<SeamComponentDeclaration> getDeclarationsBySource(IPath path) {
- return declarationsBySource.get(path);
+ Set<SeamComponentDeclaration> result = declarationsBySource.get(path);
+ if (result != null) {
+ Set<SeamComponentDeclaration> copy = new
HashSet<SeamComponentDeclaration>();
+ synchronized(result) {
+ copy.addAll(result);
+ }
+ result = copy;
+ }
+ return result;
}
public SeamJavaComponentDeclaration getJavaDeclaration(String className) {
@@ -2029,8 +2043,10 @@
public void removePath(IPath path) {
Set<SeamComponentDeclaration> sd = declarationsBySource.get(path);
if(sd == null) return;
- for (SeamComponentDeclaration d: sd) {
- removeDeclarationWithClass(d);
+ synchronized(sd) {
+ for (SeamComponentDeclaration d: sd) {
+ removeDeclarationWithClass(d);
+ }
}
declarationsBySource.remove(path);
}