Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/developer/org.eclipse.papyrus.mwe2.utils/.classpath7
-rw-r--r--plugins/developer/org.eclipse.papyrus.mwe2.utils/.project34
-rw-r--r--plugins/developer/org.eclipse.papyrus.mwe2.utils/.settings/org.eclipse.core.resources.prefs2
-rw-r--r--plugins/developer/org.eclipse.papyrus.mwe2.utils/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--plugins/developer/org.eclipse.papyrus.mwe2.utils/META-INF/MANIFEST.MF17
-rw-r--r--plugins/developer/org.eclipse.papyrus.mwe2.utils/OSGI-INF/l10n/bundle.properties3
-rw-r--r--plugins/developer/org.eclipse.papyrus.mwe2.utils/about.html28
-rw-r--r--plugins/developer/org.eclipse.papyrus.mwe2.utils/build.properties7
-rw-r--r--plugins/developer/org.eclipse.papyrus.mwe2.utils/src/org/eclipse/papyrus/mwe2/utils/Activator.java40
-rw-r--r--plugins/developer/org.eclipse.papyrus.mwe2.utils/src/org/eclipse/papyrus/mwe2/utils/components/QvtoTransformationWorkflowComponent.java146
-rw-r--r--plugins/developer/org.eclipse.papyrus.mwe2.utils/src/org/eclipse/papyrus/mwe2/utils/components/RegisterUmlProfileComponent.java73
-rw-r--r--plugins/developer/org.eclipse.papyrus.mwe2.utils/src/org/eclipse/papyrus/mwe2/utils/messages/Messages.java27
-rw-r--r--plugins/developer/org.eclipse.papyrus.mwe2.utils/src/org/eclipse/papyrus/mwe2/utils/messages/messages.properties6
13 files changed, 397 insertions, 0 deletions
diff --git a/plugins/developer/org.eclipse.papyrus.mwe2.utils/.classpath b/plugins/developer/org.eclipse.papyrus.mwe2.utils/.classpath
new file mode 100644
index 00000000000..8a8f1668cdc
--- /dev/null
+++ b/plugins/developer/org.eclipse.papyrus.mwe2.utils/.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.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/developer/org.eclipse.papyrus.mwe2.utils/.project b/plugins/developer/org.eclipse.papyrus.mwe2.utils/.project
new file mode 100644
index 00000000000..020a0c5a318
--- /dev/null
+++ b/plugins/developer/org.eclipse.papyrus.mwe2.utils/.project
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.mwe2.utils</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>
+ <buildCommand>
+ <name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/developer/org.eclipse.papyrus.mwe2.utils/.settings/org.eclipse.core.resources.prefs b/plugins/developer/org.eclipse.papyrus.mwe2.utils/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 00000000000..daf82ed330d
--- /dev/null
+++ b/plugins/developer/org.eclipse.papyrus.mwe2.utils/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+encoding//src/org/eclipse/papyrus/mwe2/utils/messages/messages.properties=ISO-8859-1
diff --git a/plugins/developer/org.eclipse.papyrus.mwe2.utils/.settings/org.eclipse.jdt.core.prefs b/plugins/developer/org.eclipse.papyrus.mwe2.utils/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..f287d53cf45
--- /dev/null
+++ b/plugins/developer/org.eclipse.papyrus.mwe2.utils/.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.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
diff --git a/plugins/developer/org.eclipse.papyrus.mwe2.utils/META-INF/MANIFEST.MF b/plugins/developer/org.eclipse.papyrus.mwe2.utils/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..39d8ad7bf12
--- /dev/null
+++ b/plugins/developer/org.eclipse.papyrus.mwe2.utils/META-INF/MANIFEST.MF
@@ -0,0 +1,17 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %Bundle-Name
+Bundle-SymbolicName: org.eclipse.papyrus.mwe2.utils
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.eclipse.papyrus.mwe2.utils.Activator
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.emf.mwe.core,
+ org.eclipse.uml2.uml,
+ org.apache.commons.logging,
+ org.eclipse.m2m.qvt.oml
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-ActivationPolicy: lazy
+Export-Package: org.eclipse.papyrus.mwe2.utils,
+ org.eclipse.papyrus.mwe2.utils.components,
+ org.eclipse.papyrus.mwe2.utils.messages
+Bundle-Vendor: %Bundle-Vendor
diff --git a/plugins/developer/org.eclipse.papyrus.mwe2.utils/OSGI-INF/l10n/bundle.properties b/plugins/developer/org.eclipse.papyrus.mwe2.utils/OSGI-INF/l10n/bundle.properties
new file mode 100644
index 00000000000..7ef28ac1e98
--- /dev/null
+++ b/plugins/developer/org.eclipse.papyrus.mwe2.utils/OSGI-INF/l10n/bundle.properties
@@ -0,0 +1,3 @@
+#Properties file for org.eclipse.papyrus.mwe2.utils
+Bundle-Name = MWE2 custom components for modeling workflows
+Bundle-Vendor = Eclipse Modeling Project \ No newline at end of file
diff --git a/plugins/developer/org.eclipse.papyrus.mwe2.utils/about.html b/plugins/developer/org.eclipse.papyrus.mwe2.utils/about.html
new file mode 100644
index 00000000000..82d49bf5f81
--- /dev/null
+++ b/plugins/developer/org.eclipse.papyrus.mwe2.utils/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 5, 2007</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) 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 <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
diff --git a/plugins/developer/org.eclipse.papyrus.mwe2.utils/build.properties b/plugins/developer/org.eclipse.papyrus.mwe2.utils/build.properties
new file mode 100644
index 00000000000..804b2d39ad6
--- /dev/null
+++ b/plugins/developer/org.eclipse.papyrus.mwe2.utils/build.properties
@@ -0,0 +1,7 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ OSGI-INF/l10n/bundle.properties,\
+ about.html
+src.includes = about.html
diff --git a/plugins/developer/org.eclipse.papyrus.mwe2.utils/src/org/eclipse/papyrus/mwe2/utils/Activator.java b/plugins/developer/org.eclipse.papyrus.mwe2.utils/src/org/eclipse/papyrus/mwe2/utils/Activator.java
new file mode 100644
index 00000000000..e4a37634fd7
--- /dev/null
+++ b/plugins/developer/org.eclipse.papyrus.mwe2.utils/src/org/eclipse/papyrus/mwe2/utils/Activator.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * 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:
+ * Juan Cadavid <juan.cadavid@cea.fr> implementation
+ ******************************************************************************/
+package org.eclipse.papyrus.mwe2.utils;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+public class Activator implements BundleActivator {
+
+ private static BundleContext context;
+
+ static BundleContext getContext() {
+ return context;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext bundleContext) throws Exception {
+ Activator.context = bundleContext;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext bundleContext) throws Exception {
+ Activator.context = null;
+ }
+
+}
diff --git a/plugins/developer/org.eclipse.papyrus.mwe2.utils/src/org/eclipse/papyrus/mwe2/utils/components/QvtoTransformationWorkflowComponent.java b/plugins/developer/org.eclipse.papyrus.mwe2.utils/src/org/eclipse/papyrus/mwe2/utils/components/QvtoTransformationWorkflowComponent.java
new file mode 100644
index 00000000000..a88492f94cc
--- /dev/null
+++ b/plugins/developer/org.eclipse.papyrus.mwe2.utils/src/org/eclipse/papyrus/mwe2/utils/components/QvtoTransformationWorkflowComponent.java
@@ -0,0 +1,146 @@
+/*******************************************************************************
+ * 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:
+ * Juan Cadavid <juan.cadavid@cea.fr> implementation
+ ******************************************************************************/
+package org.eclipse.papyrus.mwe2.utils.components;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.eclipse.emf.common.util.Diagnostic;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.mwe.core.WorkflowContext;
+import org.eclipse.emf.mwe.core.issues.Issues;
+import org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent;
+import org.eclipse.emf.mwe.core.monitor.ProgressMonitor;
+import org.eclipse.m2m.qvt.oml.BasicModelExtent;
+import org.eclipse.m2m.qvt.oml.ExecutionContextImpl;
+import org.eclipse.m2m.qvt.oml.ExecutionDiagnostic;
+import org.eclipse.m2m.qvt.oml.ModelExtent;
+import org.eclipse.m2m.qvt.oml.TransformationExecutor;
+import org.eclipse.papyrus.mwe2.utils.messages.Messages;
+
+/**
+ * MWE Component to execute QVTO transformations. An example of use is:
+ * <blockquote>
+ * component = org.eclipse.papyrus.mwe.utils.components.QvtoTransformationWorkflowComponent {
+ inputSlots = 'inputGmfgen'
+ inputSlots = 'gmfgenUmlMetamodel'
+ transformationURI = 'platform:/resource/org.eclipse.papyrus.tests.framework/qvto/gmfgen2uml.qvto'
+ outputSlot = 'inputGmfgenUml'
+ }
+ </blockquote>
+ * where the multi-valued input slots are the input parameters for the transformation;
+ * there should be as many as there are declared in the qvto file;
+ * transformationURI is the location of the .qvto file and outputSlot the slot where
+ * the list of resulting eObjects of the transformation will be placed.
+ *
+ */
+public class QvtoTransformationWorkflowComponent extends
+ AbstractWorkflowComponent {
+
+ private String transformationURI;
+ private String outputSlot;
+ private ArrayList<String> inputSlots = new ArrayList<String>();
+ private Log log = LogFactory.getLog(getClass());
+
+ public String getTransformationURI() {
+ return transformationURI;
+ }
+
+ public void setTransformationURI(String transformationURI) {
+ this.transformationURI = transformationURI;
+ }
+
+ public String getOutputSlot() {
+ return outputSlot;
+ }
+
+ public void setOutputSlot(String outputSlot) {
+ this.outputSlot = outputSlot;
+ }
+
+ public boolean addInputSlots(String c) {
+ return inputSlots.add(c);
+ }
+
+ public ExecutionDiagnostic generate(List<? extends EObject> inObjects,
+ URI transformationURI, WorkflowContext ctx, Issues issues)
+ throws IOException {
+ //resolveProxies(inObjects);
+ TransformationExecutor executor = new TransformationExecutor(
+ transformationURI);
+ Diagnostic loadTransformationDiagnostic = executor.loadTransformation();
+ if (!loadTransformationDiagnostic.getMessage().equals("OK")) { //$NON-NLS-1$
+ log.error(Messages.QvtoTransformationWorkflowComponent_1
+ + loadTransformationDiagnostic);
+ return null;
+ }
+ ExecutionContextImpl context = new ExecutionContextImpl();
+ ArrayList<ModelExtent> input = new ArrayList<ModelExtent>();
+ for (EObject eObject : inObjects) {
+ BasicModelExtent basicModelExtent = new BasicModelExtent();
+ basicModelExtent.add(eObject);
+ input.add(basicModelExtent);
+ }
+ issues.addInfo(new File("..").getAbsolutePath()); //$NON-NLS-1$
+ ModelExtent output = new BasicModelExtent();
+ input.add(output);
+ ModelExtent[] modelParameters = input.toArray(new ModelExtent[] {});
+ context = new ExecutionContextImpl();
+ context.setConfigProperty("keepModeling", true); //$NON-NLS-1$
+ ExecutionDiagnostic result = executor.execute(context, modelParameters);
+ if (result.getSeverity() == Diagnostic.OK) {
+ List<EObject> outObjects = output.getContents();
+ ctx.set(getOutputSlot(), outObjects);
+ log.info(Messages.QvtoTransformationWorkflowComponent_4 + getTransformationURI());
+ } else {
+ issues.addError(result.toString());
+ }
+ return result;
+ }
+
+ @Override
+ protected void invokeInternal(WorkflowContext ctx, ProgressMonitor monitor,
+ Issues issues) {
+ List<EObject> inObjects = new ArrayList<EObject>();
+ for (String inputSlot : inputSlots) {
+
+ Object inputObject = ctx.get(inputSlot);
+ if(inputObject instanceof EObject){
+ inObjects.add((EObject) inputObject);
+ }else if(inputObject instanceof List<?>){
+ List<EObject> list = (List<EObject>) inputObject;
+ inObjects.add((EObject) list.get(0));
+ }
+ }
+ try {
+ generate(inObjects, URI.createURI(transformationURI),
+ ctx, issues);
+ } catch (IOException e) {
+ log.error(e.getLocalizedMessage());
+ }
+
+ }
+
+ @Override
+ public void checkConfiguration(Issues issues) {
+ if (inputSlots.isEmpty()) {
+ issues.addError(Messages.QvtoTransformationWorkflowComponent_5);
+ }
+ }
+
+
+
+}
diff --git a/plugins/developer/org.eclipse.papyrus.mwe2.utils/src/org/eclipse/papyrus/mwe2/utils/components/RegisterUmlProfileComponent.java b/plugins/developer/org.eclipse.papyrus.mwe2.utils/src/org/eclipse/papyrus/mwe2/utils/components/RegisterUmlProfileComponent.java
new file mode 100644
index 00000000000..26c2f305ee8
--- /dev/null
+++ b/plugins/developer/org.eclipse.papyrus.mwe2.utils/src/org/eclipse/papyrus/mwe2/utils/components/RegisterUmlProfileComponent.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * 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:
+ * Juan Cadavid <juan.cadavid@cea.fr> implementation
+ ******************************************************************************/
+package org.eclipse.papyrus.mwe2.utils.components;
+
+
+import org.apache.commons.logging.LogFactory;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.mwe.core.WorkflowContext;
+import org.eclipse.emf.mwe.core.issues.Issues;
+import org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent;
+import org.eclipse.emf.mwe.core.monitor.ProgressMonitor;
+import org.eclipse.papyrus.mwe2.utils.messages.Messages;
+import org.eclipse.uml2.uml.Profile;
+
+/**
+ * This MWE component registers the EPackage definition of a UML profile in the global EPackage registry.
+ * An example of its usage is:
+ * <blockquote>
+ * component = org.eclipse.papyrus.mwe.utils.components.RegisterUmlProfile {
+ profileSlot = 'ecoreprofile'
+ }
+ </blockquote>
+ * where profileSlot is a slot that contains the uml Profile object to register.
+ */
+public class RegisterUmlProfileComponent extends AbstractWorkflowComponent {
+ private org.apache.commons.logging.Log log = LogFactory.getLog(getClass());
+
+
+ private String profileSlot;
+
+ public String getProfileSlot() {
+ return profileSlot;
+ }
+
+ public void setProfileSlot(String profileSlot) {
+ this.profileSlot = profileSlot;
+ }
+
+ public void checkConfiguration(Issues issues) {
+ if(profileSlot == null || profileSlot.equals("")){ //$NON-NLS-1$
+ issues.addError(Messages.RegisterUmlProfile_1);
+ }
+ }
+
+ @Override
+ protected void invokeInternal(WorkflowContext ctx, ProgressMonitor monitor,
+ Issues issues) {
+ EObject eObject = (EObject) ctx.get(profileSlot);
+ if(!(eObject instanceof Profile)){
+ log.error(Messages.RegisterUmlProfile_2);
+ return;
+ }
+ Profile profile = (Profile) eObject;
+ EPackage definition = profile.getDefinition();
+ if(definition == null){
+ log.error(Messages.RegisterUmlProfile_3);
+ return;
+ }
+ EPackage.Registry.INSTANCE.put(definition.getNsURI(), definition);
+ }
+
+
+
+}
diff --git a/plugins/developer/org.eclipse.papyrus.mwe2.utils/src/org/eclipse/papyrus/mwe2/utils/messages/Messages.java b/plugins/developer/org.eclipse.papyrus.mwe2.utils/src/org/eclipse/papyrus/mwe2/utils/messages/Messages.java
new file mode 100644
index 00000000000..99713cd0275
--- /dev/null
+++ b/plugins/developer/org.eclipse.papyrus.mwe2.utils/src/org/eclipse/papyrus/mwe2/utils/messages/Messages.java
@@ -0,0 +1,27 @@
+package org.eclipse.papyrus.mwe2.utils.messages;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+
+ private static final String BUNDLE_NAME = "org.eclipse.papyrus.mwe.utils.messages.messages"; //$NON-NLS-1$
+
+ public static String QvtoTransformationWorkflowComponent_1;
+
+ public static String QvtoTransformationWorkflowComponent_4;
+
+ public static String QvtoTransformationWorkflowComponent_5;
+
+ public static String RegisterUmlProfile_1;
+
+ public static String RegisterUmlProfile_2;
+
+ public static String RegisterUmlProfile_3;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
diff --git a/plugins/developer/org.eclipse.papyrus.mwe2.utils/src/org/eclipse/papyrus/mwe2/utils/messages/messages.properties b/plugins/developer/org.eclipse.papyrus.mwe2.utils/src/org/eclipse/papyrus/mwe2/utils/messages/messages.properties
new file mode 100644
index 00000000000..4b99391e951
--- /dev/null
+++ b/plugins/developer/org.eclipse.papyrus.mwe2.utils/src/org/eclipse/papyrus/mwe2/utils/messages/messages.properties
@@ -0,0 +1,6 @@
+QvtoTransformationWorkflowComponent_1=Error loading the model transformation:
+QvtoTransformationWorkflowComponent_4=Successful QVTO transformation
+QvtoTransformationWorkflowComponent_5=No input slots given for the QVTO transformation
+RegisterUmlProfile_1=Profile URI not provided
+RegisterUmlProfile_2=The profile URI does not contain a Profile object
+RegisterUmlProfile_3=The profile has not been defined

Back to the top