Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnsgar Radermacher2014-11-06 15:44:24 +0000
committerAnsgar Radermacher2014-11-06 15:45:00 +0000
commite1fe34a27111fd56fe9388ff5af99f7077dea272 (patch)
tree3c544b7b730b93e3cc5798a399f907625323d19c /plugins/uml
parent3733276738d08303e6b8e7cc4ee111e1453ebbde (diff)
downloadorg.eclipse.papyrus-e1fe34a27111fd56fe9388ff5af99f7077dea272.tar.gz
org.eclipse.papyrus-e1fe34a27111fd56fe9388ff5af99f7077dea272.tar.xz
org.eclipse.papyrus-e1fe34a27111fd56fe9388ff5af99f7077dea272.zip
450233 - [C++ codegen] CmdHandler should be moved from "acceleo.ui"
Diffstat (limited to 'plugins/uml')
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/handlers/CmdHandler.java45
1 files changed, 45 insertions, 0 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/handlers/CmdHandler.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/handlers/CmdHandler.java
new file mode 100644
index 00000000000..790efdb7c0c
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/handlers/CmdHandler.java
@@ -0,0 +1,45 @@
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Ansgar Radermacher (CEA LIST) ansgar.radermacher@cea.fr - Initial API and implementation
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.diagram.common.handlers;
+
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
+import org.eclipse.ui.PlatformUI;
+
+
+/**
+ * Simple superclass for handlers. It converts a selection into an EObject.
+ * Used by C++ code generator and Qompass designer
+ */
+public abstract class CmdHandler extends AbstractHandler {
+
+ /**
+ * Convert selected elements within model explorer or diagram to an eObject
+ */
+ public void updateSelectedEObject() {
+ // Retrieve selected elements
+ IStructuredSelection selection = (IStructuredSelection) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection();
+
+ if (selection != null) {
+ selectedEObject = EMFHelper.getEObject(selection.getFirstElement());
+ }
+ }
+
+ /**
+ * Store the selected EObject. Accessible for subclasses
+ */
+ protected EObject selectedEObject;
+}

Back to the top