Author: scabanovich
Date: 2011-11-18 20:12:43 -0500 (Fri, 18 Nov 2011)
New Revision: 36465
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileSystemsLoader.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/ThreadSafeCopyFactory.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/project/IAutoLoad.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/EclipseResourceUtil.java
Log:
JBIDE-10177
https://issues.jboss.org/browse/JBIDE-10177
JBIDE-812
https://issues.jboss.org/browse/JBIDE-812
Multiple web roots loaded into XModel.
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileSystemsLoader.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileSystemsLoader.java 2011-11-19
01:09:55 UTC (rev 36464)
+++
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileSystemsLoader.java 2011-11-19
01:12:43 UTC (rev 36465)
@@ -62,6 +62,12 @@
public boolean update(XModelObject object) throws XModelException {
boolean b = true;
+
+ IAutoLoad auto =
(IAutoLoad)object.getModel().getProperties().get(XModelConstants.AUTOLOAD);
+ if(auto != null) {
+ auto.update(object.getModel());
+ }
+
XModelObject[] cs = object.getChildren();
for (int i = 0; i < cs.length; i++) {
XObjectLoader loader = XModelObjectLoaderUtil.getObjectLoader(cs[i]);
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/ThreadSafeCopyFactory.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/ThreadSafeCopyFactory.java 2011-11-19
01:09:55 UTC (rev 36464)
+++
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/ThreadSafeCopyFactory.java 2011-11-19
01:12:43 UTC (rev 36465)
@@ -63,7 +63,10 @@
if(copy != null) {
// System.out.println("Created copy of " + copy.getPath() + " for thread
" + Thread.currentThread() + ". Main object is being loaded by thread " +
loadingThread);
//Let us wait a bit for this object, maybe there is no lock.
- for (int i = 0; i < 50; i++) {
+ for (int i = 0; i < 5; i++) {
+ if(loadingThread != null && !loadingThread.isAlive()) {
+ loadingThread = null;
+ }
Thread t = loadingThread;
if (t != null) try {
t.join(100);
@@ -76,8 +79,12 @@
}
}
if(map == null) {
- map = new HashMap<Thread, XModelObject>();
- concurrentlyLoaded = map;
+ if(concurrentlyLoaded != null) {
+ map = concurrentlyLoaded;
+ } else {
+ map = new HashMap<Thread, XModelObject>();
+ concurrentlyLoaded = map;
+ }
}
map.put(Thread.currentThread(), (AbstractExtendedXMLFileImpl)copy);
}
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/project/IAutoLoad.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/project/IAutoLoad.java 2011-11-19
01:09:55 UTC (rev 36464)
+++
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/project/IAutoLoad.java 2011-11-19
01:12:43 UTC (rev 36465)
@@ -5,5 +5,6 @@
public interface IAutoLoad {
public void load(XModel model);
+ public void update(XModel model);
}
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/EclipseResourceUtil.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/EclipseResourceUtil.java 2011-11-19
01:09:55 UTC (rev 36464)
+++
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/EclipseResourceUtil.java 2011-11-19
01:12:43 UTC (rev 36465)
@@ -70,6 +70,7 @@
import org.jboss.tools.common.model.project.IModelNature;
import org.jboss.tools.common.model.project.ModelNature;
import org.jboss.tools.common.model.project.ModelNatureExtension;
+import org.jboss.tools.common.web.WebUtils;
import org.osgi.framework.Bundle;
public class EclipseResourceUtil extends EclipseUtil {
@@ -457,10 +458,16 @@
IVirtualComponent vc = ComponentCore.createComponent(project);
if (vc == null || vc.getRootFolder() == null)
return null;
+ IPath path = WebUtils.getFirstWebContentPath(project);
+ if(path != null) {
+ IFolder f = ResourcesPlugin.getWorkspace().getRoot().getFolder(path);
+ if(f.exists()) {
+ return f;
+ }
+ }
if (ModuleCoreNature.isFlexibleProject(project)) {
return vc.getRootFolder().getUnderlyingResource();
}
-
return null;
}