Author: scabanovich
Date: 2008-02-22 03:45:01 -0500 (Fri, 22 Feb 2008)
New Revision: 6519
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/EclipseResourceUtil.java
Log:
JBIDE-1811
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 2008-02-22
05:03:23 UTC (rev 6518)
+++
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/EclipseResourceUtil.java 2008-02-22
08:45:01 UTC (rev 6519)
@@ -475,6 +475,8 @@
try {
String s = null;
String path = es[i].getPath().toString();
+
+ //First let's check if path is defined within Eclipse work space.
if(path.startsWith("/") && path.indexOf("/", 1) > 1)
{
IResource findMember =
ResourcesPlugin.getWorkspace().getRoot().findMember(es[i].getPath());
if(findMember != null) {
@@ -482,14 +484,22 @@
} else {
s = null;
}
- } else if(path.startsWith("/" + project.getName() + "/")) {
+ }
+
+ //If search in Eclipse work space has failed, this is a useless attempt, but
+ //let keep it just in case (this is good old code that worked for a long while).
+ if(s == null && path.startsWith("/" + project.getName() +
"/")) {
IResource findMember = project.findMember(es[i].getPath().removeFirstSegments(1));
if(findMember != null) {
s = findMember.getLocation().toString();
} else {
s = null;
}
- } else if(new java.io.File(path).isFile()) {
+ }
+
+ //If we failed to find resource in Eclipse work space,
+ //lets try the path as absolute on disk
+ if(s == null && new java.io.File(path).isFile()) {
s = path;
}
if(s != null) {
Show replies by date