Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcdumoulin2012-04-26 13:22:25 +0000
committercdumoulin2012-04-26 13:22:25 +0000
commita18ced650614ed4f2d717244796215e013301ce2 (patch)
tree8bbfab422a9e13cc3d4fd81bb5f2d707d71eaa29 /extraplugins/java
parent5ab9602f8b51c168cc0d2314be1c9b12fcb5648b (diff)
downloadorg.eclipse.papyrus-a18ced650614ed4f2d717244796215e013301ce2.tar.gz
org.eclipse.papyrus-a18ced650614ed4f2d717244796215e013301ce2.tar.xz
org.eclipse.papyrus-a18ced650614ed4f2d717244796215e013301ce2.zip
ASSIGNED - bug 375759: [Java Code Generator] Improve generator
https://bugs.eclipse.org/bugs/show_bug.cgi?id=375759 - Correct wrong packages - remove deprecated calls
Diffstat (limited to 'extraplugins/java')
-rw-r--r--extraplugins/java/org.eclipse.papyrus.java.reverse.ui/META-INF/MANIFEST.MF2
-rw-r--r--extraplugins/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/ReverseCodeHandler.java30
2 files changed, 23 insertions, 9 deletions
diff --git a/extraplugins/java/org.eclipse.papyrus.java.reverse.ui/META-INF/MANIFEST.MF b/extraplugins/java/org.eclipse.papyrus.java.reverse.ui/META-INF/MANIFEST.MF
index 3694420376b..6ef7e78a11c 100644
--- a/extraplugins/java/org.eclipse.papyrus.java.reverse.ui/META-INF/MANIFEST.MF
+++ b/extraplugins/java/org.eclipse.papyrus.java.reverse.ui/META-INF/MANIFEST.MF
@@ -11,7 +11,7 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.gef;bundle-version="3.4.0",
org.eclipse.jdt;bundle-version="3.4.0",
org.eclipse.jdt.core;bundle-version="3.4.0",
- org.eclipse.papyrus.core,
+ org.eclipse.papyrus.infra.core,
org.eclipse.papyrus.java.reverse;bundle-version="0.7.0"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
diff --git a/extraplugins/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/ReverseCodeHandler.java b/extraplugins/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/ReverseCodeHandler.java
index 219ab7c5f37..3140907f214 100644
--- a/extraplugins/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/ReverseCodeHandler.java
+++ b/extraplugins/java/org.eclipse.papyrus.java.reverse.ui/src/org/eclipse/papyrus/java/reverse/ui/ReverseCodeHandler.java
@@ -24,8 +24,12 @@ import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.TreeSelection;
-import org.eclipse.papyrus.core.editor.IMultiDiagramEditor;
-import org.eclipse.papyrus.core.utils.EditorUtils;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor;
+import org.eclipse.papyrus.infra.core.resource.uml.UmlUtils;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.utils.EditorUtils;
+import org.eclipse.papyrus.infra.core.utils.ServiceUtilsForActionHandlers;
import org.eclipse.papyrus.java.reverse.ui.dialog.ReverseCodeDialog;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IWorkbenchPage;
@@ -67,7 +71,7 @@ public class ReverseCodeHandler extends AbstractHandler implements IHandler {
int res = dialog.open();
// System.out.println("dialog result =" + res);
- if(res == dialog.CANCEL) {
+ if(res == Window.CANCEL) {
System.out.println("Canceled by user.");
return null;
}
@@ -90,8 +94,16 @@ public class ReverseCodeHandler extends AbstractHandler implements IHandler {
// Create revers object
- // Execute the reverse with provided paramters
- TransactionalEditingDomain editingDomain = getEditingDomain();
+ // Execute the reverse with provided parameters
+ TransactionalEditingDomain editingDomain;
+ try {
+ editingDomain = getEditingDomain();
+ } catch (ServiceException e) {
+ // Can't get editing domain
+ e.printStackTrace();
+ throw new ExecutionException(e.getMessage());
+ }
+
final String pname = generationPackageName;
RecordingCommand command = new RecordingCommand(editingDomain, "Reverse Java Code") {
@@ -123,6 +135,7 @@ public class ReverseCodeHandler extends AbstractHandler implements IHandler {
TreeSelection treeSelection = (TreeSelection)selection;
// String filename = treeSelection.
+ @SuppressWarnings("rawtypes")
Iterator iter = treeSelection.iterator();
while(iter.hasNext()) {
Object obj = iter.next();
@@ -186,7 +199,7 @@ public class ReverseCodeHandler extends AbstractHandler implements IHandler {
* @return
*/
private Resource getUmlResource() {
- Resource umlResource = EditorUtils.getDiResourceSet().getModelResource();
+ Resource umlResource = UmlUtils.getUmlModel().getResource();
return umlResource;
}
@@ -213,9 +226,10 @@ public class ReverseCodeHandler extends AbstractHandler implements IHandler {
* Get the main editing doamin.
*
* @return
+ * @throws ServiceException
*/
- protected TransactionalEditingDomain getEditingDomain() {
- return EditorUtils.getTransactionalEditingDomain();
+ protected TransactionalEditingDomain getEditingDomain() throws ServiceException {
+ return ServiceUtilsForActionHandlers.getInstance().getTransactionalEditingDomain();
}
}

Back to the top