Merge "Bug 525494 - [PapyrusReq] Implemetation of derived properties in PapyrusRE profile"
diff --git a/plugins/gendoc/org.eclipse.papyrus.requirements.gendoc.queries/.classpath b/plugins/gendoc/org.eclipse.papyrus.requirements.gendoc.queries/.classpath
new file mode 100644
index 0000000..ad32c83
--- /dev/null
+++ b/plugins/gendoc/org.eclipse.papyrus.requirements.gendoc.queries/.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/gendoc/org.eclipse.papyrus.requirements.gendoc.queries/.project b/plugins/gendoc/org.eclipse.papyrus.requirements.gendoc.queries/.project
new file mode 100644
index 0000000..05fe74d
--- /dev/null
+++ b/plugins/gendoc/org.eclipse.papyrus.requirements.gendoc.queries/.project
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.requirements.gendoc.queries</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.acceleo.ide.ui.acceleoBuilder</name>
+ <arguments>
+ <dictionary>
+ <key>compilation.kind</key>
+ <value>compilation.platform.resource</value>
+ </dictionary>
+ <dictionary>
+ <key>compliance</key>
+ <value>pragmatic</value>
+ </dictionary>
+ <dictionary>
+ <key>resource.kind</key>
+ <value>xmi</value>
+ </dictionary>
+ <dictionary>
+ <key>trim-position</key>
+ <value>false</value>
+ </dictionary>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.acceleo.ide.ui.acceleoNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/gendoc/org.eclipse.papyrus.requirements.gendoc.queries/.settings/org.eclipse.jdt.core.prefs b/plugins/gendoc/org.eclipse.papyrus.requirements.gendoc.queries/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..ef8a789
--- /dev/null
+++ b/plugins/gendoc/org.eclipse.papyrus.requirements.gendoc.queries/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,12 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+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/gendoc/org.eclipse.papyrus.requirements.gendoc.queries/META-INF/MANIFEST.MF b/plugins/gendoc/org.eclipse.papyrus.requirements.gendoc.queries/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..eba3ae1
--- /dev/null
+++ b/plugins/gendoc/org.eclipse.papyrus.requirements.gendoc.queries/META-INF/MANIFEST.MF
@@ -0,0 +1,15 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.papyrus.requirements.gendoc.queries;singleton:=true
+Bundle-Version: 0.3.0.qualifier
+Bundle-Activator: org.eclipse.papyrus.requirements.gendoc.queries.Activator
+Bundle-Vendor: %providerName
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.uml2.uml,
+ org.eclipse.gendoc.script.acceleo;bundle-version="0.5.0",
+ org.eclipse.papyrus.sysml14;bundle-version="0.11.0"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-ActivationPolicy: lazy
+Export-Package: org.eclipse.papyrus.requirements.gendoc.queries
diff --git a/plugins/gendoc/org.eclipse.papyrus.requirements.gendoc.queries/about.html b/plugins/gendoc/org.eclipse.papyrus.requirements.gendoc.queries/about.html
new file mode 100644
index 0000000..d35d5ae
--- /dev/null
+++ b/plugins/gendoc/org.eclipse.papyrus.requirements.gendoc.queries/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 ("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 <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, "Program" 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 ("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 <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
diff --git a/plugins/gendoc/org.eclipse.papyrus.requirements.gendoc.queries/build.properties b/plugins/gendoc/org.eclipse.papyrus.requirements.gendoc.queries/build.properties
new file mode 100644
index 0000000..f821c6c
--- /dev/null
+++ b/plugins/gendoc/org.eclipse.papyrus.requirements.gendoc.queries/build.properties
@@ -0,0 +1,10 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ src/,\
+ bin/
+src.includes = about.html,\
+ plugin.xml,\
+ src/
diff --git a/plugins/gendoc/org.eclipse.papyrus.requirements.gendoc.queries/plugin.properties b/plugins/gendoc/org.eclipse.papyrus.requirements.gendoc.queries/plugin.properties
new file mode 100644
index 0000000..9d5d9bb
--- /dev/null
+++ b/plugins/gendoc/org.eclipse.papyrus.requirements.gendoc.queries/plugin.properties
@@ -0,0 +1,4 @@
+#
+
+pluginName = PO Queries for Gendoc2
+providerName = CEA LIST
diff --git a/plugins/gendoc/org.eclipse.papyrus.requirements.gendoc.queries/plugin.xml b/plugins/gendoc/org.eclipse.papyrus.requirements.gendoc.queries/plugin.xml
new file mode 100644
index 0000000..f4d4380
--- /dev/null
+++ b/plugins/gendoc/org.eclipse.papyrus.requirements.gendoc.queries/plugin.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.gendoc.script.acceleo.services">
+ <service
+ emtl="bin/org/eclipse/papyrus/requirements/gendoc/queries/SysML_Queries.emtl"
+ importedByDefault="true"
+ name="SysML_Queries">
+ </service>
+ </extension>
+
+</plugin>
diff --git a/plugins/gendoc/org.eclipse.papyrus.requirements.gendoc.queries/src/org/eclipse/papyrus/requirements/gendoc/queries/Activator.java b/plugins/gendoc/org.eclipse.papyrus.requirements.gendoc.queries/src/org/eclipse/papyrus/requirements/gendoc/queries/Activator.java
new file mode 100644
index 0000000..5ac404d
--- /dev/null
+++ b/plugins/gendoc/org.eclipse.papyrus.requirements.gendoc.queries/src/org/eclipse/papyrus/requirements/gendoc/queries/Activator.java
@@ -0,0 +1,66 @@
+/*****************************************************************************
+ * Copyright (c) 2017 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:
+ *
+ * Patrick Tessier (Patrick.tessier@cea.fr) CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.requirements.gendoc.queries;
+
+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 = "com.cea.papyrus.gendoc2.custom.services"; //$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/plugins/gendoc/org.eclipse.papyrus.requirements.gendoc.queries/src/org/eclipse/papyrus/requirements/gendoc/queries/SysML_Queries.java b/plugins/gendoc/org.eclipse.papyrus.requirements.gendoc.queries/src/org/eclipse/papyrus/requirements/gendoc/queries/SysML_Queries.java
new file mode 100644
index 0000000..41d387c
--- /dev/null
+++ b/plugins/gendoc/org.eclipse.papyrus.requirements.gendoc.queries/src/org/eclipse/papyrus/requirements/gendoc/queries/SysML_Queries.java
@@ -0,0 +1,137 @@
+/*****************************************************************************
+ * Copyright (c) 2017 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:
+ *
+ * Patrick Tessier (Patrick.tessier@cea.fr) CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.requirements.gendoc.queries;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.papyrus.sysml14.requirements.Requirement;
+import org.eclipse.uml2.uml.Class;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.Model;
+import org.eclipse.uml2.uml.NamedElement;
+import org.eclipse.uml2.uml.util.UMLUtil;
+
+/**
+ * this class contains all operation that can be called by SyML_Queries.mtl
+ *
+ */
+public class SysML_Queries {
+
+ /**
+ *
+ * @param element
+ * the given element
+ * @param stereotypeName
+ * the name of the stereotype
+ * @param propertyName
+ * the name of the property
+ * @return the value of the property of the stereotype.
+ */
+ public static String getStringValue(Element element, String stereotypeName, String propertyName) {
+ Object value = element.getValue(element.getAppliedStereotype(stereotypeName), propertyName);
+
+ String listValue = "[";
+ if (value instanceof EList) {
+ if (!((EList<?>) value).isEmpty()) {
+ if (((EList<?>) value).get(0) instanceof NamedElement) {
+ @SuppressWarnings("unchecked")
+ EList<NamedElement> namedElementList = (EList<NamedElement>) value;
+ for (NamedElement namedElement : namedElementList) {
+ listValue += namedElement.getName() + ", ";
+ }
+ listValue += "]";
+ return listValue;
+ }
+ }
+ }
+
+ else {
+ if (value instanceof NamedElement)
+ return ((NamedElement) value).getName();
+ else
+ return (String) value;
+ }
+
+ return null;
+ }
+
+ /**
+ *
+ * @param model
+ * @return the number of requirement contained in the model
+ */
+ static public String countReq(Model model) {
+ int counter = 0;
+ Iterator<EObject> iterator = model.eAllContents();
+ while (iterator.hasNext()) {
+ EObject eObject = (EObject) iterator.next();
+ if ((eObject instanceof org.eclipse.uml2.uml.Class)
+ && (UMLUtil.getStereotypeApplication(((org.eclipse.uml2.uml.Class) eObject), Requirement.class) != null)) {
+ counter++;
+ }
+ }
+ return "" + counter;
+ }
+
+ /**
+ *
+ * @param model
+ * @return a string that is the list of requirement with id and text
+ */
+ static public String basicPrintReq(Model model) {
+ String out = "";
+ int index = 0;
+ Iterator<EObject> iterator = model.eAllContents();
+ while (iterator.hasNext()) {
+ EObject eObject = (EObject) iterator.next();
+ if ((eObject instanceof org.eclipse.uml2.uml.Class)
+ && (UMLUtil.getStereotypeApplication(((org.eclipse.uml2.uml.Class) eObject), Requirement.class) != null)) {
+ Requirement req = UMLUtil.getStereotypeApplication(((org.eclipse.uml2.uml.Class) eObject), Requirement.class);
+ if (index < 10) {
+ out = out + req.getId() + ":" + req.getText() + "\n\n";
+ }
+ index++;
+ }
+
+ }
+ return out;
+ }
+
+ /**
+ * get all requirements contained in the model and give it inside a simple collection
+ *
+ * @param model
+ * @return a simple collection of requirements
+ */
+ static public ArrayList<NamedElement> getAllReq(org.eclipse.uml2.uml.Package model) {
+ ArrayList<NamedElement> result = new ArrayList<NamedElement>();
+ Iterator<EObject> iterator = model.eAllContents();
+ while (iterator.hasNext()) {
+ EObject eObject = (EObject) iterator.next();
+ if ((eObject instanceof org.eclipse.uml2.uml.Class)
+ && (UMLUtil.getStereotypeApplication(((org.eclipse.uml2.uml.Class) eObject), Requirement.class) != null)) {
+ Class currentReq = (Class) eObject;
+ result.add(currentReq);
+ }
+
+ }
+ return result;
+ }
+
+}
\ No newline at end of file
diff --git a/plugins/gendoc/org.eclipse.papyrus.requirements.gendoc.queries/src/org/eclipse/papyrus/requirements/gendoc/queries/SysML_Queries.mtl b/plugins/gendoc/org.eclipse.papyrus.requirements.gendoc.queries/src/org/eclipse/papyrus/requirements/gendoc/queries/SysML_Queries.mtl
new file mode 100644
index 0000000..36d7370
--- /dev/null
+++ b/plugins/gendoc/org.eclipse.papyrus.requirements.gendoc.queries/src/org/eclipse/papyrus/requirements/gendoc/queries/SysML_Queries.mtl
@@ -0,0 +1,19 @@
+[comment encoding = UTF-8 /]
+[module SysML_Queries('http://www.eclipse.org/uml2/4.0.0/UML', 'http://www.eclipse.org/papyrus/sysml/1.4/SysML')]
+
+[query public getStringValue(elt : Element,stereotypeName : String, propertyName:String) : String =
+ invoke('org.eclipse.papyrus.requirements.gendoc.queries.SysML_Queries', 'getStringValue(org.eclipse.uml2.uml.Element, java.lang.String, java.lang.String)', Sequence{elt,stereotypeName,propertyName})
+/]
+
+[query public countReq(elt : Model) : String =
+ invoke('org.eclipse.papyrus.requirements.gendoc.queries.SysML_Queries', 'countReq(org.eclipse.uml2.uml.Model)', Sequence{elt})
+/]
+
+[query public getAllReq(elt : Package) : Sequence(NamedElement) =
+ invoke('org.eclipse.papyrus.requirements.gendoc.queries.SysML_Queries', 'getAllReq(org.eclipse.uml2.uml.Package)', Sequence{elt})
+/]
+
+
+[query public basicPrintReq(elt : Model) : String =
+ invoke('org.eclipse.papyrus.requirements.gendoc.queries.SysML_Queries', 'basicPrintReq(org.eclipse.uml2.uml.Model)', Sequence{elt})
+/]
diff --git a/plugins/gendoc/org.eclipse.papyrus.requirements.gendoc.templates/.classpath b/plugins/gendoc/org.eclipse.papyrus.requirements.gendoc.templates/.classpath
new file mode 100644
index 0000000..ad32c83
--- /dev/null
+++ b/plugins/gendoc/org.eclipse.papyrus.requirements.gendoc.templates/.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/gendoc/org.eclipse.papyrus.requirements.gendoc.templates/.project b/plugins/gendoc/org.eclipse.papyrus.requirements.gendoc.templates/.project
new file mode 100644
index 0000000..158ed67
--- /dev/null
+++ b/plugins/gendoc/org.eclipse.papyrus.requirements.gendoc.templates/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.requirements.gendoc.templates</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.jdt.core.javanature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/gendoc/org.eclipse.papyrus.requirements.gendoc.templates/.settings/org.eclipse.jdt.core.prefs b/plugins/gendoc/org.eclipse.papyrus.requirements.gendoc.templates/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..ef8a789
--- /dev/null
+++ b/plugins/gendoc/org.eclipse.papyrus.requirements.gendoc.templates/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,12 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+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/gendoc/org.eclipse.papyrus.requirements.gendoc.templates/META-INF/MANIFEST.MF b/plugins/gendoc/org.eclipse.papyrus.requirements.gendoc.templates/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..7272ff0
--- /dev/null
+++ b/plugins/gendoc/org.eclipse.papyrus.requirements.gendoc.templates/META-INF/MANIFEST.MF
@@ -0,0 +1,15 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.papyrus.requirements.gendoc.templates;singleton:=true
+Bundle-Version: 0.3.0.qualifier
+Bundle-Activator: org.eclipse.papyrus.gendoc.custom.templates.Activator
+Bundle-Vendor: %providerName
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.gendoc.wizard.papyrus;bundle-version="0.5.0",
+ org.eclipse.gendoc.bundle.acceleo.papyrus;bundle-version="0.5.0",
+ org.eclipse.gendoc.wizard;bundle-version="0.5.0",
+ org.eclipse.gendoc.wizard.gmf;bundle-version="0.5.0"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-ActivationPolicy: lazy
diff --git a/plugins/gendoc/org.eclipse.papyrus.requirements.gendoc.templates/about.html b/plugins/gendoc/org.eclipse.papyrus.requirements.gendoc.templates/about.html
new file mode 100644
index 0000000..d35d5ae
--- /dev/null
+++ b/plugins/gendoc/org.eclipse.papyrus.requirements.gendoc.templates/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 ("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 <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, "Program" 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 ("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 <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
diff --git a/plugins/gendoc/org.eclipse.papyrus.requirements.gendoc.templates/build.properties b/plugins/gendoc/org.eclipse.papyrus.requirements.gendoc.templates/build.properties
new file mode 100644
index 0000000..8dc1b37
--- /dev/null
+++ b/plugins/gendoc/org.eclipse.papyrus.requirements.gendoc.templates/build.properties
@@ -0,0 +1,10 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ .settings/,\
+ build.properties,\
+ resources/,\
+ src/
+src.includes = src/
diff --git a/plugins/gendoc/org.eclipse.papyrus.requirements.gendoc.templates/plugin.properties b/plugins/gendoc/org.eclipse.papyrus.requirements.gendoc.templates/plugin.properties
new file mode 100644
index 0000000..71fe200
--- /dev/null
+++ b/plugins/gendoc/org.eclipse.papyrus.requirements.gendoc.templates/plugin.properties
@@ -0,0 +1,4 @@
+#
+
+pluginName = PO Templates for Gendoc2
+providerName = CEA LIST
diff --git a/plugins/gendoc/org.eclipse.papyrus.requirements.gendoc.templates/plugin.xml b/plugins/gendoc/org.eclipse.papyrus.requirements.gendoc.templates/plugin.xml
new file mode 100644
index 0000000..98ec19c
--- /dev/null
+++ b/plugins/gendoc/org.eclipse.papyrus.requirements.gendoc.templates/plugin.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.gendoc.wizard.runner">
+ <GendocElement
+ Instance="org.eclipse.papyrus.gendoc.custom.templates.RequirementsGendoc2Runner">
+ </GendocElement>
+ </extension>
+
+</plugin>
diff --git a/plugins/gendoc/org.eclipse.papyrus.requirements.gendoc.templates/resources/RequirementDoc.docx b/plugins/gendoc/org.eclipse.papyrus.requirements.gendoc.templates/resources/RequirementDoc.docx
new file mode 100644
index 0000000..794459a
--- /dev/null
+++ b/plugins/gendoc/org.eclipse.papyrus.requirements.gendoc.templates/resources/RequirementDoc.docx
Binary files differ
diff --git a/plugins/gendoc/org.eclipse.papyrus.requirements.gendoc.templates/src/org/eclipse/papyrus/gendoc/custom/templates/Activator.java b/plugins/gendoc/org.eclipse.papyrus.requirements.gendoc.templates/src/org/eclipse/papyrus/gendoc/custom/templates/Activator.java
new file mode 100644
index 0000000..afaeeed
--- /dev/null
+++ b/plugins/gendoc/org.eclipse.papyrus.requirements.gendoc.templates/src/org/eclipse/papyrus/gendoc/custom/templates/Activator.java
@@ -0,0 +1,66 @@
+/*****************************************************************************
+ * Copyright (c) 2017 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:
+ *
+ * Patrick Tessier (Patrick.tessier@cea.fr) CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.gendoc.custom.templates;
+
+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 = "com.cea.papyrus.gendoc.custom.templates"; //$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/plugins/gendoc/org.eclipse.papyrus.requirements.gendoc.templates/src/org/eclipse/papyrus/gendoc/custom/templates/Gendoc2RunnerDocxRequirements.java b/plugins/gendoc/org.eclipse.papyrus.requirements.gendoc.templates/src/org/eclipse/papyrus/gendoc/custom/templates/Gendoc2RunnerDocxRequirements.java
new file mode 100644
index 0000000..8f2424e
--- /dev/null
+++ b/plugins/gendoc/org.eclipse.papyrus.requirements.gendoc.templates/src/org/eclipse/papyrus/gendoc/custom/templates/Gendoc2RunnerDocxRequirements.java
@@ -0,0 +1,56 @@
+/*****************************************************************************
+ * Copyright (c) 2017 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:
+ *
+ * Patrick Tessier (Patrick.tessier@cea.fr) CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.gendoc.custom.templates;
+
+import java.net.URL;
+
+import org.eclipse.gendoc.wizard.IGendocTemplate;
+
+public class Gendoc2RunnerDocxRequirements implements IGendocTemplate {
+
+ private String description = "Requirements MS Word 2010 generation template";
+
+ @Override
+ public String getOutPutExtension() {
+ return "docx";
+ }
+
+ public URL getTemplate() {
+ return Activator.getDefault().getBundle().getEntry("/resources/RequirementDoc.docx");
+ }
+
+ public String getModelKey() {
+ return "generic_generation_model";
+ }
+
+ public String getOutputKey() {
+ return "generic_generation_output";
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public String getName() {
+ return "Requirements";
+ }
+
+ @Override
+ public boolean isSavable() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+}
diff --git a/plugins/gendoc/org.eclipse.papyrus.requirements.gendoc.templates/src/org/eclipse/papyrus/gendoc/custom/templates/RequirementsGendoc2Runner.java b/plugins/gendoc/org.eclipse.papyrus.requirements.gendoc.templates/src/org/eclipse/papyrus/gendoc/custom/templates/RequirementsGendoc2Runner.java
new file mode 100644
index 0000000..d0c8352
--- /dev/null
+++ b/plugins/gendoc/org.eclipse.papyrus.requirements.gendoc.templates/src/org/eclipse/papyrus/gendoc/custom/templates/RequirementsGendoc2Runner.java
@@ -0,0 +1,71 @@
+/*****************************************************************************
+ * Copyright (c) 2017 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:
+ *
+ * Patrick Tessier (Patrick.tessier@cea.fr) CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.gendoc.custom.templates;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.regex.Pattern;
+
+import org.eclipse.gendoc.bundle.acceleo.papyrus.utils.OneFileUMLSelectionConverter;
+import org.eclipse.gendoc.wizard.IGendocSelectionConverterRunner;
+import org.eclipse.gendoc.wizard.IGendocTemplate;
+import org.eclipse.gendoc.wizard.ISelectionConverter;
+
+public class RequirementsGendoc2Runner implements IGendocSelectionConverterRunner {
+ List<IGendocTemplate> templates = new ArrayList<IGendocTemplate>();
+
+ public RequirementsGendoc2Runner() {
+ templates.add(new Gendoc2RunnerDocxRequirements());
+ }
+
+ /**
+ * @return specify all extension of model that papyrusGendoc2Runner can generate the documentation
+ */
+ public Pattern getPattern() {
+ return Pattern.compile(".*\\.uml");
+ }
+
+ public ISelectionConverter getSelectionConverter() {
+ return new OneFileUMLSelectionConverter();
+ }
+
+
+ /**
+ * @return all the template format associated to this Papyrus runner
+ */
+ public List<IGendocTemplate> getGendoc2Templates() {
+ return templates;
+ }
+
+ public String getLabel() {
+ return "Requirements Document Generation";
+ }
+
+ @Override
+ public Map<String, String> getAdditionnalParameters() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public List<IGendocTemplate> getGendocTemplates() {
+ // TODO Auto-generated method stub
+ return templates;
+ }
+
+
+}
+
diff --git a/plugins/sysml14/org.eclipse.papyrus.requirements.sysml14.assistant.commands/META-INF/MANIFEST.MF b/plugins/sysml14/org.eclipse.papyrus.requirements.sysml14.assistant.commands/META-INF/MANIFEST.MF
index 282c35f..e72994f 100644
--- a/plugins/sysml14/org.eclipse.papyrus.requirements.sysml14.assistant.commands/META-INF/MANIFEST.MF
+++ b/plugins/sysml14/org.eclipse.papyrus.requirements.sysml14.assistant.commands/META-INF/MANIFEST.MF
@@ -8,7 +8,8 @@
Require-Bundle: org.eclipse.gmf.runtime.diagram.ui,
org.eclipse.papyrus.uml.tools,
org.eclipse.papyrus.requirements.sysml14.preferences,
- org.eclipse.papyrus.requirements.sysml14.common
+ org.eclipse.papyrus.requirements.sysml14.common,
+ org.eclipse.papyrus.sysml14
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Export-Package: org.eclipse.papyrus.requirements.sysml14.assistant.commands
diff --git a/plugins/sysml14/org.eclipse.papyrus.requirements.sysml14.assistant.commands/src/org/eclipse/papyrus/requirements/sysml14/assistant/commands/SetIdCommand.java b/plugins/sysml14/org.eclipse.papyrus.requirements.sysml14.assistant.commands/src/org/eclipse/papyrus/requirements/sysml14/assistant/commands/SetIdCommand.java
new file mode 100644
index 0000000..5230161
--- /dev/null
+++ b/plugins/sysml14/org.eclipse.papyrus.requirements.sysml14.assistant.commands/src/org/eclipse/papyrus/requirements/sysml14/assistant/commands/SetIdCommand.java
@@ -0,0 +1,135 @@
+/*****************************************************************************
+ * Copyright (c) 2016 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:
+ *
+ * Mauricio Alferez (mauricio.alferez@cea.fr) CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.requirements.sysml14.assistant.commands;
+
+import java.text.DecimalFormat;
+
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.requirements.sysml14.common.I_SysMLStereotype;
+import org.eclipse.papyrus.requirements.sysml14.preferences.PreferenceConstants;
+import org.eclipse.papyrus.sysml14.requirements.Requirement;
+import org.eclipse.uml2.uml.Class;
+import org.eclipse.uml2.uml.Classifier;
+import org.eclipse.uml2.uml.PackageableElement;
+import org.eclipse.uml2.uml.Stereotype;
+import org.eclipse.uml2.uml.util.UMLUtil;
+
+/**
+ * Set Id to all sub requirement from a package by taking as prefix the name of the package
+ *
+ */
+public class SetIdCommand extends RecordingCommand {
+ protected org.eclipse.uml2.uml.Package selectedElement;
+ protected TransactionalEditingDomain domain;
+
+
+ public SetIdCommand(TransactionalEditingDomain domain, org.eclipse.uml2.uml.Package selectedElement) {
+ super(domain, "SetIdFromPackageCommand");
+ this.selectedElement = selectedElement;
+ this.domain = domain;
+ }
+
+ @Override
+ protected void doExecute() {
+ IPreferenceStore store = org.eclipse.papyrus.requirements.sysml14.preferences.Activator.getDefault().getPreferenceStore();
+ int digit = store.getInt(PreferenceConstants.REQUIREMENT_ID_DIGIT);// by
+ String separator = store.getString(PreferenceConstants.CHILD_REQUIREMENTS_SEPARATOR);
+
+ String concatenedString = "";
+ org.eclipse.uml2.uml.Package owner = null;
+ int index = 1;
+ for (PackageableElement packageableElement : selectedElement.getPackagedElements()) {
+ if (UMLUtil.getStereotypeApplication(packageableElement, Requirement.class) != null) {
+ // set id
+
+ Requirement req = UMLUtil.getStereotypeApplication(((org.eclipse.uml2.uml.Class) packageableElement), Requirement.class);
+ DecimalFormat df = new DecimalFormat();
+ df.setMinimumIntegerDigits(digit);
+ String value = (df.format(index));
+ req.setId("" + selectedElement.getName() + separator + value);
+ index++;
+
+ // if (req.getText() == null || req.getText().trim().equals("")) {
+ // req.setText("QS should " + packageableElement.getName().toLowerCase());
+ // }
+ setIdforClassifier(req.getId(), (Class) packageableElement);
+ }
+
+ else {
+ if (packageableElement instanceof Class) {
+ Stereotype stereo = packageableElement.getApplicableStereotype(I_SysMLStereotype.REQUIREMENT_STEREOTYPE);
+ packageableElement.applyStereotype(stereo);
+ Requirement req = UMLUtil.getStereotypeApplication(((org.eclipse.uml2.uml.Class) packageableElement), Requirement.class);
+ DecimalFormat df = new DecimalFormat();
+ df.setMinimumIntegerDigits(digit);
+ String value = (df.format(index));
+ req.setId("" + selectedElement.getName() + separator + value);
+ index++;
+ // if (req.getText() == null || req.getText().trim().equals("")) {
+ // req.setText("QS should have" + packageableElement.getName().toLowerCase());
+ // }
+ setIdforClassifier(req.getId(), (Class) packageableElement);
+
+ }
+
+ }
+ }
+ }
+
+ protected void setIdforClassifier(String prefix, Classifier classifier) {
+ IPreferenceStore store = org.eclipse.papyrus.requirements.sysml14.preferences.Activator.getDefault().getPreferenceStore();
+ int digit = store.getInt(PreferenceConstants.REQUIREMENT_ID_DIGIT);// by
+ String separator = store.getString(PreferenceConstants.CHILD_REQUIREMENTS_SEPARATOR);
+
+ int index = 1;
+ for (Classifier nestedClassifier : ((Class) classifier).getNestedClassifiers()) {
+ if (UMLUtil.getStereotypeApplication(nestedClassifier, Requirement.class) != null) {
+ // setID
+ Requirement req = UMLUtil.getStereotypeApplication(((org.eclipse.uml2.uml.Class) nestedClassifier), Requirement.class);
+ DecimalFormat df = new DecimalFormat();
+ df.setMinimumIntegerDigits(digit);
+ String value = (df.format(index));
+ req.setId(prefix + separator + value);
+ index++;
+ setIdforClassifier(req.getId(), nestedClassifier);
+ // // set Text
+ // if (req.getText() == null || req.getText().trim().equals("")) {
+ // req.setText("QS should have" + nestedClassifier.getName().toLowerCase());
+ // }
+ }
+
+ else {
+ Stereotype stereo = nestedClassifier.getApplicableStereotype(I_SysMLStereotype.REQUIREMENT_STEREOTYPE);
+ nestedClassifier.applyStereotype(stereo);
+ Requirement req = UMLUtil.getStereotypeApplication(((org.eclipse.uml2.uml.Class) nestedClassifier), Requirement.class);
+ DecimalFormat df = new DecimalFormat();
+ df.setMinimumIntegerDigits(digit);
+ String value = (df.format(index));
+ req.setId("" + selectedElement.getName() + separator + value);
+ index++;
+ // if (req.getText() == null || req.getText().trim().equals("")) {
+ // req.setText("QS should have" + nestedClassifier.getName().toLowerCase());
+ // }
+ setIdforClassifier(req.getId(), nestedClassifier);
+
+ }
+ }
+ }
+
+
+
+}
\ No newline at end of file
diff --git a/plugins/sysml14/org.eclipse.papyrus.requirements.sysml14.assistant.handlers/plugin.xml b/plugins/sysml14/org.eclipse.papyrus.requirements.sysml14.assistant.handlers/plugin.xml
index 0ddf141..c7e8e58 100644
--- a/plugins/sysml14/org.eclipse.papyrus.requirements.sysml14.assistant.handlers/plugin.xml
+++ b/plugins/sysml14/org.eclipse.papyrus.requirements.sysml14.assistant.handlers/plugin.xml
@@ -20,5 +20,9 @@
class="org.eclipse.papyrus.requirements.sysml14.assistant.handlers.CommentReqHandler"
commandId="org.eclipse.papyrus.requirements.sysml14.assistant.handlers.CommentReqHandler">
</handler>
+ <handler
+ class="org.eclipse.papyrus.requirements.sysml14.assistant.handlers.SetIdSubTreeHandler"
+ commandId="org.eclipse.papyrus.requirements.sysml14.assistant.handlers.SetIdSubTreeHandler">
+ </handler>
</extension>
</plugin>
diff --git a/plugins/sysml14/org.eclipse.papyrus.requirements.sysml14.assistant.handlers/src/org/eclipse/papyrus/requirements/sysml14/assistant/handlers/SetIdSubTreeHandler.java b/plugins/sysml14/org.eclipse.papyrus.requirements.sysml14.assistant.handlers/src/org/eclipse/papyrus/requirements/sysml14/assistant/handlers/SetIdSubTreeHandler.java
new file mode 100644
index 0000000..371406e
--- /dev/null
+++ b/plugins/sysml14/org.eclipse.papyrus.requirements.sysml14.assistant.handlers/src/org/eclipse/papyrus/requirements/sysml14/assistant/handlers/SetIdSubTreeHandler.java
@@ -0,0 +1,57 @@
+/*****************************************************************************
+ * Copyright (c) 2016 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:
+ *
+ * Mauricio Alferez (mauricio.alferez@cea.fr) CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.requirements.sysml14.assistant.handlers;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.papyrus.requirements.sysml14.assistant.commands.SetIdCommand;
+import org.eclipse.papyrus.requirements.sysml14.common.PapyrusAbstractHandler;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.Package;
+
+/**
+ * Executes the decomposition of a parent requirement to create a new child
+ * requirement with a name based on its ancestors as defined in the Papyrus Req
+ * preferences page.
+ *
+ */
+public class SetIdSubTreeHandler extends PapyrusAbstractHandler {
+
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ super.execute(event);
+ Element selectedElement = getSelection();
+ if (selectedElement != null && selectedElement instanceof Package) {
+ SetIdCommand decomposeReqCommand = new SetIdCommand(transactionalEditingDomain, (org.eclipse.uml2.uml.Package) selectedElement);
+ transactionalEditingDomain.getCommandStack().execute(decomposeReqCommand);
+ }
+ return null;
+ }
+
+ /**
+ *
+ * @see org.eclipse.core.commands.AbstractHandler#isEnabled()
+ *
+ * @return true if the handler is possible
+ */
+ @Override
+ public boolean isEnabled() {
+ Element selectedElement = getSelection();
+ if (selectedElement != null && selectedElement instanceof Package) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+}
\ No newline at end of file
diff --git a/plugins/sysml14/org.eclipse.papyrus.requirements.sysml14.assistant.ui/plugin.xml b/plugins/sysml14/org.eclipse.papyrus.requirements.sysml14.assistant.ui/plugin.xml
index 056c4f4..a0ffcbd 100644
--- a/plugins/sysml14/org.eclipse.papyrus.requirements.sysml14.assistant.ui/plugin.xml
+++ b/plugins/sysml14/org.eclipse.papyrus.requirements.sysml14.assistant.ui/plugin.xml
@@ -95,6 +95,15 @@
</with>
</visibleWhen>
</command>
+ <command
+ commandId="org.eclipse.papyrus.requirements.sysml14.assistant.handlers.SetIdSubTreeHandler"
+ label="Set Ids for the the requirement tree"
+ style="push"
+ tooltip="Set Id for the the requirement tree">
+ <visibleWhen
+ checkEnabled="true">
+ </visibleWhen>
+ </command>
</menuContribution>
</extension>
<extension