Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnsgar Radermacher2013-11-04 09:51:52 +0000
committerAnsgar Radermacher2013-11-04 09:51:52 +0000
commit5585992f6f89aa9d09263ee13840100c9b965d37 (patch)
treebdb78e4924d1efbc045dfc244f8b925b21da73f7 /extraplugins
parent1d561eb93c4e7d5cde63a468d8553250c1e4a5d9 (diff)
parent1f747f26e4e0cdad9ccc76fc9bbe0c0f51dadea8 (diff)
downloadorg.eclipse.papyrus-5585992f6f89aa9d09263ee13840100c9b965d37.tar.gz
org.eclipse.papyrus-5585992f6f89aa9d09263ee13840100c9b965d37.tar.xz
org.eclipse.papyrus-5585992f6f89aa9d09263ee13840100c9b965d37.zip
Merge branch 'master' into Qompass
Conflicts: extraplugins/codegen/org.eclipse.papyrus.cpp.codegen.ui/META-INF/MANIFEST.MF extraplugins/codegen/org.eclipse.papyrus.cpp.codegen.ui/src/org/eclipse/papyrus/cpp/codegen/ui/handler/GenerateCodeHandler.java extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppClassBody.emtl extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppClassHeader.emtl extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/CppDocumentation.emtl extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassTypeAndEnum.emtl extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/operation/CppOperations.emtl
Diffstat (limited to 'extraplugins')
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.acceleo.ui/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.cpp.codegen.ui/META-INF/MANIFEST.MF3
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.cpp.codegen.ui/src/org/eclipse/papyrus/cpp/codegen/ui/handler/GenerateCodeHandler.java73
3 files changed, 33 insertions, 50 deletions
diff --git a/extraplugins/codegen/org.eclipse.papyrus.acceleo.ui/.settings/org.eclipse.jdt.core.prefs b/extraplugins/codegen/org.eclipse.papyrus.acceleo.ui/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..f42de363afa
--- /dev/null
+++ b/extraplugins/codegen/org.eclipse.papyrus.acceleo.ui/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.7
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen.ui/META-INF/MANIFEST.MF b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen.ui/META-INF/MANIFEST.MF
index dccf209eea5..0f919264f96 100644
--- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen.ui/META-INF/MANIFEST.MF
+++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen.ui/META-INF/MANIFEST.MF
@@ -10,7 +10,8 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.papyrus.infra.emf;bundle-version="0.10.1",
org.eclipse.papyrus.acceleo;bundle-version="0.10.1",
org.eclipse.cdt.core;bundle-version="5.5.0",
- org.eclipse.papyrus.infra.core.log;bundle-version="0.10.1"
+ org.eclipse.papyrus.infra.core.log;bundle-version="0.10.1",
+ org.eclipse.papyrus.acceleo.ui;bundle-version="0.10.1"
Bundle-Vendor: %providerName
Bundle-ActivationPolicy: lazy
Bundle-Version: 0.10.1.qualifier
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 63c6ce97ac3..6430bba1980 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
@@ -14,7 +14,6 @@ package org.eclipse.papyrus.cpp.codegen.ui.handler;
import org.eclipse.cdt.core.CCProjectNature;
import org.eclipse.cdt.core.CProjectNature;
-import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.resources.IContainer;
@@ -26,82 +25,58 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EObject;
import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.papyrus.acceleo.AcceleoDriver;
+import org.eclipse.papyrus.acceleo.ui.handlers.CmdHandler;
import org.eclipse.papyrus.cpp.codegen.transformation.CppModelElementsCreator;
import org.eclipse.papyrus.cpp.codegen.ui.Activator;
-import org.eclipse.papyrus.infra.emf.utils.BusinessModelResolver;
import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.PackageableElement;
/**
- * <b><u>SyncURI Handler</u></b>
- * <p>
- * Install a filter that only shows events corresponding to a selected URI
+ * Handler for C++ code generation
*/
-public class GenerateCodeHandler extends AbstractHandler {
+public class GenerateCodeHandler extends CmdHandler {
// ------------------------------------------------------------------------
// Execution
// ------------------------------------------------------------------------
- private EObject selectedEObj;
-
@Override
public boolean isEnabled() {
- // intercept isEnabled operation in order to get selected eObject.
-
- // Get current selection
- Object selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection();
-
- // Get first element if the selection is an IStructuredSelection
- if(selection instanceof IStructuredSelection) {
- IStructuredSelection structuredSelection = (IStructuredSelection)selection;
- selection = structuredSelection.getFirstElement();
- }
+ updateSelectedEObject();
- // Treat non-null selected object (try to adapt and return EObject)
- if(selection != null) {
- Object businessObject = BusinessModelResolver.getInstance().getBusinessModel(selection);
- if(businessObject instanceof EObject) {
+ if (selectedEObject != null) {
+ URI uri = selectedEObject.eResource().getURI();
- selectedEObj = (EObject)businessObject;
-
- URI uri = selectedEObj.eResource().getURI();
-
- // URIConverter uriConverter = resource.getResourceSet().getURIConverter();
- IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
- if(uri.segmentCount() < 2) {
- return false;
- }
- IProject modelProject = root.getProject(uri.segment(1));
- if(modelProject.exists()) {
- try {
- // check whether the project is a C or C++ project
- if(modelProject.hasNature(CProjectNature.C_NATURE_ID) ||
- modelProject.hasNature(CCProjectNature.CC_NATURE_ID)) {
- return true;
- }
- }
- catch (CoreException e) {
- Activator.getDefault().getLog().log(new Status(IStatus.ERROR,
- Activator.PLUGIN_ID, e.getMessage(), e));
+ // URIConverter uriConverter = resource.getResourceSet().getURIConverter();
+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ if(uri.segmentCount() < 2) {
+ return false;
+ }
+ IProject modelProject = root.getProject(uri.segment(1));
+ if(modelProject.exists()) {
+ try {
+ // check whether the project is a C or C++ project
+ if(modelProject.hasNature(CProjectNature.C_NATURE_ID) ||
+ modelProject.hasNature(CCProjectNature.CC_NATURE_ID)) {
+ return true;
}
}
+ catch (CoreException e) {
+ Activator.getDefault().getLog().log(new Status(IStatus.ERROR,
+ Activator.PLUGIN_ID, e.getMessage(), e));
+ }
}
}
- selectedEObj = null;
return false;
}
public Object execute(ExecutionEvent event) throws ExecutionException {
- if(selectedEObj instanceof PackageableElement) {
- PackageableElement pe = (PackageableElement)selectedEObj;
+ if(selectedEObject instanceof PackageableElement) {
+ PackageableElement pe = (PackageableElement)selectedEObject;
URI uri = pe.eResource().getURI();

Back to the top