Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian de Alwis2012-02-14 17:52:44 -0500
committerBrian de Alwis2012-02-14 17:52:44 -0500
commit73878cb2a44652eef704103429a898c3a51b316b (patch)
tree5325300e374072b25cc41cd92cb8a0b41ccf9b36
parent8a5b3a02a18310f0b584650ebbcec73b4c0df482 (diff)
downloadorg.eclipse.e4.tools-73878cb2a44652eef704103429a898c3a51b316b.tar.gz
org.eclipse.e4.tools-73878cb2a44652eef704103429a898c3a51b316b.tar.xz
org.eclipse.e4.tools-73878cb2a44652eef704103429a898c3a51b316b.zip
Bug 371553 - [Model Editor] NPE when finding a contribution class from Live Editorv20120214-2252I20120222-2200I20120222-0915I20120221-2200I20120216-2200I20120216-1110I20120214-2200
-rw-r--r--bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/PDEClassContributionProvider.java9
1 files changed, 7 insertions, 2 deletions
diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/PDEClassContributionProvider.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/PDEClassContributionProvider.java
index 7ae0019c..4b3c3de3 100644
--- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/PDEClassContributionProvider.java
+++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/PDEClassContributionProvider.java
@@ -18,6 +18,8 @@ import java.io.InputStreamReader;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.e4.tools.emf.ui.common.IClassContributionProvider;
import org.eclipse.jdt.core.JavaModelException;
@@ -36,7 +38,10 @@ public class PDEClassContributionProvider implements IClassContributionProvider
@SuppressWarnings("restriction")
public void findContribution(final Filter filter, final ContributionResultHandler handler) {
- IJavaSearchScope scope = PDEJavaHelper.getSearchScope(filter.project);
+ // filter.project may be null in the live editor
+ IJavaSearchScope scope = filter.project != null ? PDEJavaHelper
+ .getSearchScope(filter.project) : SearchEngine
+ .createWorkspaceScope();
char[] packageName = null;
char[] typeName = null;
@@ -85,7 +90,7 @@ public class PDEClassContributionProvider implements IClassContributionProvider
// System.err.println("Found: " + label + " => " + pName + " => " + path);
- IResource resource = filter.project.getWorkspace().getRoot().findMember(path);
+ IResource resource = ResourcesPlugin.getWorkspace().getRoot().findMember(path);
if( resource != null ) {
IProject project = resource.getProject();

Back to the top