[jbosstools-commits] JBoss Tools SVN: r35740 - trunk/cdi/plugins/org.jboss.tools.cdi.seam.core/src/org/jboss/tools/cdi/seam/core/international.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Mon Oct 17 19:16:21 EDT 2011


Author: scabanovich
Date: 2011-10-17 19:16:21 -0400 (Mon, 17 Oct 2011)
New Revision: 35740

Modified:
   trunk/cdi/plugins/org.jboss.tools.cdi.seam.core/src/org/jboss/tools/cdi/seam/core/international/CDISeamInternationalDefinitionContext.java
Log:
JBIDE-9918
https://issues.jboss.org/browse/JBIDE-9918
Jar modification is fired to builders.

Modified: trunk/cdi/plugins/org.jboss.tools.cdi.seam.core/src/org/jboss/tools/cdi/seam/core/international/CDISeamInternationalDefinitionContext.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.core/src/org/jboss/tools/cdi/seam/core/international/CDISeamInternationalDefinitionContext.java	2011-10-17 23:11:28 UTC (rev 35739)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.core/src/org/jboss/tools/cdi/seam/core/international/CDISeamInternationalDefinitionContext.java	2011-10-17 23:16:21 UTC (rev 35740)
@@ -12,6 +12,7 @@
 
 import java.util.HashMap;
 import java.util.HashSet;
+import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
 
@@ -49,47 +50,47 @@
 		allBundles = copy.allBundles;
 	}
 
-	public void clean() {
-		synchronized(bundles) {
-			bundles.clear();
-		}
-		synchronized (allBundles) {
-			allBundles.clear();
-		}
+	public synchronized void clean() {
+		bundles.clear();
+		allBundles.clear();
 	}
 
-	public void clean(IPath path) {
+	public synchronized void clean(IPath path) {
 		Set<XModelObject> bs = null;
-		synchronized(bundles) {
-			bs = bundles.remove(path);
-		}
+		bs = bundles.remove(path);
 		if(bs != null) {
-			synchronized (allBundles) {
-				allBundles.removeAll(bs);
-			}
+			allBundles.removeAll(bs);
 		}
 	}
 
-	public void addDefinitions(BundleFileSet fileSet) {
+	public synchronized void addDefinitions(BundleFileSet fileSet) {
 		for (IPath path: fileSet.getAllPaths()) {
+			clean(path);
 			Set<XModelObject> bs = fileSet.getBundles(path);
-			synchronized(bundles) {
-				bundles.put(path, bs);
+			bundles.put(path, bs);
+			allBundles.addAll(bs);
+		}
+	}
+
+	synchronized Set<XModelObject> getBundles() {
+		//filter out obsolete objects.
+		Iterator<XModelObject> i = allBundles.iterator();
+		while(i.hasNext()) {
+			if(!i.next().isActive()) {
+				i.remove();
 			}
-			synchronized (allBundles) {
-				allBundles.addAll(bs);
-			}
 		}
+		return allBundles;
 	}
 
-	public Set<XModelObject> getAllBundles() {
+	public synchronized Set<XModelObject> getAllBundles() {
 		Set<XModelObject> result = new HashSet<XModelObject>();
-		result.addAll(allBundles);
+		result.addAll(getBundles());
 		Set<CDICoreNature> ns = root.getProject().getCDIProjects(true);
 		for (CDICoreNature n: ns) {
 			CDISeamInternationalExtension extension = CDISeamInternationalExtension.getExtension(n);
 			if(extension != null) {
-				result.addAll(extension.getContext().allBundles);
+				result.addAll(extension.getContext().getBundles());
 			}
 		}
 		return result;



More information about the jbosstools-commits mailing list