Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauricio Alferez2015-05-29 13:03:34 +0000
committerPatrick Tessier2015-06-08 12:05:19 +0000
commit8610cde7e2a3401f41e121539ab1591acfd0e7b1 (patch)
treef8866dbd9360535a9fbb8978b4a1001fe4e18a27 /extraplugins/req
parent9f6298286087824e7828c29302a48b3a64098507 (diff)
downloadorg.eclipse.papyrus-8610cde7e2a3401f41e121539ab1591acfd0e7b1.tar.gz
org.eclipse.papyrus-8610cde7e2a3401f41e121539ab1591acfd0e7b1.tar.xz
org.eclipse.papyrus-8610cde7e2a3401f41e121539ab1591acfd0e7b1.zip
Papyrus REQ SysML traceability assistant plugin
Change-Id: Icb10f0c3ef7e600eb455434ab32603ac31d0213e Signed-off-by: Mauricio Alferez <mauricio.alferez@cea.fr> Reviewed-on: https://git.eclipse.org/r/48948 Tested-by: Hudson CI Reviewed-by: Patrick Tessier <Patrick.Tessier@cea.fr>
Diffstat (limited to 'extraplugins/req')
-rw-r--r--extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/.classpath7
-rw-r--r--extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/.gitignore1
-rw-r--r--extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/.project28
-rw-r--r--extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/META-INF/MANIFEST.MF21
-rw-r--r--extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/about.html28
-rw-r--r--extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/build.properties8
-rw-r--r--extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/bundle.properties10
-rw-r--r--extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/plugin.xml53
-rw-r--r--extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/pom.xml14
-rw-r--r--extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/src/org/eclipse/papyrus/req/sysml/traceabilityassistant/Activator.java64
-rw-r--r--extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/src/org/eclipse/papyrus/req/sysml/traceabilityassistant/I_SysMLStereotype.java248
-rw-r--r--extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/src/org/eclipse/papyrus/req/sysml/traceabilityassistant/analysis/AbstractionRule.java84
-rw-r--r--extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/src/org/eclipse/papyrus/req/sysml/traceabilityassistant/analysis/DeriveReqRule.java87
-rw-r--r--extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/src/org/eclipse/papyrus/req/sysml/traceabilityassistant/analysis/ITracabilityRule.java39
-rw-r--r--extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/src/org/eclipse/papyrus/req/sysml/traceabilityassistant/analysis/SatisfyRule.java85
-rw-r--r--extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/src/org/eclipse/papyrus/req/sysml/traceabilityassistant/analysis/TracabilityAnalyzer.java87
-rw-r--r--extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/src/org/eclipse/papyrus/req/sysml/traceabilityassistant/command/AbstractionCreateCommand.java53
-rw-r--r--extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/src/org/eclipse/papyrus/req/sysml/traceabilityassistant/command/DerivationReqCreateCommand.java57
-rw-r--r--extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/src/org/eclipse/papyrus/req/sysml/traceabilityassistant/command/RefinementCreateCommand.java57
-rw-r--r--extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/src/org/eclipse/papyrus/req/sysml/traceabilityassistant/command/SatisfactionCreateCommand.java57
-rw-r--r--extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/src/org/eclipse/papyrus/req/sysml/traceabilityassistant/handler/ApplyTracabilityHandler.java127
22 files changed, 1222 insertions, 0 deletions
diff --git a/extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/.classpath b/extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/.classpath
new file mode 100644
index 00000000000..8a8f1668cdc
--- /dev/null
+++ b/extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/.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/extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/.gitignore b/extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/.gitignore
new file mode 100644
index 00000000000..ae3c1726048
--- /dev/null
+++ b/extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/.gitignore
@@ -0,0 +1 @@
+/bin/
diff --git a/extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/.project b/extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/.project
new file mode 100644
index 00000000000..68baab2b9e7
--- /dev/null
+++ b/extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.req.sysml.traceabilityassistant</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/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/.settings/org.eclipse.jdt.core.prefs b/extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..f287d53cf45
--- /dev/null
+++ b/extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/.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/extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/META-INF/MANIFEST.MF b/extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..504f29a9ff4
--- /dev/null
+++ b/extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/META-INF/MANIFEST.MF
@@ -0,0 +1,21 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %Bundle-Name
+Bundle-SymbolicName: org.eclipse.papyrus.req.sysml.traceabilityassistant;singleton:=true
+Bundle-Version: 0.1.0.qualifier
+Bundle-Activator: org.eclipse.papyrus.req.sysml.traceabilityassistant.Activator
+Bundle-Vendor: %Bundle-Vendor
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.emf.transaction;bundle-version="1.4.0",
+ org.eclipse.uml2.uml;bundle-version="4.0.0",
+ org.eclipse.papyrus.infra.widgets;bundle-version="0.9.0",
+ org.eclipse.papyrus.uml.tools;bundle-version="0.9.0",
+ org.eclipse.papyrus.infra.emf;bundle-version="1.0.0",
+ org.eclipse.papyrus.infra.core,
+ org.eclipse.papyrus.uml.extensionpoints
+Bundle-ActivationPolicy: lazy
+Export-Package: org.eclipse.papyrus.req.sysml.traceabilityassistant.analysis,
+ org.eclipse.papyrus.req.sysml.traceabilityassistant.command
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-Localization: bundle
diff --git a/extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/about.html b/extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/about.html
new file mode 100644
index 00000000000..82d49bf5f81
--- /dev/null
+++ b/extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/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/extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/build.properties b/extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/build.properties
new file mode 100644
index 00000000000..34dfd31bf32
--- /dev/null
+++ b/extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/build.properties
@@ -0,0 +1,8 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ about.html,\
+ bundle.properties
+src.includes = about.html
diff --git a/extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/bundle.properties b/extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/bundle.properties
new file mode 100644
index 00000000000..f456c2988a0
--- /dev/null
+++ b/extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/bundle.properties
@@ -0,0 +1,10 @@
+#Properties file for org.eclipse.papyrus.req.sysml.traceabilityassistant
+menu.label = Papyrus Req
+menu.tooltip = Papyrus Req
+menu.label.0 = Papyrus Req
+menu.tooltip.0 = Papyrus Req
+command.label = Apply Traceability Assistant
+command.tooltip = Apply Traceability Assistant
+command.name = Apply Traceability Assistant
+Bundle-Vendor = CEA LIST
+Bundle-Name = Papyrus Traceability Assistant (Incubation) \ No newline at end of file
diff --git a/extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/plugin.xml b/extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/plugin.xml
new file mode 100644
index 00000000000..a2423ded5d4
--- /dev/null
+++ b/extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/plugin.xml
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.ui.menus">
+ <menuContribution
+ allPopups="false"
+ locationURI="popup:org.eclipse.gmf.runtime.diagram.ui.DiagramEditorContextMenu?after=filtersMenu">
+ <menu
+ id="org.eclipse.papyrus.req.sysml.menu"
+ label="%menu.label"
+ tooltip="%menu.tooltip">
+ <visibleWhen>
+ <with
+ variable="activeEditorId">
+ <equals
+ value="org.eclipse.papyrus.infra.core.papyrusEditor">
+ </equals>
+ </with>
+ </visibleWhen>
+ </menu>
+ </menuContribution>
+ <menuContribution
+ allPopups="false"
+ locationURI="popup:org.eclipse.papyrus.views.modelexplorer.modelexplorer.popup">
+ <menu
+ id="org.eclipse.papyrus.req.sysml.menu"
+ label="%menu.label.0"
+ tooltip="%menu.tooltip.0">
+ </menu>
+ </menuContribution>
+ <menuContribution
+ allPopups="false"
+ locationURI="popup:org.eclipse.papyrus.req.sysml.menu">
+ <command
+ commandId="org.eclipse.papyrus.req.sysml.traceabilityassistant.handler.ApplyTracabilityHandler"
+ label="%command.label"
+ style="push"
+ tooltip="%command.tooltip">
+ </command>
+ </menuContribution>
+ </extension>
+ <extension
+ point="org.eclipse.ui.commands">
+ <command
+ categoryId="org.eclipse.papyrus.editor.category"
+ defaultHandler="org.eclipse.papyrus.req.sysml.traceabilityassistant.handler.ApplyTracabilityHandler"
+ id="org.eclipse.papyrus.req.sysml.traceabilityassistant.handler.ApplyTracabilityHandler"
+ name="%command.name">
+ </command>
+ </extension>
+
+</plugin>
diff --git a/extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/pom.xml b/extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/pom.xml
new file mode 100644
index 00000000000..a4d02edd1c4
--- /dev/null
+++ b/extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/pom.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>org.eclipse.papyrus</artifactId>
+ <groupId>org.eclipse.papyrus</groupId>
+ <version>1.1.0-SNAPSHOT</version>
+ <relativePath>../../../releng/top-pom-extras.xml</relativePath>
+ </parent>
+ <groupId>org.eclipse.papyrus</groupId>
+ <artifactId>org.eclipse.papyrus.req.sysml.traceabilityassistant</artifactId>
+ <version>0.1.0-SNAPSHOT</version>
+ <packaging>eclipse-plugin</packaging>
+</project> \ No newline at end of file
diff --git a/extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/src/org/eclipse/papyrus/req/sysml/traceabilityassistant/Activator.java b/extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/src/org/eclipse/papyrus/req/sysml/traceabilityassistant/Activator.java
new file mode 100644
index 00000000000..61fd84ef034
--- /dev/null
+++ b/extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/src/org/eclipse/papyrus/req/sysml/traceabilityassistant/Activator.java
@@ -0,0 +1,64 @@
+/*****************************************************************************
+ * Copyright (c) 2015 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.req.sysml.traceabilityassistant;
+
+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.req.sysml.traceabilityassistant"; //$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/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/src/org/eclipse/papyrus/req/sysml/traceabilityassistant/I_SysMLStereotype.java b/extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/src/org/eclipse/papyrus/req/sysml/traceabilityassistant/I_SysMLStereotype.java
new file mode 100644
index 00000000000..9df41a9f9e0
--- /dev/null
+++ b/extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/src/org/eclipse/papyrus/req/sysml/traceabilityassistant/I_SysMLStereotype.java
@@ -0,0 +1,248 @@
+/*****************************************************************************
+ * Copyright (c) 2015 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
+*******************************************************************************/
+package org.eclipse.papyrus.req.sysml.traceabilityassistant;
+
+/**
+ * list of constant for SysML
+ *
+ */
+public interface I_SysMLStereotype {
+ /** Qualified name of the stereotype Conform */
+ public static final String CONFORM_STEREOTYPE = "SysML::ModelElements::Conform";
+ /** name of property base_Dependency of the stereotype Conform */
+ public static final String CONFORM_BASE_DEPENDENCY_ATT = "base_Dependency";
+ /** Qualified name of the stereotype View */
+ public static final String VIEW_STEREOTYPE = "SysML::ModelElements::View";
+ /** name of property viewPoint of the stereotype View */
+ public static final String VIEW_VIEWPOINT_ATT = "viewPoint";
+ /** name of property base_Package of the stereotype View */
+ public static final String VIEW_BASE_PACKAGE_ATT = "base_Package";
+ /** Qualified name of the stereotype ViewPoint */
+ public static final String VIEWPOINT_STEREOTYPE = "SysML::ModelElements::ViewPoint";
+ /** name of property base_Class of the stereotype ViewPoint */
+ public static final String VIEWPOINT_BASE_CLASS_ATT = "base_Class";
+ /** name of property stakeHolders of the stereotype ViewPoint */
+ public static final String VIEWPOINT_STAKEHOLDERS_ATT = "stakeHolders";
+ /** name of property purpose of the stereotype ViewPoint */
+ public static final String VIEWPOINT_PURPOSE_ATT = "purpose";
+ /** name of property concerns of the stereotype ViewPoint */
+ public static final String VIEWPOINT_CONCERNS_ATT = "concerns";
+ /** name of property languages of the stereotype ViewPoint */
+ public static final String VIEWPOINT_LANGUAGES_ATT = "languages";
+ /** name of property methods of the stereotype ViewPoint */
+ public static final String VIEWPOINT_METHODS_ATT = "methods";
+ /** Qualified name of the stereotype Rationale */
+ public static final String RATIONALE_STEREOTYPE = "SysML::ModelElements::Rationale";
+ /** name of property base_Comment of the stereotype Rationale */
+ public static final String RATIONALE_BASE_COMMENT_ATT = "base_Comment";
+ /** Qualified name of the stereotype Problem */
+ public static final String PROBLEM_STEREOTYPE = "SysML::ModelElements::Problem";
+ /** name of property base_Comment of the stereotype Problem */
+ public static final String PROBLEM_BASE_COMMENT_ATT = "base_Comment";
+ /** Qualified name of the stereotype Block */
+ public static final String BLOCK_STEREOTYPE = "SysML::Blocks::Block";
+ /** name of property isEncapsulated of the stereotype Block */
+ public static final String BLOCK_ISENCAPSULATED_ATT = "isEncapsulated";
+ /** name of property base_Class of the stereotype Block */
+ public static final String BLOCK_BASE_CLASS_ATT = "base_Class";
+ /** Qualified name of the stereotype DistributedProperty */
+ public static final String DISTRIBUTEDPROPERTY_STEREOTYPE = "SysML::Blocks::DistributedProperty";
+ /** name of property base_Property of the stereotype DistributedProperty */
+ public static final String DISTRIBUTEDPROPERTY_BASE_PROPERTY_ATT = "base_Property";
+ /** Qualified name of the stereotype Dimension */
+ public static final String DIMENSION_STEREOTYPE = "SysML::Blocks::Dimension";
+ /** name of property base_InstanceSpecification of the stereotype Dimension */
+ public static final String DIMENSION_BASE_INSTANCESPECIFICATION_ATT = "base_InstanceSpecification";
+ /** Qualified name of the stereotype Unit */
+ public static final String UNIT_STEREOTYPE = "SysML::Blocks::Unit";
+ /** name of property base_InstanceSpecification of the stereotype Unit */
+ public static final String UNIT_BASE_INSTANCESPECIFICATION_ATT = "base_InstanceSpecification";
+ /** name of property dimension of the stereotype Unit */
+ public static final String UNIT_DIMENSION_ATT = "dimension";
+ /** Qualified name of the stereotype ValueType */
+ public static final String VALUETYPE_STEREOTYPE = "SysML::Blocks::ValueType";
+ /** name of property base_DataType of the stereotype ValueType */
+ public static final String VALUETYPE_BASE_DATATYPE_ATT = "base_DataType";
+ /** name of property unit of the stereotype ValueType */
+ public static final String VALUETYPE_UNIT_ATT = "unit";
+ /** name of property dimension of the stereotype ValueType */
+ public static final String VALUETYPE_DIMENSION_ATT = "dimension";
+ /** Qualified name of the stereotype NestedConnectorEnd */
+ public static final String NESTEDCONNECTOREND_STEREOTYPE = "SysML::Blocks::NestedConnectorEnd";
+ /** name of property propertyPath of the stereotype NestedConnectorEnd */
+ public static final String NESTEDCONNECTOREND_PROPERTYPATH_ATT = "propertyPath";
+ /** name of property base_ConnectorEnd of the stereotype NestedConnectorEnd */
+ public static final String NESTEDCONNECTOREND_BASE_CONNECTOREND_ATT = "base_ConnectorEnd";
+ /** Qualified name of the stereotype ParticipantProperty */
+ public static final String PARTICIPANTPROPERTY_STEREOTYPE = "SysML::Blocks::ParticipantProperty";
+ /** name of property base_Property of the stereotype ParticipantProperty */
+ public static final String PARTICIPANTPROPERTY_BASE_PROPERTY_ATT = "base_Property";
+ /** name of property end of the stereotype ParticipantProperty */
+ public static final String PARTICIPANTPROPERTY_END_ATT = "end";
+ /** Qualified name of the stereotype ConnectorProperty */
+ public static final String CONNECTORPROPERTY_STEREOTYPE = "SysML::Blocks::ConnectorProperty";
+ /** name of property base_Property of the stereotype ConnectorProperty */
+ public static final String CONNECTORPROPERTY_BASE_PROPERTY_ATT = "base_Property";
+ /** name of property connector of the stereotype ConnectorProperty */
+ public static final String CONNECTORPROPERTY_CONNECTOR_ATT = "connector";
+ /** Qualified name of the stereotype BindingConnector */
+ public static final String BINDINGCONNECTOR_STEREOTYPE = "SysML::Blocks::BindingConnector";
+ /** name of property base_Connector of the stereotype BindingConnector */
+ public static final String BINDINGCONNECTOR_BASE_CONNECTOR_ATT = "base_Connector";
+ /** Qualified name of the stereotype PropertySpecificType */
+ public static final String PROPERTYSPECIFICTYPE_STEREOTYPE = "SysML::Blocks::PropertySpecificType";
+ /** name of property base_Classifier of the stereotype PropertySpecificType */
+ public static final String PROPERTYSPECIFICTYPE_BASE_CLASSIFIER_ATT = "base_Classifier";
+ /** Qualified name of the stereotype FlowPort */
+ public static final String FLOWPORT_STEREOTYPE = "SysML::PortAndFlows::FlowPort";
+ /** name of property base_Port of the stereotype FlowPort */
+ public static final String FLOWPORT_BASE_PORT_ATT = "base_Port";
+ /** name of property isAtomic of the stereotype FlowPort */
+ public static final String FLOWPORT_ISATOMIC_ATT = "isAtomic";
+ /** name of property isConjugated of the stereotype FlowPort */
+ public static final String FLOWPORT_ISCONJUGATED_ATT = "isConjugated";
+ /** name of property direction of the stereotype FlowPort */
+ public static final String FLOWPORT_DIRECTION_ATT = "direction";
+ /** Qualified name of the stereotype FlowProperty */
+ public static final String FLOWPROPERTY_STEREOTYPE = "SysML::PortAndFlows::FlowProperty";
+ /** name of property base_Property of the stereotype FlowProperty */
+ public static final String FLOWPROPERTY_BASE_PROPERTY_ATT = "base_Property";
+ /** name of property direction of the stereotype FlowProperty */
+ public static final String FLOWPROPERTY_DIRECTION_ATT = "direction";
+ /** Qualified name of the stereotype FlowSpecification */
+ public static final String FLOWSPECIFICATION_STEREOTYPE = "SysML::PortAndFlows::FlowSpecification";
+ /** name of property base_Interface of the stereotype FlowSpecification */
+ public static final String FLOWSPECIFICATION_BASE_INTERFACE_ATT = "base_Interface";
+ /** name of literal in of the Enumeration FlowDirection */
+ public static final String FLOWDIRECTION_IN_ENUM = "in";
+ /** name of literal out of the Enumeration FlowDirection */
+ public static final String FLOWDIRECTION_OUT_ENUM = "out";
+ /** name of literal inout of the Enumeration FlowDirection */
+ public static final String FLOWDIRECTION_INOUT_ENUM = "inout";
+ /** Qualified name of the stereotype ItemFlow */
+ public static final String ITEMFLOW_STEREOTYPE = "SysML::PortAndFlows::ItemFlow";
+ /** name of property base_InformationFlow of the stereotype ItemFlow */
+ public static final String ITEMFLOW_BASE_INFORMATIONFLOW_ATT = "base_InformationFlow";
+ /** name of property itemProperty of the stereotype ItemFlow */
+ public static final String ITEMFLOW_ITEMPROPERTY_ATT = "itemProperty";
+ /** Qualified name of the stereotype ConstraintBlock */
+ public static final String CONSTRAINTBLOCK_STEREOTYPE = "SysML::Constraints::ConstraintBlock";
+ /** Qualified name of the stereotype ConstraintProperty */
+ public static final String CONSTRAINTPROPERTY_STEREOTYPE = "SysML::Constraints::ConstraintProperty";
+ /** name of property base_Property of the stereotype ConstraintProperty */
+ public static final String CONSTRAINTPROPERTY_BASE_PROPERTY_ATT = "base_Property";
+ /** Qualified name of the stereotype Optional */
+ public static final String OPTIONAL_STEREOTYPE = "SysML::Activities::Optional";
+ /** name of property base_Parameter of the stereotype Optional */
+ public static final String OPTIONAL_BASE_PARAMETER_ATT = "base_Parameter";
+ /** Qualified name of the stereotype Rate */
+ public static final String RATE_STEREOTYPE = "SysML::Activities::Rate";
+ /** name of property base_Parameter of the stereotype Rate */
+ public static final String RATE_BASE_PARAMETER_ATT = "base_Parameter";
+ /** name of property base_ActivityEdge of the stereotype Rate */
+ public static final String RATE_BASE_ACTIVITYEDGE_ATT = "base_ActivityEdge";
+ /** name of property rate of the stereotype Rate */
+ public static final String RATE_RATE_ATT = "rate";
+ /** Qualified name of the stereotype Probability */
+ public static final String PROBABILITY_STEREOTYPE = "SysML::Activities::Probability";
+ /** name of property base_ActivityEdge of the stereotype Probability */
+ public static final String PROBABILITY_BASE_ACTIVITYEDGE_ATT = "base_ActivityEdge";
+ /** name of property base_ParameterSet of the stereotype Probability */
+ public static final String PROBABILITY_BASE_PARAMETERSET_ATT = "base_ParameterSet";
+ /** name of property probability of the stereotype Probability */
+ public static final String PROBABILITY_PROBABILITY_ATT = "probability";
+ /** Qualified name of the stereotype Continuous */
+ public static final String CONTINUOUS_STEREOTYPE = "SysML::Activities::Continuous";
+ /** Qualified name of the stereotype Discrete */
+ public static final String DISCRETE_STEREOTYPE = "SysML::Activities::Discrete";
+ /** Qualified name of the stereotype ControlOperator */
+ public static final String CONTROLOPERATOR_STEREOTYPE = "SysML::Activities::ControlOperator";
+ /** name of property base_Operation of the stereotype ControlOperator */
+ public static final String CONTROLOPERATOR_BASE_OPERATION_ATT = "base_Operation";
+ /** name of property base_Behavior of the stereotype ControlOperator */
+ public static final String CONTROLOPERATOR_BASE_BEHAVIOR_ATT = "base_Behavior";
+ /** Qualified name of the stereotype NoBuffer */
+ public static final String NOBUFFER_STEREOTYPE = "SysML::Activities::NoBuffer";
+ /** name of property base_ObjectNode of the stereotype NoBuffer */
+ public static final String NOBUFFER_BASE_OBJECTNODE_ATT = "base_ObjectNode";
+ /** Qualified name of the stereotype Overwrite */
+ public static final String OVERWRITE_STEREOTYPE = "SysML::Activities::Overwrite";
+ /** name of property base_ObjectNode of the stereotype Overwrite */
+ public static final String OVERWRITE_BASE_OBJECTNODE_ATT = "base_ObjectNode";
+ /** Qualified name of the stereotype Allocate */
+ public static final String ALLOCATE_STEREOTYPE = "SysML::Allocations::Allocate";
+ /** name of property base_Abstraction of the stereotype Allocate */
+ public static final String ALLOCATE_BASE_ABSTRACTION_ATT = "base_Abstraction";
+ /** Qualified name of the stereotype Allocated */
+ public static final String ALLOCATED_STEREOTYPE = "SysML::Allocations::Allocated";
+ /** name of property base_NamedElement of the stereotype Allocated */
+ public static final String ALLOCATED_BASE_NAMEDELEMENT_ATT = "base_NamedElement";
+ /** name of property allocatedFrom of the stereotype Allocated */
+ public static final String ALLOCATED_ALLOCATEDFROM_ATT = "allocatedFrom";
+ /** name of property allocatedTo of the stereotype Allocated */
+ public static final String ALLOCATED_ALLOCATEDTO_ATT = "allocatedTo";
+ /** Qualified name of the stereotype AllocateActivityPartition */
+ public static final String ALLOCATEACTIVITYPARTITION_STEREOTYPE = "SysML::Allocations::AllocateActivityPartition";
+ /** name of property base_ActivityPartition of the stereotype AllocateActivityPartition */
+ public static final String ALLOCATEACTIVITYPARTITION_BASE_ACTIVITYPARTITION_ATT = "base_ActivityPartition";
+ /** Qualified name of the stereotype DeriveReqt */
+ public static final String DERIVEREQT_STEREOTYPE = "SysML::Requirements::DeriveReqt";
+ /** Qualified name of the stereotype Verify */
+ public static final String VERIFY_STEREOTYPE = "SysML::Requirements::Verify";
+ /** Qualified name of the stereotype Copy */
+ public static final String COPY_STEREOTYPE = "SysML::Requirements::Copy";
+ /** Qualified name of the stereotype Satisfy */
+ public static final String SATISFY_STEREOTYPE = "SysML::Requirements::Satisfy";
+ /** Qualified name of the stereotype TestCase */
+ public static final String TESTCASE_STEREOTYPE = "SysML::Requirements::TestCase";
+ /** name of property base_Behavior of the stereotype TestCase */
+ public static final String TESTCASE_BASE_BEHAVIOR_ATT = "base_Behavior";
+ /** name of property base_Operation of the stereotype TestCase */
+ public static final String TESTCASE_BASE_OPERATION_ATT = "base_Operation";
+ /** name of property verifies of the stereotype TestCase */
+ public static final String TESTCASE_VERIFIES_ATT = "verifies";
+ /** Qualified name of the stereotype Requirement */
+ public static final String REQUIREMENT_STEREOTYPE = "SysML::Requirements::Requirement";
+ /** name of property text of the stereotype Requirement */
+ public static final String REQUIREMENT_TEXT_ATT = "text";
+ /** name of property id of the stereotype Requirement */
+ public static final String REQUIREMENT_ID_ATT = "id";
+ /** name of property derived of the stereotype Requirement */
+ public static final String REQUIREMENT_DERIVED_ATT = "derived";
+ /** name of property derivedFrom of the stereotype Requirement */
+ public static final String REQUIREMENT_DERIVEDFROM_ATT = "derivedFrom";
+ /** name of property satisfiedBy of the stereotype Requirement */
+ public static final String REQUIREMENT_SATISFIEDBY_ATT = "satisfiedBy";
+ /** name of property refinedBy of the stereotype Requirement */
+ public static final String REQUIREMENT_REFINEDBY_ATT = "refinedBy";
+ /** name of property tracedTo of the stereotype Requirement */
+ public static final String REQUIREMENT_TRACEDTO_ATT = "tracedTo";
+ /** name of property verifiedBy of the stereotype Requirement */
+ public static final String REQUIREMENT_VERIFIEDBY_ATT = "verifiedBy";
+ /** name of property master of the stereotype Requirement */
+ public static final String REQUIREMENT_MASTER_ATT = "master";
+ /** name of property base_Class of the stereotype Requirement */
+ public static final String REQUIREMENT_BASE_CLASS_ATT = "base_Class";
+ /** Qualified name of the stereotype RequirementRelated */
+ public static final String REQUIREMENTRELATED_STEREOTYPE = "SysML::Requirements::RequirementRelated";
+ /** name of property base_NamedElement of the stereotype RequirementRelated */
+ public static final String REQUIREMENTRELATED_BASE_NAMEDELEMENT_ATT = "base_NamedElement";
+ /** name of property tracedFrom of the stereotype RequirementRelated */
+ public static final String REQUIREMENTRELATED_TRACEDFROM_ATT = "tracedFrom";
+ /** name of property satisfies of the stereotype RequirementRelated */
+ public static final String REQUIREMENTRELATED_SATISFIES_ATT = "satisfies";
+ /** name of property refines of the stereotype RequirementRelated */
+ public static final String REQUIREMENTRELATED_REFINES_ATT = "refines";
+ /** name of property verifies of the stereotype RequirementRelated */
+ public static final String REQUIREMENTRELATED_VERIFIES_ATT = "verifies";
+ }
diff --git a/extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/src/org/eclipse/papyrus/req/sysml/traceabilityassistant/analysis/AbstractionRule.java b/extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/src/org/eclipse/papyrus/req/sysml/traceabilityassistant/analysis/AbstractionRule.java
new file mode 100644
index 00000000000..977b8db9f97
--- /dev/null
+++ b/extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/src/org/eclipse/papyrus/req/sysml/traceabilityassistant/analysis/AbstractionRule.java
@@ -0,0 +1,84 @@
+/*****************************************************************************
+ * Copyright (c) 2015 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.req.sysml.traceabilityassistant.analysis;
+
+import java.util.Iterator;
+
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.papyrus.infra.widgets.editors.TreeSelectorDialog;
+import org.eclipse.papyrus.req.sysml.traceabilityassistant.I_SysMLStereotype;
+import org.eclipse.papyrus.req.sysml.traceabilityassistant.command.AbstractionCreateCommand;
+import org.eclipse.papyrus.uml.tools.providers.UMLContentProvider;
+import org.eclipse.papyrus.uml.tools.providers.UMLLabelProvider;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.uml2.uml.Abstraction;
+import org.eclipse.uml2.uml.Class;
+import org.eclipse.uml2.uml.Dependency;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.NamedElement;
+import org.eclipse.uml2.uml.UMLPackage;
+import org.eclipse.uml2.uml.UseCase;
+/**
+ *Rule of tracability for abstraction
+ *
+ */
+public class AbstractionRule implements ITracabilityRule {
+
+ public boolean canApplyTracability(Element element) {
+ //this is not a requirement not a usecase
+ if( element instanceof Class && (!(element instanceof UseCase))){
+ if(element.getAppliedStereotype(I_SysMLStereotype.REQUIREMENT_STEREOTYPE)==null){
+ Class currentClass= (Class)element;
+ boolean containsAnAbstraction=false;
+ Iterator<Dependency> dependencyIterator=currentClass.getClientDependencies().iterator();
+ while (dependencyIterator.hasNext()) {
+ Dependency dependency = (Dependency) dependencyIterator.next();
+ if( dependency instanceof Abstraction){
+ containsAnAbstraction=true;
+ }
+ if( dependency.getAppliedStereotype(I_SysMLStereotype.SATISFY_STEREOTYPE)!=null){
+ containsAnAbstraction=true;
+ }
+
+ }
+ if(containsAnAbstraction){
+ return false;
+ }
+ else{
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ public boolean applyTracability(Element element, TransactionalEditingDomain domain) {
+ //look for target of the abstraction
+ TreeSelectorDialog dialog = new TreeSelectorDialog(Display.getDefault().getActiveShell());
+ dialog.setContentProvider(new UMLContentProvider(element.getNearestPackage(), UMLPackage.eINSTANCE.getPackage_PackagedElement()));
+ dialog.setLabelProvider(new UMLLabelProvider());
+ dialog.setMessage("Choose abstraction for "+((NamedElement)element).getQualifiedName());
+ dialog.setTitle("Choose abstraction for "+((NamedElement)element).getName());
+ dialog.create();
+ dialog.setDescription("Choose abstraction for "+((NamedElement)element).getQualifiedName());
+ if(dialog.open() == org.eclipse.jface.window.Window.OK) {
+ Object[] result = dialog.getResult();
+ AbstractionCreateCommand cmd= new AbstractionCreateCommand(domain, ((NamedElement)result[0]),((NamedElement)element) );
+ domain.getCommandStack().execute(cmd);
+ }
+ return false;
+ }
+
+}
diff --git a/extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/src/org/eclipse/papyrus/req/sysml/traceabilityassistant/analysis/DeriveReqRule.java b/extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/src/org/eclipse/papyrus/req/sysml/traceabilityassistant/analysis/DeriveReqRule.java
new file mode 100644
index 00000000000..73f06be873b
--- /dev/null
+++ b/extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/src/org/eclipse/papyrus/req/sysml/traceabilityassistant/analysis/DeriveReqRule.java
@@ -0,0 +1,87 @@
+/*****************************************************************************
+ * Copyright (c) 2015 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.req.sysml.traceabilityassistant.analysis;
+
+import java.util.Iterator;
+
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.papyrus.infra.widgets.editors.TreeSelectorDialog;
+import org.eclipse.papyrus.req.sysml.traceabilityassistant.I_SysMLStereotype;
+import org.eclipse.papyrus.req.sysml.traceabilityassistant.command.DerivationReqCreateCommand;
+import org.eclipse.papyrus.uml.tools.providers.UMLContentProvider;
+import org.eclipse.papyrus.uml.tools.providers.UMLLabelProvider;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.uml2.uml.Abstraction;
+import org.eclipse.uml2.uml.Class;
+import org.eclipse.uml2.uml.Dependency;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.NamedElement;
+import org.eclipse.uml2.uml.UMLPackage;
+/**
+ *Rule of DeriveReqt
+ */
+public class DeriveReqRule implements ITracabilityRule {
+
+ public boolean canApplyTracability(Element element) {
+ //this must be a usecase
+ if( (element instanceof Class)){
+ if(element.getAppliedStereotype(I_SysMLStereotype.REQUIREMENT_STEREOTYPE)!=null){
+ Class currentClass= (Class)element;
+ boolean containsAnAbstraction=false;
+ Iterator<Dependency> dependencyIterator=currentClass.getClientDependencies().iterator();
+ while (dependencyIterator.hasNext()) {
+ Dependency dependency = (Dependency) dependencyIterator.next();
+ if( dependency instanceof Abstraction){
+ if( dependency.getAppliedStereotype(I_SysMLStereotype.SATISFY_STEREOTYPE)!=null){
+ containsAnAbstraction=true;
+ }
+ if( dependency.getAppliedStereotype(I_SysMLStereotype.DERIVEREQT_STEREOTYPE)!=null){
+ containsAnAbstraction=true;
+ }
+ if( dependency instanceof Abstraction){
+ containsAnAbstraction=true;
+ }
+ }
+
+ }
+ if(containsAnAbstraction){
+ return false;
+ }
+ else{
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ public boolean applyTracability(Element element, TransactionalEditingDomain domain) {
+ //look for target of the abstraction
+ TreeSelectorDialog dialog = new TreeSelectorDialog(Display.getDefault().getActiveShell());
+ dialog.setContentProvider(new UMLContentProvider(element.getNearestPackage(), UMLPackage.eINSTANCE.getPackage_PackagedElement()));
+ dialog.setLabelProvider(new UMLLabelProvider());
+ dialog.setMessage("Choose DeriveReq Link for "+((NamedElement)element).getQualifiedName());
+ dialog.setTitle("Choose DeriveReq Link for "+((NamedElement)element).getName());
+ dialog.create();
+ dialog.setDescription("Choose DeriveReq Link for "+((NamedElement)element).getQualifiedName());
+ if(dialog.open() == org.eclipse.jface.window.Window.OK) {
+ Object[] result = dialog.getResult();
+ DerivationReqCreateCommand cmd= new DerivationReqCreateCommand(domain, ((NamedElement)result[0]),((NamedElement)element) );
+ domain.getCommandStack().execute(cmd);
+ }
+ return false;
+ }
+
+}
diff --git a/extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/src/org/eclipse/papyrus/req/sysml/traceabilityassistant/analysis/ITracabilityRule.java b/extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/src/org/eclipse/papyrus/req/sysml/traceabilityassistant/analysis/ITracabilityRule.java
new file mode 100644
index 00000000000..0c06ee24af9
--- /dev/null
+++ b/extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/src/org/eclipse/papyrus/req/sysml/traceabilityassistant/analysis/ITracabilityRule.java
@@ -0,0 +1,39 @@
+/*****************************************************************************
+ * Copyright (c) 2015 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.req.sysml.traceabilityassistant.analysis;
+
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.uml2.uml.Element;
+/**
+ * this interface defines the contract to apply tracability
+ *
+ */
+public interface ITracabilityRule {
+ /**
+ *
+ * @param element the current element
+ * @return true if the rules is interesting for this element
+ */
+ public boolean canApplyTracability(Element element);
+
+ /**
+ * if the element is interesting we can apply tracability defined in this Rules
+ * @param element the current element
+ * @param domain use to execute command
+ * @return true if the user has accepted to apply this rules.
+ */
+ public boolean applyTracability(Element element, TransactionalEditingDomain domain);
+
+}
diff --git a/extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/src/org/eclipse/papyrus/req/sysml/traceabilityassistant/analysis/SatisfyRule.java b/extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/src/org/eclipse/papyrus/req/sysml/traceabilityassistant/analysis/SatisfyRule.java
new file mode 100644
index 00000000000..805783f3343
--- /dev/null
+++ b/extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/src/org/eclipse/papyrus/req/sysml/traceabilityassistant/analysis/SatisfyRule.java
@@ -0,0 +1,85 @@
+/*****************************************************************************
+ * Copyright (c) 2015 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.req.sysml.traceabilityassistant.analysis;
+
+import java.util.Iterator;
+
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.papyrus.infra.widgets.editors.TreeSelectorDialog;
+import org.eclipse.papyrus.req.sysml.traceabilityassistant.I_SysMLStereotype;
+import org.eclipse.papyrus.req.sysml.traceabilityassistant.command.SatisfactionCreateCommand;
+import org.eclipse.papyrus.uml.tools.providers.UMLContentProvider;
+import org.eclipse.papyrus.uml.tools.providers.UMLLabelProvider;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.uml2.uml.Abstraction;
+import org.eclipse.uml2.uml.Dependency;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.NamedElement;
+import org.eclipse.uml2.uml.UMLPackage;
+import org.eclipse.uml2.uml.UseCase;
+/**
+ *Rule of tracability for abstraction
+ *
+ */
+public class SatisfyRule implements ITracabilityRule {
+
+ public boolean canApplyTracability(Element element) {
+ //this must be a usecase
+ if( (element instanceof UseCase)){
+ if(element.getAppliedStereotype(I_SysMLStereotype.REQUIREMENT_STEREOTYPE)==null){
+ UseCase currentClass= (UseCase)element;
+ boolean containsAnAbstraction=false;
+ Iterator<Dependency> dependencyIterator=currentClass.getClientDependencies().iterator();
+ while (dependencyIterator.hasNext()) {
+ Dependency dependency = (Dependency) dependencyIterator.next();
+ if( dependency instanceof Abstraction){
+ if( dependency.getAppliedStereotype(I_SysMLStereotype.SATISFY_STEREOTYPE)!=null){
+ containsAnAbstraction=true;
+ }
+ if( dependency instanceof Abstraction){
+ containsAnAbstraction=true;
+ }
+ }
+
+ }
+ if(containsAnAbstraction){
+ return false;
+ }
+ else{
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ public boolean applyTracability(Element element, TransactionalEditingDomain domain) {
+ //look for target of the abstraction
+ TreeSelectorDialog dialog = new TreeSelectorDialog(Display.getDefault().getActiveShell());
+ dialog.setContentProvider(new UMLContentProvider(element.getNearestPackage(), UMLPackage.eINSTANCE.getPackage_PackagedElement()));
+ dialog.setLabelProvider(new UMLLabelProvider());
+ dialog.setMessage("Choose Satisfy Link for "+((NamedElement)element).getQualifiedName());
+ dialog.setTitle("Choose Satisfy Link for "+((NamedElement)element).getName());
+ dialog.create();
+ dialog.setDescription("Choose Satisfy Link for "+((NamedElement)element).getQualifiedName());
+ if(dialog.open() == org.eclipse.jface.window.Window.OK) {
+ Object[] result = dialog.getResult();
+ SatisfactionCreateCommand cmd= new SatisfactionCreateCommand(domain, ((NamedElement)result[0]),((NamedElement)element) );
+ domain.getCommandStack().execute(cmd);
+ }
+ return false;
+ }
+
+}
diff --git a/extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/src/org/eclipse/papyrus/req/sysml/traceabilityassistant/analysis/TracabilityAnalyzer.java b/extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/src/org/eclipse/papyrus/req/sysml/traceabilityassistant/analysis/TracabilityAnalyzer.java
new file mode 100644
index 00000000000..cc7c63f01be
--- /dev/null
+++ b/extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/src/org/eclipse/papyrus/req/sysml/traceabilityassistant/analysis/TracabilityAnalyzer.java
@@ -0,0 +1,87 @@
+/*****************************************************************************
+ * Copyright (c) 2015 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.req.sysml.traceabilityassistant.analysis;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.uml2.uml.Element;
+
+/**
+ * the purpose of this class us to analyze the model
+ * and to propose to set the tracability
+ *
+ */
+public class TracabilityAnalyzer {
+ /**list of element for which question must not be asked**/
+ private ArrayList<Element> blackbox= new ArrayList<Element>();
+ /** list of tracability rules**/
+ private ArrayList<ITracabilityRule> tracabilityRules= new ArrayList<ITracabilityRule>();
+
+ /**
+ * Constructor
+ */
+ public TracabilityAnalyzer() {
+ super();
+ tracabilityRules.add(new AbstractionRule());
+ tracabilityRules.add(new SatisfyRule());
+ tracabilityRules.add(new DeriveReqRule());
+ }
+
+ /**
+ * apply tracability rules on the model
+ * @param model the package to analyze
+ * @param domain the domain to execute command
+ */
+ public void runAnalysis(org.eclipse.uml2.uml.Package model, TransactionalEditingDomain domain){
+ HashMap<Element, ArrayList<ITracabilityRule>> interestingElement= new HashMap<Element, ArrayList<ITracabilityRule>>();
+ Iterator<Element> modelIterator= model.allOwnedElements().iterator();
+
+ //go through the model in order to know the list of element where we apply the tracability rules.
+ while (modelIterator.hasNext()) {
+
+ Element currentElement = (Element) modelIterator.next();
+ //test if the element is not referenced in the blackbox
+ if( !blackbox.contains(currentElement)){
+ //look for if a trace rules can be applied
+ Iterator<ITracabilityRule> tracabilityIterator= tracabilityRules.iterator();
+ while (tracabilityIterator.hasNext()) {
+ ITracabilityRule tracabilityRule = (ITracabilityRule) tracabilityIterator.next();
+ if( tracabilityRule.canApplyTracability(currentElement)){
+ if( interestingElement.containsKey(currentElement)){
+ interestingElement.get(currentElement).add(tracabilityRule);
+ }
+ else{
+ interestingElement.put(currentElement, new ArrayList<ITracabilityRule>());
+ interestingElement.get(currentElement).add(tracabilityRule);
+ }
+ }
+ }
+ }
+ }
+ //for each element execute the rules
+ Iterator<Element> elementKeyiterator=interestingElement.keySet().iterator();
+ while (elementKeyiterator.hasNext()) {
+ Element currentKey = (Element) elementKeyiterator.next();
+ Iterator<ITracabilityRule> tracabilityIterator= interestingElement.get(currentKey).iterator();
+ while (tracabilityIterator.hasNext()) {
+ ITracabilityRule iTracabilityRule = (ITracabilityRule) tracabilityIterator.next();
+ iTracabilityRule.applyTracability(currentKey, domain);
+ }
+ }
+ }
+}
diff --git a/extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/src/org/eclipse/papyrus/req/sysml/traceabilityassistant/command/AbstractionCreateCommand.java b/extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/src/org/eclipse/papyrus/req/sysml/traceabilityassistant/command/AbstractionCreateCommand.java
new file mode 100644
index 00000000000..47f0045480d
--- /dev/null
+++ b/extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/src/org/eclipse/papyrus/req/sysml/traceabilityassistant/command/AbstractionCreateCommand.java
@@ -0,0 +1,53 @@
+/*****************************************************************************
+ * Copyright (c) 2015 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.req.sysml.traceabilityassistant.command;
+
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.uml2.uml.Abstraction;
+import org.eclipse.uml2.uml.NamedElement;
+import org.eclipse.uml2.uml.UMLFactory;
+
+
+/**
+ * this command is used to create a abstraction
+ *
+ */
+public class AbstractionCreateCommand extends RecordingCommand {
+ private NamedElement source;
+ private NamedElement target;
+ /**
+ * use to make an abstraction
+ * @param domain the domain to execute a transaction
+ * @param source the source of the abstraction (the more concrete element)
+ * @param target the target of the abstraction (the more abstract element)
+
+ */
+ public AbstractionCreateCommand(TransactionalEditingDomain domain, NamedElement source, NamedElement target){
+ super(domain,"Create an Abstraction");
+ this.source=source;
+ this.target=target;
+ }
+
+ @Override
+ protected void doExecute() {
+ Abstraction theAbstraction= UMLFactory.eINSTANCE.createAbstraction();
+ target.getNearestPackage().getPackagedElements().add(theAbstraction);
+ theAbstraction.getSuppliers().add(source);
+ theAbstraction.getClients().add(target);
+ theAbstraction.setName("RefinementOf_"+this.source.getName());
+ }
+
+}
diff --git a/extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/src/org/eclipse/papyrus/req/sysml/traceabilityassistant/command/DerivationReqCreateCommand.java b/extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/src/org/eclipse/papyrus/req/sysml/traceabilityassistant/command/DerivationReqCreateCommand.java
new file mode 100644
index 00000000000..4812c6dacc3
--- /dev/null
+++ b/extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/src/org/eclipse/papyrus/req/sysml/traceabilityassistant/command/DerivationReqCreateCommand.java
@@ -0,0 +1,57 @@
+/*****************************************************************************
+ * Copyright (c) 2015 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.req.sysml.traceabilityassistant.command;
+
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.papyrus.req.sysml.traceabilityassistant.I_SysMLStereotype;
+import org.eclipse.uml2.uml.Abstraction;
+import org.eclipse.uml2.uml.NamedElement;
+import org.eclipse.uml2.uml.Stereotype;
+import org.eclipse.uml2.uml.UMLFactory;
+
+
+/**
+ * this command is used to create a link "satisfyBy" between requirement and namedElement
+ *
+ */
+public class DerivationReqCreateCommand extends RecordingCommand {
+ private NamedElement source;
+ private NamedElement target;
+ /**
+ * use to make an abstraction
+ * @param domain the domain to execute a transaction
+ * @param source the source of the abstraction (the more concrete element)
+ * @param target the target of the abstraction (the more abstract element)
+
+ */
+ public DerivationReqCreateCommand(TransactionalEditingDomain domain, NamedElement source, NamedElement target){
+ super(domain,"Create an Abstraction");
+ this.source=source;
+ this.target=target;
+ }
+
+ @Override
+ protected void doExecute() {
+ Abstraction theAbstraction= UMLFactory.eINSTANCE.createAbstraction();
+ target.getNearestPackage().getPackagedElements().add(theAbstraction);
+ theAbstraction.getSuppliers().add(source);
+ theAbstraction.getClients().add(target);
+ theAbstraction.setName("DeriveFrom_"+this.source.getName());
+ Stereotype satisfyStereotype= theAbstraction.getApplicableStereotype(I_SysMLStereotype.DERIVEREQT_STEREOTYPE);
+ theAbstraction.applyStereotype(satisfyStereotype);
+ }
+
+}
diff --git a/extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/src/org/eclipse/papyrus/req/sysml/traceabilityassistant/command/RefinementCreateCommand.java b/extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/src/org/eclipse/papyrus/req/sysml/traceabilityassistant/command/RefinementCreateCommand.java
new file mode 100644
index 00000000000..a05c0971237
--- /dev/null
+++ b/extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/src/org/eclipse/papyrus/req/sysml/traceabilityassistant/command/RefinementCreateCommand.java
@@ -0,0 +1,57 @@
+/*****************************************************************************
+ * Copyright (c) 2015 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.req.sysml.traceabilityassistant.command;
+
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.uml2.uml.Abstraction;
+import org.eclipse.uml2.uml.NamedElement;
+import org.eclipse.uml2.uml.Stereotype;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UseCase;
+
+
+/**
+ * this command is used to create a link "Refine" between requirement and UseCase
+ *
+ */
+public class RefinementCreateCommand extends RecordingCommand {
+ private UseCase source;
+ private NamedElement target;
+ /**
+ * use to make an abstraction
+ * @param domain the domain to execute a transaction
+ * @param source the source of the abstraction (the more concrete element)
+ * @param target the target of the abstraction (the more abstract element)
+
+ */
+ public RefinementCreateCommand(TransactionalEditingDomain domain, UseCase source, NamedElement target){
+ super(domain,"Create an Abstraction");
+ this.source=source;
+ this.target=target;
+ }
+
+ @Override
+ protected void doExecute() {
+ Abstraction theAbstraction= UMLFactory.eINSTANCE.createAbstraction();
+ target.getNearestPackage().getPackagedElements().add(theAbstraction);
+ theAbstraction.getSuppliers().add(source);
+ theAbstraction.getClients().add(target);
+ theAbstraction.setName("SatisfactionOf_"+this.source.getName());
+ Stereotype satisfyStereotype= theAbstraction.getApplicableStereotype("StandardProfileL2::Refine");
+ theAbstraction.applyStereotype(satisfyStereotype);
+ }
+
+}
diff --git a/extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/src/org/eclipse/papyrus/req/sysml/traceabilityassistant/command/SatisfactionCreateCommand.java b/extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/src/org/eclipse/papyrus/req/sysml/traceabilityassistant/command/SatisfactionCreateCommand.java
new file mode 100644
index 00000000000..5e238343f84
--- /dev/null
+++ b/extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/src/org/eclipse/papyrus/req/sysml/traceabilityassistant/command/SatisfactionCreateCommand.java
@@ -0,0 +1,57 @@
+/*****************************************************************************
+ * Copyright (c) 2015 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.req.sysml.traceabilityassistant.command;
+
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.papyrus.req.sysml.traceabilityassistant.I_SysMLStereotype;
+import org.eclipse.uml2.uml.Abstraction;
+import org.eclipse.uml2.uml.NamedElement;
+import org.eclipse.uml2.uml.Stereotype;
+import org.eclipse.uml2.uml.UMLFactory;
+
+
+/**
+ * this command is used to create a link "satisfyBy" between requirement and namedElement
+ *
+ */
+public class SatisfactionCreateCommand extends RecordingCommand {
+ private NamedElement source;
+ private NamedElement target;
+ /**
+ * use to make an abstraction
+ * @param domain the domain to execute a transaction
+ * @param source the source of the abstraction (the more concrete element)
+ * @param target the target of the abstraction (the more abstract element)
+
+ */
+ public SatisfactionCreateCommand(TransactionalEditingDomain domain, NamedElement source, NamedElement target){
+ super(domain,"Create an Abstraction");
+ this.source=source;
+ this.target=target;
+ }
+
+ @Override
+ protected void doExecute() {
+ Abstraction theAbstraction= UMLFactory.eINSTANCE.createAbstraction();
+ target.getNearestPackage().getPackagedElements().add(theAbstraction);
+ theAbstraction.getSuppliers().add(source);
+ theAbstraction.getClients().add(target);
+ theAbstraction.setName("SatisfactionOf_"+this.source.getName());
+ Stereotype satisfyStereotype= theAbstraction.getApplicableStereotype(I_SysMLStereotype.SATISFY_STEREOTYPE);
+ theAbstraction.applyStereotype(satisfyStereotype);
+ }
+
+}
diff --git a/extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/src/org/eclipse/papyrus/req/sysml/traceabilityassistant/handler/ApplyTracabilityHandler.java b/extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/src/org/eclipse/papyrus/req/sysml/traceabilityassistant/handler/ApplyTracabilityHandler.java
new file mode 100644
index 00000000000..6573eeefab4
--- /dev/null
+++ b/extraplugins/req/org.eclipse.papyrus.req.sysml.traceabilityassistant/src/org/eclipse/papyrus/req/sysml/traceabilityassistant/handler/ApplyTracabilityHandler.java
@@ -0,0 +1,127 @@
+/*****************************************************************************
+ * Copyright (c) 2015 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.req.sysml.traceabilityassistant.handler;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.papyrus.infra.core.utils.EditorUtils;
+import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForHandlers;
+import org.eclipse.papyrus.req.sysml.traceabilityassistant.analysis.TracabilityAnalyzer;
+import org.eclipse.papyrus.uml.extensionpoints.profile.RegisteredProfile;
+import org.eclipse.papyrus.uml.extensionpoints.utils.Util;
+import org.eclipse.ui.ISelectionService;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.Model;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.Profile;
+
+/**
+ * this class launch the application of the SysML profile
+ */
+
+public class ApplyTracabilityHandler extends AbstractHandler {
+
+ protected TransactionalEditingDomain transactionalEditingDomain=null;
+ protected org.eclipse.uml2.uml.Package selectedElement=null;
+
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ ISelectionService selectionService = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService();
+ ISelection selection = selectionService.getSelection();
+ try {
+ transactionalEditingDomain =ServiceUtilsForHandlers.getInstance().getService(org.eclipse.emf.transaction.TransactionalEditingDomain.class, event);
+ } catch (Exception e) {
+ System.err.println("impossible to get the Transactional Editing Domain "+e);
+ }
+
+
+
+ if(selection instanceof IStructuredSelection) {
+ Object selectedobject = ((IStructuredSelection)selection).getFirstElement();
+ EObject selectedEObject = (EObject)EMFHelper.getEObject(selectedobject);
+ if (selectedEObject instanceof Model){
+ selectedElement=(Package)selectedEObject;
+ }
+
+
+ if(selectedElement!=null){
+
+ @SuppressWarnings("deprecation")
+ TransactionalEditingDomain editingDomain = EditorUtils.getTransactionalEditingDomain();
+ if (editingDomain != null && selectedElement!=null) {
+ Command command = new RecordingCommand(editingDomain) {
+
+ @Override
+ protected void doExecute() {
+ changeStructure(selectedElement);
+
+ }
+ };
+ editingDomain.getCommandStack().execute(command);
+ TracabilityAnalyzer analyzer= new TracabilityAnalyzer();
+ analyzer.runAnalysis(getToPackage(selectedElement), editingDomain);
+ }
+
+ }
+ }
+ return null;
+ }
+
+ private Package getToPackage(Element elem){
+ Package tmp= elem.getNearestPackage();
+ while(tmp.getOwner()!=null && (tmp.getOwner()instanceof Package)){
+ tmp= (Package)tmp.getOwner();
+ }
+ return tmp;
+ }
+ /**
+ *
+ * @see org.eclipse.core.commands.AbstractHandler#isEnabled()
+ *
+ * @return true if the handler is possible
+ */
+ @Override
+ public boolean isEnabled() {
+ return true;
+ }
+
+ protected void changeStructure(Package currentPackage) {
+ Package topPackage= getToPackage(currentPackage);
+ //apply SysML profile
+ RegisteredProfile SysMLregisteredProfile=(RegisteredProfile)RegisteredProfile.getRegisteredProfile("SysML");
+ URI SysMLmodelUri = SysMLregisteredProfile.uri;
+ @SuppressWarnings("deprecation")
+ final Resource SysMLResource = Util.getResourceSet(topPackage).getResource(SysMLmodelUri, true);
+ Profile sysMLprofile=(Profile) SysMLResource.getContents().get(0);
+ topPackage.applyProfile(sysMLprofile);
+
+ URI standardL2URI = URI.createURI("pathmap://UML_PROFILES/StandardL2.profile.uml");
+ @SuppressWarnings("deprecation")
+ final Resource standardL2Resource = Util.getResourceSet(topPackage).getResource(standardL2URI, true);
+ Profile standardL2Profile=(Profile) standardL2Resource.getContents().get(0);
+ topPackage.applyProfile(standardL2Profile);
+ }
+
+} \ No newline at end of file

Back to the top