Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNan Li2013-07-25 19:41:30 +0000
committerNan Li2013-07-25 21:49:15 +0000
commit1914bc6ba6ec36ea50843142c5dd0801ab6933ec (patch)
treea7ed66d33e223bdee12de4ebf69a8deefba222f8
parent1e71a2a560b478d56af7cb32a9bf78788cedd182 (diff)
downloadwebtools.dali-1914bc6ba6ec36ea50843142c5dd0801ab6933ec.tar.gz
webtools.dali-1914bc6ba6ec36ea50843142c5dd0801ab6933ec.tar.xz
webtools.dali-1914bc6ba6ec36ea50843142c5dd0801ab6933ec.zip
409762 - Table gen does not work for Package Explorer
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/handlers/GenerateDDLHandler.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/handlers/GenerateEntitiesHandler.java13
2 files changed, 4 insertions, 13 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/handlers/GenerateDDLHandler.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/handlers/GenerateDDLHandler.java
index fb2851271b..563b94c523 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/handlers/GenerateDDLHandler.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/handlers/GenerateDDLHandler.java
@@ -12,6 +12,7 @@ package org.eclipse.jpt.jpa.ui.internal.handlers;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IProject;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jpt.common.core.internal.utility.PlatformTools;
@@ -46,7 +47,8 @@ public class GenerateDDLHandler extends AbstractHandler
}
private JpaProject adaptSelection(Object selectedObject) {
- return PlatformTools.getAdapter(selectedObject, JpaProject.class);
+ IProject project = PlatformTools.getAdapter(selectedObject, IProject.class);
+ return project == null ? null : PlatformTools.getAdapter(project, JpaProject.class);
}
private JpaPlatformUi getJpaPlatformUi(JpaProject project) {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/handlers/GenerateEntitiesHandler.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/handlers/GenerateEntitiesHandler.java
index 0a81ef4bf9..770829d9cc 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/handlers/GenerateEntitiesHandler.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/handlers/GenerateEntitiesHandler.java
@@ -13,7 +13,6 @@ import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.resources.IProject;
-import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jpt.common.core.internal.utility.PlatformTools;
@@ -47,18 +46,8 @@ public class GenerateEntitiesHandler extends AbstractHandler
}
}
- protected IProject projectFromSelection(Object selection) {
- if (selection instanceof IProject) { //IProject when selecting in the Project Explorer
- return (IProject) selection;
- }
- if (selection instanceof IJavaProject) { //IJavaProject when selecting in the Package Explorer
- return ((IJavaProject) selection).getProject();
- }
- return null;
- }
-
private JpaProject jpaProjectFromSelection(Object selectedObject) {
- IProject project = this.projectFromSelection(selectedObject);
+ IProject project = PlatformTools.getAdapter(selectedObject, IProject.class);
return project == null ? null : PlatformTools.getAdapter(project, JpaProject.class);
}

Back to the top