Author: scabanovich
Date: 2011-06-15 17:54:30 -0400 (Wed, 15 Jun 2011)
New Revision: 32127
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDICoreBuilder.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/scanner/lib/ClassPathMonitor.java
Log:
JBIDE-9147
https://issues.jboss.org/browse/JBIDE-9147
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDICoreBuilder.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDICoreBuilder.java 2011-06-15
20:44:29 UTC (rev 32126)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDICoreBuilder.java 2011-06-15
21:54:30 UTC (rev 32127)
@@ -152,12 +152,11 @@
Map<String, XModelObject> newJars = new HashMap<String, XModelObject>();
if(isClassPathUpdated) {
+ //2. Update class path. Removed paths will be cached to be applied to working copy of
context.
n.getClassPath().setSrcs(getResourceVisitor().srcs);
-
- //2. Update class path.
newJars = n.getClassPath().process();
- //3. Install extensions.
+ //3. Install extensions. That should be done before constructing working copy of
context.
buildParticipants = n.getExtensionManager().getBuildParticipantFeature();
Set<IDefinitionContextExtension> es = new
HashSet<IDefinitionContextExtension>();
for (IBuildParticipantFeature p: buildParticipants) {
@@ -169,10 +168,16 @@
//4. Create working copy of context.
n.getDefinitions().newWorkingCopy(kind == FULL_BUILD);
+
+ //5. Modify working copy of context.
+ //5.1 Apply Removed paths.
+ if(isClassPathUpdated) {
+ n.getClassPath().applyRemovedPaths();
+ }
for (IBuildParticipantFeature p: buildParticipants) p.beginVisiting();
- //5. Discover sources and build definitions.
+ //5.2 Discover sources and build definitions.
if(isClassPathUpdated) {
buildJars(newJars);
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/scanner/lib/ClassPathMonitor.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/scanner/lib/ClassPathMonitor.java 2011-06-15
20:44:29 UTC (rev 32126)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/scanner/lib/ClassPathMonitor.java 2011-06-15
21:54:30 UTC (rev 32127)
@@ -38,6 +38,8 @@
public class ClassPathMonitor extends AbstractClassPathMonitor<CDICoreNature>{
IPath[] srcs = new IPath[0];
+
+ Set<IPath> removedPaths = new HashSet<IPath>();
public ClassPathMonitor(CDICoreNature project) {
this.project = project;
@@ -51,7 +53,9 @@
public Map<String, XModelObject> process() {
Map<String, XModelObject> newJars = new HashMap<String, XModelObject>();
for (String p: syncProcessedPaths()) {
- project.pathRemoved(new Path(p));
+ synchronized (removedPaths) {
+ removedPaths.add(new Path(p));
+ }
project.getExtensionManager().pathRemoved(p);
}
for (int i = 0; i < paths.size(); i++) {
@@ -78,6 +82,15 @@
return newJars;
}
+ public void applyRemovedPaths() {
+ synchronized (removedPaths) {
+ for (IPath p: removedPaths) {
+ project.pathRemoved(p);
+ }
+ removedPaths.clear();
+ }
+ }
+
private boolean isWeldJar(String fileName) {
if(!fileName.startsWith("weld-") &&
fileName.indexOf("-weld") < 0) return false;
if(fileName.startsWith("weld-extensions")) return false;
@@ -97,7 +110,9 @@
}
for (IPath s: srcs) {
if(!ss.contains(s)) {
- project.pathRemoved(s);
+ synchronized (removedPaths) {
+ removedPaths.add(s);
+ }
}
}
srcs = newSrcs;