Skip to main content
summaryrefslogtreecommitdiffstats
path: root/jpa
diff options
context:
space:
mode:
authorNan Li2013-07-25 19:45:57 +0000
committerNan Li2013-07-25 19:45:57 +0000
commitbff326f1f4a60495000e584378288e5774cb0291 (patch)
treeae3ef3902dff93681452d1507ca951d024346ba5 /jpa
parent741a98e79724714d068f6f4228ef6a37a394bb11 (diff)
downloadwebtools.dali-bff326f1f4a60495000e584378288e5774cb0291.tar.gz
webtools.dali-bff326f1f4a60495000e584378288e5774cb0291.tar.xz
webtools.dali-bff326f1f4a60495000e584378288e5774cb0291.zip
409762 - Table gen does not work for Package Explorer
Diffstat (limited to 'jpa')
-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