summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorszarnekow2009-03-13 05:42:22 (EDT)
committer sefftinge2009-03-13 05:42:22 (EDT)
commite10e3a8dc69f8c09d6b186eb1959b9fd37eabae6 (patch)
tree49ccbabb34592bfec244acfa85b0264f43abd73d
parentb7ad1494d950ff38e7c0a03397adc7347214d22b (diff)
downloadorg.eclipse.xtext-e10e3a8dc69f8c09d6b186eb1959b9fd37eabae6.zip
org.eclipse.xtext-e10e3a8dc69f8c09d6b186eb1959b9fd37eabae6.tar.gz
org.eclipse.xtext-e10e3a8dc69f8c09d6b186eb1959b9fd37eabae6.tar.bz2
Fix: NPE in Open declaration action, when you try to open a http:// uri
-rw-r--r--plugins/org.eclipse.xtext.ui.common/src/org/eclipse/xtext/ui/common/editor/hyperlinking/OpenDeclarationAction.java14
1 files changed, 8 insertions, 6 deletions
diff --git a/plugins/org.eclipse.xtext.ui.common/src/org/eclipse/xtext/ui/common/editor/hyperlinking/OpenDeclarationAction.java b/plugins/org.eclipse.xtext.ui.common/src/org/eclipse/xtext/ui/common/editor/hyperlinking/OpenDeclarationAction.java
index d5981c6..da7a61b 100644
--- a/plugins/org.eclipse.xtext.ui.common/src/org/eclipse/xtext/ui/common/editor/hyperlinking/OpenDeclarationAction.java
+++ b/plugins/org.eclipse.xtext.ui.common/src/org/eclipse/xtext/ui/common/editor/hyperlinking/OpenDeclarationAction.java
@@ -73,15 +73,17 @@ public class OpenDeclarationAction extends Action {
openEditor = IDE.openEditor(page, input, PlatformUI.getWorkbench().getEditorRegistry()
.getDefaultEditor(uri.lastSegment()).getId());
} else {
- // fall back: URI is bundle resource uri and has to converted
+ // fall back: URI is bundle resource uri and has to converted, or http uri
URL url = FileLocator.toFileURL(new URL(uri.scheme()+ ":" +uri.devicePath()));
URI urlAsUri = URI.createURI(url.toString());
String path = urlAsUri.toFileString();
- File ioFile = new File(path);
- // TODO don't fall back to java.io
- IEditorInput input = new XtextReadonlyEditorInput(new ReadonlyFileStorage(ioFile, uri));
- openEditor = IDE.openEditor(page, input, PlatformUI.getWorkbench().getEditorRegistry()
- .getDefaultEditor(uri.lastSegment()).getId());
+ if (path != null) {
+ File ioFile = new File(path);
+ // TODO don't fall back to java.io
+ IEditorInput input = new XtextReadonlyEditorInput(new ReadonlyFileStorage(ioFile, uri));
+ openEditor = IDE.openEditor(page, input, PlatformUI.getWorkbench().getEditorRegistry()
+ .getDefaultEditor(uri.lastSegment()).getId());
+ }
}
} catch (PartInitException partInitException) {
logger.error("Error while opening editor part for EMF URI '" + uri + "'",