Fix problem where an invalid path is selected causing NPE when opening new wizard
git-svn-id: http://dev.eclipse.org/svnroot/technology/org.eclipse.stem/branches/STEM_1_1_0@1061 92a21009-5b66-0410-b83a-dc787c41c6e9
diff --git a/org.eclipse.stem.ui/src/org/eclipse/stem/ui/wizards/NewIdentifiablePage.java b/org.eclipse.stem.ui/src/org/eclipse/stem/ui/wizards/NewIdentifiablePage.java
index 9493631..a771833 100644
--- a/org.eclipse.stem.ui/src/org/eclipse/stem/ui/wizards/NewIdentifiablePage.java
+++ b/org.eclipse.stem.ui/src/org/eclipse/stem/ui/wizards/NewIdentifiablePage.java
@@ -19,6 +19,7 @@
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
+import org.eclipse.emf.common.util.URI;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.WizardPage;
@@ -356,10 +357,13 @@
} // else if File or Folder
// Identifiable?
else if (obj instanceof Identifiable) {
- final IPath path = new Path(((Identifiable) obj).getURI()
- .toPlatformString(true));
- retValue = ResourcesPlugin.getWorkspace().getRoot()
- .getFile(path).getProject();
+ URI uri = ((Identifiable) obj).getURI();
+ String puri = uri.toPlatformString(true);
+ if(puri != null) {
+ final IPath path = new Path(puri);
+ retValue = ResourcesPlugin.getWorkspace().getRoot()
+ .getFile(path).getProject();
+ } // if puri is null no path is available, return null
break;
} // else if Identifiable
// IdentifiableTreeNode?