summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormclay2009-01-04 16:29:12 (EST)
committer sefftinge2009-01-04 16:29:12 (EST)
commit3ee0d81a4498ba1c1c5dfbcfdae15f2f66e2c10b (patch)
treee408fe3d2b240919ccc0047f4f0af036286b6dc5
parentfa681765c18b3db09bf5a3afac97e7aa8f9e641c (diff)
downloadorg.eclipse.xtext-3ee0d81a4498ba1c1c5dfbcfdae15f2f66e2c10b.zip
org.eclipse.xtext-3ee0d81a4498ba1c1c5dfbcfdae15f2f66e2c10b.tar.gz
org.eclipse.xtext-3ee0d81a4498ba1c1c5dfbcfdae15f2f66e2c10b.tar.bz2
fix: handle classpath URIs
-rw-r--r--plugins/org.eclipse.xtext.ui.core/src/org/eclipse/xtext/ui/core/editor/OpenDeclarationAction.java17
1 files changed, 14 insertions, 3 deletions
diff --git a/plugins/org.eclipse.xtext.ui.core/src/org/eclipse/xtext/ui/core/editor/OpenDeclarationAction.java b/plugins/org.eclipse.xtext.ui.core/src/org/eclipse/xtext/ui/core/editor/OpenDeclarationAction.java
index e9e54a2..e593de2 100644
--- a/plugins/org.eclipse.xtext.ui.core/src/org/eclipse/xtext/ui/core/editor/OpenDeclarationAction.java
+++ b/plugins/org.eclipse.xtext.ui.core/src/org/eclipse/xtext/ui/core/editor/OpenDeclarationAction.java
@@ -7,6 +7,7 @@ import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.Path;
+import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.jface.action.Action;
@@ -29,7 +30,9 @@ import org.eclipse.xtext.parsetree.LeafNode;
import org.eclipse.xtext.parsetree.NodeAdapter;
import org.eclipse.xtext.parsetree.NodeUtil;
import org.eclipse.xtext.parsetree.ParseTreeUtil;
+import org.eclipse.xtext.resource.ClasspathUriUtil;
import org.eclipse.xtext.resource.XtextResource;
+import org.eclipse.xtext.resource.XtextResourceSet;
import org.eclipse.xtext.service.ServiceRegistry;
import org.eclipse.xtext.ui.core.editor.model.IXtextDocument;
import org.eclipse.xtext.ui.core.editor.model.UnitOfWork;
@@ -91,12 +94,20 @@ public class OpenDeclarationAction extends Action {
if (!linkedObjects.isEmpty()) {
EObject referenceEObject = linkedObjects.iterator().next();
+
+ XtextResourceSet resourceSet = (XtextResourceSet) referenceEObject.eResource().getResourceSet();
+
+ URI uri = referenceEObject.eResource().getURI();
+
+ if (ClasspathUriUtil.isClassapthUri(uri)) {
+ uri = resourceSet.getClasspathUriResolver().resolve(resourceSet.getClasspathURIContext(), uri);
+ }
- IFile targetFile = referenceEObject.eResource().getURI().isPlatformResource() ?
+ IFile targetFile = uri.isPlatformResource() ?
ResourcesPlugin.getWorkspace().getRoot().getFile(
- new Path(referenceEObject.eResource().getURI().toPlatformString(true)))
+ new Path(uri.toPlatformString(true)))
: ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(
- new Path(referenceEObject.eResource().getURI().toFileString()));
+ new Path(uri.toFileString()));
if (targetFile != null) {