Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnsgar Radermacher2013-10-08 05:44:19 -0400
committerAnsgar Radermacher2013-10-08 06:58:49 -0400
commitdda22cc326529096c975846c7b83325954c387b7 (patch)
tree50479e504564761127de097a5895088b40a398aa /extraplugins
parenta69131b1f08a070595b7cac18f90f0952895e861 (diff)
downloadorg.eclipse.papyrus-dda22cc326529096c975846c7b83325954c387b7.tar.gz
org.eclipse.papyrus-dda22cc326529096c975846c7b83325954c387b7.tar.xz
org.eclipse.papyrus-dda22cc326529096c975846c7b83325954c387b7.zip
Support code generation for packages
Diffstat (limited to 'extraplugins')
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.cpp.codegen.ui/src/org/eclipse/papyrus/cpp/codegen/ui/handler/GenerateCodeHandler.java16
1 files changed, 8 insertions, 8 deletions
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen.ui/src/org/eclipse/papyrus/cpp/codegen/ui/handler/GenerateCodeHandler.java b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen.ui/src/org/eclipse/papyrus/cpp/codegen/ui/handler/GenerateCodeHandler.java
index 0c4d7c9fbc4..3858925278c 100644
--- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen.ui/src/org/eclipse/papyrus/cpp/codegen/ui/handler/GenerateCodeHandler.java
+++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen.ui/src/org/eclipse/papyrus/cpp/codegen/ui/handler/GenerateCodeHandler.java
@@ -38,6 +38,7 @@ import org.eclipse.papyrus.infra.emf.utils.BusinessModelResolver;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.Classifier;
+import org.eclipse.uml2.uml.PackageableElement;
/**
* <b><u>SyncURI Handler</u></b>
@@ -102,11 +103,10 @@ public class GenerateCodeHandler extends AbstractHandler {
public Object execute(ExecutionEvent event) throws ExecutionException {
- if(selectedEObj instanceof Classifier) {
- Classifier classifier = (Classifier)selectedEObj;
-
-
- URI uri = classifier.eResource().getURI();
+ if(selectedEObj instanceof PackageableElement) {
+ PackageableElement pe = (PackageableElement)selectedEObj;
+
+ URI uri = pe.eResource().getURI();
// URIConverter uriConverter = resource.getResourceSet().getURIConverter();
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
@@ -115,16 +115,16 @@ public class GenerateCodeHandler extends AbstractHandler {
}
IProject modelProject = root.getProject(uri.segment(1));
if(modelProject.exists()) {
- String name = classifier.getName();
+ String name = pe.getName();
// get the container for the current element
String headerSuffix = CppCodeGenUtils.getHeaderSuffix();
String bodySuffix = CppCodeGenUtils.getBodySuffix();
AcceleoDriver.clearErrors();
CppModelElementsCreator mec = new CppModelElementsCreator(modelProject);
- IContainer srcPkg = mec.getContainer(classifier);
+ IContainer srcPkg = mec.getContainer(pe);
try {
- mec.createPackageableElement(srcPkg, null, classifier);
+ mec.createPackageableElement(srcPkg, null, pe);
if (AcceleoDriver.hasErrors()) {
MessageDialog.openInformation(new Shell(), "Errors during code generation", //$NON-NLS-1$

Back to the top