Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnsgar Radermacher2013-10-25 13:17:32 +0000
committerAnsgar Radermacher2013-10-25 13:17:32 +0000
commit3dcac8b06cf2f3ec1e01dd68dcb3af2c77099331 (patch)
treee456a2f1a9ba72bde3fe188760f0f3209d27bb01 /extraplugins
parent0c60f895724843d0af6348bc45f332a27244bc06 (diff)
downloadorg.eclipse.papyrus-3dcac8b06cf2f3ec1e01dd68dcb3af2c77099331.tar.gz
org.eclipse.papyrus-3dcac8b06cf2f3ec1e01dd68dcb3af2c77099331.tar.xz
org.eclipse.papyrus-3dcac8b06cf2f3ec1e01dd68dcb3af2c77099331.zip
Separation of UI task for Acceleo driver, bug 420280
Diffstat (limited to 'extraplugins')
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.acceleo.ui/.classpath7
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.acceleo.ui/.project28
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.acceleo.ui/META-INF/MANIFEST.MF13
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.acceleo.ui/build.properties5
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.acceleo.ui/icons/codegen-16x16.gifbin0 -> 101 bytes
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.acceleo.ui/plugin.xml26
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.acceleo.ui/src/org/eclipse/papyrus/acceleo/ui/Activator.java61
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.acceleo.ui/src/org/eclipse/papyrus/acceleo/ui/handlers/CmdHandler.java49
8 files changed, 189 insertions, 0 deletions
diff --git a/extraplugins/codegen/org.eclipse.papyrus.acceleo.ui/.classpath b/extraplugins/codegen/org.eclipse.papyrus.acceleo.ui/.classpath
new file mode 100644
index 00000000000..098194ca4b7
--- /dev/null
+++ b/extraplugins/codegen/org.eclipse.papyrus.acceleo.ui/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/extraplugins/codegen/org.eclipse.papyrus.acceleo.ui/.project b/extraplugins/codegen/org.eclipse.papyrus.acceleo.ui/.project
new file mode 100644
index 00000000000..64a4ca10930
--- /dev/null
+++ b/extraplugins/codegen/org.eclipse.papyrus.acceleo.ui/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.acceleo.ui</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/extraplugins/codegen/org.eclipse.papyrus.acceleo.ui/META-INF/MANIFEST.MF b/extraplugins/codegen/org.eclipse.papyrus.acceleo.ui/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..2beeb202442
--- /dev/null
+++ b/extraplugins/codegen/org.eclipse.papyrus.acceleo.ui/META-INF/MANIFEST.MF
@@ -0,0 +1,13 @@
+Bundle-ManifestVersion: 2
+Bundle-Name: Ui
+Bundle-SymbolicName: org.eclipse.papyrus.acceleo.ui;singleton:=true
+Bundle-Version: 0.10.1.qualifier
+Bundle-Activator: org.eclipse.papyrus.acceleo.ui.Activator
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.core.resources,
+ org.eclipse.papyrus.infra.emf;bundle-version="0.10.1",
+ org.eclipse.emf.ecore;bundle-version="2.10.0"
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+Export-Package: org.eclipse.papyrus.acceleo.ui.handlers
diff --git a/extraplugins/codegen/org.eclipse.papyrus.acceleo.ui/build.properties b/extraplugins/codegen/org.eclipse.papyrus.acceleo.ui/build.properties
new file mode 100644
index 00000000000..2b0d95b6b02
--- /dev/null
+++ b/extraplugins/codegen/org.eclipse.papyrus.acceleo.ui/build.properties
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = plugin.xml,\
+ META-INF/,\
+ .
diff --git a/extraplugins/codegen/org.eclipse.papyrus.acceleo.ui/icons/codegen-16x16.gif b/extraplugins/codegen/org.eclipse.papyrus.acceleo.ui/icons/codegen-16x16.gif
new file mode 100644
index 00000000000..d7c1a7365f5
--- /dev/null
+++ b/extraplugins/codegen/org.eclipse.papyrus.acceleo.ui/icons/codegen-16x16.gif
Binary files differ
diff --git a/extraplugins/codegen/org.eclipse.papyrus.acceleo.ui/plugin.xml b/extraplugins/codegen/org.eclipse.papyrus.acceleo.ui/plugin.xml
new file mode 100644
index 00000000000..216578dc4a3
--- /dev/null
+++ b/extraplugins/codegen/org.eclipse.papyrus.acceleo.ui/plugin.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+
+<extension
+ point="org.eclipse.ui.menus">
+ <menuContribution
+ allPopups="true"
+ locationURI="popup:org.eclipse.papyrus.views.modelexplorer.modelexplorer.popup">
+ <menu
+ icon="icons/codegen-16x16.gif"
+ id="org.eclipse.papyrus.views.modelexplorer.popup.codegen"
+ label="Code generation">
+ </menu>
+ </menuContribution>
+ <menuContribution
+ allPopups="true"
+ locationURI="popup:org.eclipse.gmf.runtime.diagram.ui.DiagramEditorContextMenu">
+ <menu
+ icon="icons/codegen-16x16.gif"
+ id="org.eclipse.gmf.runtime.diagram.ui.DiagramEditorContextMenu.codegen"
+ label="Code generation">
+ </menu>
+ </menuContribution>
+</extension>
+</plugin>
diff --git a/extraplugins/codegen/org.eclipse.papyrus.acceleo.ui/src/org/eclipse/papyrus/acceleo/ui/Activator.java b/extraplugins/codegen/org.eclipse.papyrus.acceleo.ui/src/org/eclipse/papyrus/acceleo/ui/Activator.java
new file mode 100644
index 00000000000..8be096c6da9
--- /dev/null
+++ b/extraplugins/codegen/org.eclipse.papyrus.acceleo.ui/src/org/eclipse/papyrus/acceleo/ui/Activator.java
@@ -0,0 +1,61 @@
+package org.eclipse.papyrus.acceleo.ui;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.papyrus.acceleo.ui"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+ /**
+ * Returns an image descriptor for the image file at the given
+ * plug-in relative path
+ *
+ * @param path the path
+ * @return the image descriptor
+ */
+ public static ImageDescriptor getImageDescriptor(String path) {
+ return imageDescriptorFromPlugin(PLUGIN_ID, path);
+ }
+}
diff --git a/extraplugins/codegen/org.eclipse.papyrus.acceleo.ui/src/org/eclipse/papyrus/acceleo/ui/handlers/CmdHandler.java b/extraplugins/codegen/org.eclipse.papyrus.acceleo.ui/src/org/eclipse/papyrus/acceleo/ui/handlers/CmdHandler.java
new file mode 100644
index 00000000000..39c89da798b
--- /dev/null
+++ b/extraplugins/codegen/org.eclipse.papyrus.acceleo.ui/src/org/eclipse/papyrus/acceleo/ui/handlers/CmdHandler.java
@@ -0,0 +1,49 @@
+/*****************************************************************************
+ * Copyright (c) 2010 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.acceleo.ui.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.BusinessModelResolver;
+import org.eclipse.ui.PlatformUI;
+
+
+/**
+ * Superclass for handlers. It converts a selection into an EObject
+ */
+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) {
+ Object selectedObject = BusinessModelResolver.getInstance().getBusinessModel(selection.getFirstElement());
+ if (selectedObject instanceof EObject) {
+ selectedEObject = (EObject) selectedObject;
+ }
+ }
+ }
+
+ /**
+ * Store the selected EObject. Accessible for subclasses
+ */
+ protected EObject selectedEObject;
+}

Back to the top