Author: scabanovich
Date: 2009-12-25 08:23:26 -0500 (Fri, 25 Dec 2009)
New Revision: 19585
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/EclipseResourceUtil.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5573
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 2009-12-25
11:30:52 UTC (rev 19584)
+++
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/EclipseResourceUtil.java 2009-12-25
13:23:26 UTC (rev 19585)
@@ -575,11 +575,21 @@
}
IResource sr = s.getResource();
if(sr == null) return null;
- if(!sr.getFullPath().isPrefixOf(resource.getFullPath())) return null;
- String path = resource.getFullPath().toString();
- String rootpath = sr.getFullPath().toString();
- String relpath = path.substring(rootpath.length()).replace('\\', '/');
- if(relpath.length() == 0) return s;
+ String relpath = null;
+ if(sr.getFullPath().isPrefixOf(resource.getFullPath())) {
+ String path = resource.getFullPath().toString();
+ String rootpath = sr.getFullPath().toString();
+ relpath = path.substring(rootpath.length()).replace('\\', '/');
+ if(relpath.length() == 0) return s;
+ } else if(sr.getLocation() != null && resource.getLocation() != null
+ && sr.getLocation().isPrefixOf(resource.getLocation())) {
+ String path = resource.getLocation().toString();
+ String rootpath = sr.getLocation().toString();
+ relpath = path.substring(rootpath.length()).replace('\\', '/');
+ if(relpath.length() == 0) return s;
+ }
+
+ if(relpath == null) return null;
XModelObject o = s.getChildByPath(relpath.substring(1));
if(o == null && resource.exists()) {
@@ -591,7 +601,9 @@
while(p != null &&
!XModelObjectConstants.TRUE.equals(p.get("overlapped"))) p = p.getParent();
//$NON-NLS-1$
if(p == null) {
IResource r = (IResource)o.getAdapter(IResource.class);
- if(r == null || !resource.getFullPath().equals(r.getFullPath())) {
+ if(r == null || (!resource.getFullPath().equals(r.getFullPath())
+ && (resource.getLocation() == null || r.getLocation() == null ||
!resource.getLocation().equals(r.getLocation()))
+ )) {
//failure, more detailed file system is needed.
return null;
}