From e85383a1690684d8e6588db68c3129d0c8ed8bfe Mon Sep 17 00:00:00 2001
From: Ansgar Radermacher
Date: Fri, 1 Nov 2013 14:32:10 +0100
Subject: Added org.eclipse.papyrus.acceleo.debug to tree and feature
---
.../org.eclipse.papyrus.acceleo.debug/.classpath | 7 +
.../org.eclipse.papyrus.acceleo.debug/.project | 28 ++++
.../META-INF/MANIFEST.MF | 19 +++
.../org.eclipse.papyrus.acceleo.debug/about.html | 28 ++++
.../build.properties | 4 +
.../icons/allocation.gif | Bin 0 -> 143 bytes
.../icons/deploy.gif | Bin 0 -> 148 bytes
.../plugin.properties | 12 ++
.../org.eclipse.papyrus.acceleo.debug/plugin.xml | 80 ++++++++++
.../papyrus/qompass/designer/debug/Activator.java | 50 +++++++
.../designer/debug/dialogs/TestAcceleoDialog.java | 161 +++++++++++++++++++++
.../debug/handlers/ResetAcceleoHandler.java | 45 ++++++
.../debug/handlers/TestAcceleoHandler.java | 53 +++++++
13 files changed, 487 insertions(+)
create mode 100644 extraplugins/codegen/org.eclipse.papyrus.acceleo.debug/.classpath
create mode 100644 extraplugins/codegen/org.eclipse.papyrus.acceleo.debug/.project
create mode 100644 extraplugins/codegen/org.eclipse.papyrus.acceleo.debug/META-INF/MANIFEST.MF
create mode 100644 extraplugins/codegen/org.eclipse.papyrus.acceleo.debug/about.html
create mode 100644 extraplugins/codegen/org.eclipse.papyrus.acceleo.debug/build.properties
create mode 100644 extraplugins/codegen/org.eclipse.papyrus.acceleo.debug/icons/allocation.gif
create mode 100644 extraplugins/codegen/org.eclipse.papyrus.acceleo.debug/icons/deploy.gif
create mode 100644 extraplugins/codegen/org.eclipse.papyrus.acceleo.debug/plugin.properties
create mode 100644 extraplugins/codegen/org.eclipse.papyrus.acceleo.debug/plugin.xml
create mode 100644 extraplugins/codegen/org.eclipse.papyrus.acceleo.debug/src/org/eclipse/papyrus/qompass/designer/debug/Activator.java
create mode 100644 extraplugins/codegen/org.eclipse.papyrus.acceleo.debug/src/org/eclipse/papyrus/qompass/designer/debug/dialogs/TestAcceleoDialog.java
create mode 100644 extraplugins/codegen/org.eclipse.papyrus.acceleo.debug/src/org/eclipse/papyrus/qompass/designer/debug/handlers/ResetAcceleoHandler.java
create mode 100644 extraplugins/codegen/org.eclipse.papyrus.acceleo.debug/src/org/eclipse/papyrus/qompass/designer/debug/handlers/TestAcceleoHandler.java
(limited to 'extraplugins')
diff --git a/extraplugins/codegen/org.eclipse.papyrus.acceleo.debug/.classpath b/extraplugins/codegen/org.eclipse.papyrus.acceleo.debug/.classpath
new file mode 100644
index 00000000000..64c5e31b7a2
--- /dev/null
+++ b/extraplugins/codegen/org.eclipse.papyrus.acceleo.debug/.classpath
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/extraplugins/codegen/org.eclipse.papyrus.acceleo.debug/.project b/extraplugins/codegen/org.eclipse.papyrus.acceleo.debug/.project
new file mode 100644
index 00000000000..09d5deae110
--- /dev/null
+++ b/extraplugins/codegen/org.eclipse.papyrus.acceleo.debug/.project
@@ -0,0 +1,28 @@
+
+
+ org.eclipse.papyrus.acceleo.debug
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.eclipse.pde.ManifestBuilder
+
+
+
+
+ org.eclipse.pde.SchemaBuilder
+
+
+
+
+
+ org.eclipse.pde.PluginNature
+ org.eclipse.jdt.core.javanature
+
+
diff --git a/extraplugins/codegen/org.eclipse.papyrus.acceleo.debug/META-INF/MANIFEST.MF b/extraplugins/codegen/org.eclipse.papyrus.acceleo.debug/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..7a31411de1e
--- /dev/null
+++ b/extraplugins/codegen/org.eclipse.papyrus.acceleo.debug/META-INF/MANIFEST.MF
@@ -0,0 +1,19 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.papyrus.acceleo.debug;singleton:=true
+Bundle-Version: 0.10.1.qualifier
+Bundle-Activator: org.eclipse.papyrus.qompass.designer.debug.Activator
+Bundle-Vendor: %providerName
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.uml2.uml;bundle-version="4.0.0",
+ org.eclipse.acceleo.engine;bundle-version="3.2.2",
+ org.eclipse.papyrus.fcm.profile;bundle-version="0.10.0",
+ org.eclipse.papyrus.acceleo;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.widgets.toolbox;bundle-version="0.10.1",
+ org.eclipse.papyrus.infra.emf;bundle-version="0.10.1",
+ org.eclipse.papyrus.acceleo.ui;bundle-version="0.10.1"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
+Bundle-Localization: plugin
diff --git a/extraplugins/codegen/org.eclipse.papyrus.acceleo.debug/about.html b/extraplugins/codegen/org.eclipse.papyrus.acceleo.debug/about.html
new file mode 100644
index 00000000000..209103075a7
--- /dev/null
+++ b/extraplugins/codegen/org.eclipse.papyrus.acceleo.debug/about.html
@@ -0,0 +1,28 @@
+
+
+
+
+About
+
+
+About This Content
+
+November 14, 2008
+License
+
+The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
+at http://www.eclipse.org/legal/epl-v10.html.
+For purposes of the EPL, "Program" will mean the Content.
+
+If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party ("Redistributor") and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at http://www.eclipse.org.
+
+
+
\ No newline at end of file
diff --git a/extraplugins/codegen/org.eclipse.papyrus.acceleo.debug/build.properties b/extraplugins/codegen/org.eclipse.papyrus.acceleo.debug/build.properties
new file mode 100644
index 00000000000..34d2e4d2dad
--- /dev/null
+++ b/extraplugins/codegen/org.eclipse.papyrus.acceleo.debug/build.properties
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
diff --git a/extraplugins/codegen/org.eclipse.papyrus.acceleo.debug/icons/allocation.gif b/extraplugins/codegen/org.eclipse.papyrus.acceleo.debug/icons/allocation.gif
new file mode 100644
index 00000000000..ced634f9c9c
Binary files /dev/null and b/extraplugins/codegen/org.eclipse.papyrus.acceleo.debug/icons/allocation.gif differ
diff --git a/extraplugins/codegen/org.eclipse.papyrus.acceleo.debug/icons/deploy.gif b/extraplugins/codegen/org.eclipse.papyrus.acceleo.debug/icons/deploy.gif
new file mode 100644
index 00000000000..7a7ced35f3d
Binary files /dev/null and b/extraplugins/codegen/org.eclipse.papyrus.acceleo.debug/icons/deploy.gif differ
diff --git a/extraplugins/codegen/org.eclipse.papyrus.acceleo.debug/plugin.properties b/extraplugins/codegen/org.eclipse.papyrus.acceleo.debug/plugin.properties
new file mode 100644
index 00000000000..30bf84aaf85
--- /dev/null
+++ b/extraplugins/codegen/org.eclipse.papyrus.acceleo.debug/plugin.properties
@@ -0,0 +1,12 @@
+###############################################################################
+# Copyright (c) 2013 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:
+# CEA LIST - initial API and implementation
+###############################################################################
+pluginName=Papyrus extra: Qompass Designer debug support (Incubation)
+providerName=Eclipse Modeling Project
diff --git a/extraplugins/codegen/org.eclipse.papyrus.acceleo.debug/plugin.xml b/extraplugins/codegen/org.eclipse.papyrus.acceleo.debug/plugin.xml
new file mode 100644
index 00000000000..2b41ea5541b
--- /dev/null
+++ b/extraplugins/codegen/org.eclipse.papyrus.acceleo.debug/plugin.xml
@@ -0,0 +1,80 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/extraplugins/codegen/org.eclipse.papyrus.acceleo.debug/src/org/eclipse/papyrus/qompass/designer/debug/Activator.java b/extraplugins/codegen/org.eclipse.papyrus.acceleo.debug/src/org/eclipse/papyrus/qompass/designer/debug/Activator.java
new file mode 100644
index 00000000000..0e46005680a
--- /dev/null
+++ b/extraplugins/codegen/org.eclipse.papyrus.acceleo.debug/src/org/eclipse/papyrus/qompass/designer/debug/Activator.java
@@ -0,0 +1,50 @@
+package org.eclipse.papyrus.qompass.designer.debug;
+
+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.qompass.designer.debug"; //$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;
+ }
+
+}
diff --git a/extraplugins/codegen/org.eclipse.papyrus.acceleo.debug/src/org/eclipse/papyrus/qompass/designer/debug/dialogs/TestAcceleoDialog.java b/extraplugins/codegen/org.eclipse.papyrus.acceleo.debug/src/org/eclipse/papyrus/qompass/designer/debug/dialogs/TestAcceleoDialog.java
new file mode 100644
index 00000000000..aebb2cee499
--- /dev/null
+++ b/extraplugins/codegen/org.eclipse.papyrus.acceleo.debug/src/org/eclipse/papyrus/qompass/designer/debug/dialogs/TestAcceleoDialog.java
@@ -0,0 +1,161 @@
+package org.eclipse.papyrus.qompass.designer.debug.dialogs;
+
+import org.eclipse.papyrus.acceleo.AcceleoDriver;
+import org.eclipse.papyrus.acceleo.AcceleoException;
+import org.eclipse.papyrus.infra.widgets.toolbox.utils.DialogUtils;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.layout.RowLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.dialogs.SelectionStatusDialog;
+import org.eclipse.uml2.uml.NamedElement;
+
+/**
+ * Select container rules, either from a list of globally defined rules or from
+ * local rules which may be created "on the fly" by this dialog.
+ *
+ * TODO: extend rule application to instances (problematic, since rules
+ * transformation is done on type level)
+ *
+ * @author ansgar
+ */
+public class TestAcceleoDialog extends SelectionStatusDialog {
+
+ protected NamedElement m_acceleoParam;
+
+ protected Text fTemplate;
+
+ protected Button fApplyAcceleoButton;
+
+ protected Text fOutput;
+
+ protected Text fErr;
+
+ protected static String saveTemplate = "";
+
+ public TestAcceleoDialog(Shell parent, NamedElement acceleoParam) {
+ super(parent);
+ m_acceleoParam = acceleoParam;
+ }
+
+ /**
+ * @see SelectionStatusDialog#computeResult()
+ */
+ protected void computeResult() {
+ // nothing to do
+ saveTemplate = fTemplate.getText();
+ }
+
+ public Control createDialogArea(Composite parent) {
+ Composite contents = (Composite)super.createDialogArea(parent);
+ // (parent, "Container rules", "Avail. extensions/interceptors");
+
+ createTextAcceleoGroup(contents);
+ return contents;
+ }
+
+ // create instance configuration group
+ protected void createTextAcceleoGroup(Composite parent) {
+ GridData groupGridData = DialogUtils.createFillGridData();
+
+ Group instanceConfigurationGroup = new Group(parent, SWT.BORDER);
+ instanceConfigurationGroup.setText(" Test Acceleo Template");
+ instanceConfigurationGroup.setLayout(new RowLayout(SWT.VERTICAL));
+ instanceConfigurationGroup.setLayout(new GridLayout(1, false));
+ instanceConfigurationGroup.setLayoutData(groupGridData);
+
+ GridData span2 = new GridData();
+ span2.horizontalAlignment = GridData.FILL;
+ span2.verticalAlignment = GridData.FILL;
+ span2.grabExcessHorizontalSpace = true;
+ span2.grabExcessVerticalSpace = true;
+ span2.widthHint = 400;
+ span2.heightHint = 150;
+
+ Label descriptionLabel = new Label(instanceConfigurationGroup, SWT.NONE);
+ descriptionLabel.setText("Template:");
+
+ fTemplate = new Text(instanceConfigurationGroup, SWT.WRAP
+ | SWT.V_SCROLL);
+ fTemplate.setLayoutData(span2);
+ fTemplate.setText(saveTemplate);
+
+ fApplyAcceleoButton = new Button(instanceConfigurationGroup, SWT.NONE);
+ fApplyAcceleoButton.setText("instantiate template");
+ fApplyAcceleoButton.addKeyListener(new KeyListener() {
+
+ public void keyReleased(KeyEvent e) {
+ }
+
+ public void keyPressed(KeyEvent e) {
+ System.out.println(e);
+ }
+ });
+ // fApplyAcceleoButton.setLayoutData(span2);
+ fApplyAcceleoButton.addSelectionListener(new SelectionListener() {
+
+ public void widgetSelected(SelectionEvent e) {
+ try {
+ AcceleoDriver.clearErrors();
+ String result = AcceleoDriver.bind(fTemplate.getText(), m_acceleoParam);
+ fOutput.setText(result);
+ fErr.setText("");
+ }
+ catch (AcceleoException err) {
+ fOutput.setText("");
+ fErr.setText(err.toString());
+ }
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+ });
+
+ Button fResetButton = new Button(instanceConfigurationGroup, SWT.NONE);
+ fResetButton.setText("reset acceleo driver (reread initial scripts)");
+ fResetButton.addSelectionListener(new SelectionListener() {
+
+ public void widgetSelected(SelectionEvent e) {
+ fOutput.setText("");
+ fErr.setText("");
+ AcceleoDriver.init();
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+ });
+
+ Label resultLabel = new Label(instanceConfigurationGroup, SWT.NONE);
+ resultLabel.setText("Result:");
+
+ fOutput = new Text(instanceConfigurationGroup, SWT.WRAP
+ | SWT.V_SCROLL | SWT.READ_ONLY);
+ fOutput.setLayoutData(span2);
+
+ Label errLabel = new Label(instanceConfigurationGroup, SWT.NONE);
+ errLabel.setText("Error:");
+
+ GridData span3 = new GridData();
+ span3.horizontalAlignment = GridData.FILL;
+ span3.verticalAlignment = GridData.FILL;
+ span3.grabExcessHorizontalSpace = true;
+ // span3.grabExcessVerticalSpace = true;
+ span3.heightHint = 50;
+
+ fErr = new Text(instanceConfigurationGroup, SWT.WRAP
+ | SWT.V_SCROLL | SWT.READ_ONLY);
+ fErr.setLayoutData(span3);
+ }
+
+}
diff --git a/extraplugins/codegen/org.eclipse.papyrus.acceleo.debug/src/org/eclipse/papyrus/qompass/designer/debug/handlers/ResetAcceleoHandler.java b/extraplugins/codegen/org.eclipse.papyrus.acceleo.debug/src/org/eclipse/papyrus/qompass/designer/debug/handlers/ResetAcceleoHandler.java
new file mode 100644
index 00000000000..f11260ead65
--- /dev/null
+++ b/extraplugins/codegen/org.eclipse.papyrus.acceleo.debug/src/org/eclipse/papyrus/qompass/designer/debug/handlers/ResetAcceleoHandler.java
@@ -0,0 +1,45 @@
+/*****************************************************************************
+ * 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.qompass.designer.debug.handlers;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.papyrus.acceleo.AcceleoDriver;
+import org.eclipse.papyrus.acceleo.ui.handlers.CmdHandler;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.NamedElement;
+
+public class ResetAcceleoHandler extends CmdHandler {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isEnabled() {
+ updateSelectedEObject();
+ if(selectedEObject instanceof Element) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ if(selectedEObject instanceof NamedElement) {
+ AcceleoDriver.init();
+ }
+ return null;
+ }
+}
diff --git a/extraplugins/codegen/org.eclipse.papyrus.acceleo.debug/src/org/eclipse/papyrus/qompass/designer/debug/handlers/TestAcceleoHandler.java b/extraplugins/codegen/org.eclipse.papyrus.acceleo.debug/src/org/eclipse/papyrus/qompass/designer/debug/handlers/TestAcceleoHandler.java
new file mode 100644
index 00000000000..71f287085c2
--- /dev/null
+++ b/extraplugins/codegen/org.eclipse.papyrus.acceleo.debug/src/org/eclipse/papyrus/qompass/designer/debug/handlers/TestAcceleoHandler.java
@@ -0,0 +1,53 @@
+/*****************************************************************************
+ * 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.qompass.designer.debug.handlers;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.papyrus.acceleo.ui.handlers.CmdHandler;
+import org.eclipse.papyrus.qompass.designer.debug.dialogs.TestAcceleoDialog;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.uml2.uml.NamedElement;
+
+/**
+ * Test the Acceleo handler: call a dialog that opens the
+ * @author ansgar
+ *
+ */
+public class TestAcceleoHandler extends CmdHandler {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isEnabled() {
+ updateSelectedEObject();
+ if(selectedEObject instanceof NamedElement) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ if(selectedEObject instanceof NamedElement) {
+ NamedElement selectedNE = (NamedElement)selectedEObject;
+
+ TestAcceleoDialog tag = new TestAcceleoDialog(new Shell(), selectedNE);
+ tag.open();
+ }
+ return null;
+ }
+}
--
cgit v1.2.3