Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauricio Alferez2016-03-14 12:49:28 -0400
committerGerrit Code Review @ Eclipse.org2016-03-18 14:06:45 -0400
commit8dc65b6a0787f8eb11fce9cab5bf4b29db59b609 (patch)
treebcc5503ca0b7187640e54e9f5161751296e59092
parentd163f7ed2be95a4b4bd1c392f6341c4ede04acde (diff)
downloadorg.eclipse.papyrus-8dc65b6a0787f8eb11fce9cab5bf4b29db59b609.tar.gz
org.eclipse.papyrus-8dc65b6a0787f8eb11fce9cab5bf4b29db59b609.tar.xz
org.eclipse.papyrus-8dc65b6a0787f8eb11fce9cab5bf4b29db59b609.zip
Bug 489570 - [Extra plugins][Requirements] The system shall allow to the
users to automatically verify SysML requirements models Change-Id: Iec97ec202a5e28fc9e58cfc4f669b844bfbf1616 Signed-off-by: Mauricio Alferez <mauricio.alferez@cea.fr>
-rw-r--r--extraplugins/requirements/org.eclipse.papyrus.requirements.sysml.verification/.classpath7
-rw-r--r--extraplugins/requirements/org.eclipse.papyrus.requirements.sysml.verification/.project28
-rw-r--r--extraplugins/requirements/org.eclipse.papyrus.requirements.sysml.verification/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--extraplugins/requirements/org.eclipse.papyrus.requirements.sysml.verification/META-INF/MANIFEST.MF16
-rw-r--r--extraplugins/requirements/org.eclipse.papyrus.requirements.sysml.verification/build.properties5
-rw-r--r--extraplugins/requirements/org.eclipse.papyrus.requirements.sysml.verification/plugin.xml57
-rw-r--r--extraplugins/requirements/org.eclipse.papyrus.requirements.sysml.verification/pom.xml13
-rw-r--r--extraplugins/requirements/org.eclipse.papyrus.requirements.sysml.verification/src/org/eclipse/papyrus/requirements/sysml/verfication/rules/AllRequirementsMustBeSatisfied.java50
-rw-r--r--extraplugins/requirements/org.eclipse.papyrus.requirements.sysml.verification/src/org/eclipse/papyrus/requirements/sysml/verification/Activator.java59
-rw-r--r--extraplugins/requirements/org.eclipse.papyrus.requirements.sysml.verification/src/org/eclipse/papyrus/requirements/sysml/verification/ClientSelector.java25
10 files changed, 267 insertions, 0 deletions
diff --git a/extraplugins/requirements/org.eclipse.papyrus.requirements.sysml.verification/.classpath b/extraplugins/requirements/org.eclipse.papyrus.requirements.sysml.verification/.classpath
new file mode 100644
index 00000000000..b862a296d38
--- /dev/null
+++ b/extraplugins/requirements/org.eclipse.papyrus.requirements.sysml.verification/.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.8"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/extraplugins/requirements/org.eclipse.papyrus.requirements.sysml.verification/.project b/extraplugins/requirements/org.eclipse.papyrus.requirements.sysml.verification/.project
new file mode 100644
index 00000000000..44a8b2608a0
--- /dev/null
+++ b/extraplugins/requirements/org.eclipse.papyrus.requirements.sysml.verification/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.requirements.sysml.verification</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/requirements/org.eclipse.papyrus.requirements.sysml.verification/.settings/org.eclipse.jdt.core.prefs b/extraplugins/requirements/org.eclipse.papyrus.requirements.sysml.verification/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..295926d9641
--- /dev/null
+++ b/extraplugins/requirements/org.eclipse.papyrus.requirements.sysml.verification/.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.8
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/extraplugins/requirements/org.eclipse.papyrus.requirements.sysml.verification/META-INF/MANIFEST.MF b/extraplugins/requirements/org.eclipse.papyrus.requirements.sysml.verification/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..1c956568117
--- /dev/null
+++ b/extraplugins/requirements/org.eclipse.papyrus.requirements.sysml.verification/META-INF/MANIFEST.MF
@@ -0,0 +1,16 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: SysML Requirements Analysis
+Bundle-SymbolicName: org.eclipse.papyrus.requirements.sysml.verification;singleton:=true
+Bundle-Version: 0.7.0.qualifier
+Bundle-Activator: org.eclipse.papyrus.requirements.sysml.verification.Activator
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.emf.validation,
+ org.eclipse.papyrus.uml.tools.utils,
+ org.eclipse.papyrus.requirements.sysml.common
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Bundle-ActivationPolicy: lazy
+Import-Package: org.eclipse.papyrus.sysml.requirements,
+ org.eclipse.uml2.uml.util
+Export-Package: org.eclipse.papyrus.requirements.sysml.verfication.rules,
+ org.eclipse.papyrus.requirements.sysml.verification
diff --git a/extraplugins/requirements/org.eclipse.papyrus.requirements.sysml.verification/build.properties b/extraplugins/requirements/org.eclipse.papyrus.requirements.sysml.verification/build.properties
new file mode 100644
index 00000000000..6f20375d6c7
--- /dev/null
+++ b/extraplugins/requirements/org.eclipse.papyrus.requirements.sysml.verification/build.properties
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml
diff --git a/extraplugins/requirements/org.eclipse.papyrus.requirements.sysml.verification/plugin.xml b/extraplugins/requirements/org.eclipse.papyrus.requirements.sysml.verification/plugin.xml
new file mode 100644
index 00000000000..15a86df577c
--- /dev/null
+++ b/extraplugins/requirements/org.eclipse.papyrus.requirements.sysml.verification/plugin.xml
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.emf.validation.constraintProviders">
+ <category
+ id="org.eclipse.papyrus.requirements.sysml.verification.rules.category"
+ name="Papyrus for Requirements Rules">
+ </category>
+ <constraintProvider
+ mode="Batch">
+ <package
+ namespaceUri="http://www.eclipse.org/uml2/5.0.0/UML">
+ </package>
+ <constraints
+ categories="org.eclipse.papyrus.requirements.sysml.verification.rules.category">
+ <constraint
+ class="org.eclipse.papyrus.requirements.sysml.verfication.rules.AllRequirementsMustBeSatisfied"
+ id="org.eclipse.papyrus.requirements.sysml.verfication.rules.AllRequirementsAreSatisfied"
+ isEnabledByDefault="true"
+ lang="Java"
+ mode="Batch"
+ name="Papyrus 4 Requirements - Rule 1: Are all the requirements satisfied"
+ severity="WARNING"
+ statusCode="1">
+ <message>
+ Papyrus 4 Requirements - Rule 1: {0}.
+
+ </message>
+ <description>
+ The requirement is not liked by any Element
+ </description>
+ <target
+ class="Class">
+ </target>
+ </constraint>
+ </constraints>
+ </constraintProvider>
+ </extension>
+ <extension
+ point="org.eclipse.emf.validation.constraintBindings">
+ <clientContext
+ default="false"
+ id="org.eclipse.papyrus.requirements.sysml.verification.clientContext">
+ <selector
+ class="org.eclipse.papyrus.requirements.sysml.verification.ClientSelector">
+ </selector>
+ </clientContext>
+ <binding
+ context="org.eclipse.papyrus.requirements.sysml.verification.clientContext">
+ <category
+ ref="org.eclipse.papyrus.requirements.sysml.verification.rules.category">
+ </category>
+ </binding>
+ </extension>
+
+</plugin>
diff --git a/extraplugins/requirements/org.eclipse.papyrus.requirements.sysml.verification/pom.xml b/extraplugins/requirements/org.eclipse.papyrus.requirements.sysml.verification/pom.xml
new file mode 100644
index 00000000000..9d6fffb2dfd
--- /dev/null
+++ b/extraplugins/requirements/org.eclipse.papyrus.requirements.sysml.verification/pom.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>org.eclipse.papyrus.extra.releng</artifactId>
+ <groupId>org.eclipse.papyrus</groupId>
+ <version>1.2.0-SNAPSHOT</version>
+ <relativePath>../../../releng/extra</relativePath>
+ </parent>
+ <artifactId>org.eclipse.papyrus.requirements.sysml.verification</artifactId>
+ <version>0.7.0-SNAPSHOT</version>
+ <packaging>eclipse-plugin</packaging>
+</project> \ No newline at end of file
diff --git a/extraplugins/requirements/org.eclipse.papyrus.requirements.sysml.verification/src/org/eclipse/papyrus/requirements/sysml/verfication/rules/AllRequirementsMustBeSatisfied.java b/extraplugins/requirements/org.eclipse.papyrus.requirements.sysml.verification/src/org/eclipse/papyrus/requirements/sysml/verfication/rules/AllRequirementsMustBeSatisfied.java
new file mode 100644
index 00000000000..6d2fb12f80e
--- /dev/null
+++ b/extraplugins/requirements/org.eclipse.papyrus.requirements.sysml.verification/src/org/eclipse/papyrus/requirements/sysml/verfication/rules/AllRequirementsMustBeSatisfied.java
@@ -0,0 +1,50 @@
+/*****************************************************************************
+ * 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.sysml.verfication.rules;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.validation.AbstractModelConstraint;
+import org.eclipse.emf.validation.EMFEventType;
+import org.eclipse.emf.validation.IValidationContext;
+import org.eclipse.uml2.uml.Class;
+import org.eclipse.uml2.uml.Stereotype;
+import org.eclipse.papyrus.requirements.sysml.common.I_SysMLStereotype;
+
+public class AllRequirementsMustBeSatisfied extends AbstractModelConstraint {
+
+ @Override
+ public IStatus validate(IValidationContext context) {
+ Class clazz = (Class) context.getTarget();
+ EMFEventType eType = context.getEventType();
+ // In the case of batch mode
+ if (eType == EMFEventType.NULL) {
+ if (clazz.getAppliedStereotype(I_SysMLStereotype.REQUIREMENT_STEREOTYPE) != null) {
+ Stereotype reqStereotype = clazz.getAppliedStereotype(I_SysMLStereotype.REQUIREMENT_STEREOTYPE);
+ Object listOfObjectsThatSatisfyRequirement = clazz.getValue(reqStereotype, "satisfiedBy");
+
+ if (listOfObjectsThatSatisfyRequirement instanceof EList<?>) {
+ @SuppressWarnings("unchecked")
+ EList<EObject> list = (EList<EObject>) listOfObjectsThatSatisfyRequirement;
+ if (list.isEmpty()) {
+ return context.createFailureStatus(clazz.getName() + " must by satisfied.");
+ }
+ }
+ }
+ }
+ return context.createSuccessStatus();
+ }
+}
diff --git a/extraplugins/requirements/org.eclipse.papyrus.requirements.sysml.verification/src/org/eclipse/papyrus/requirements/sysml/verification/Activator.java b/extraplugins/requirements/org.eclipse.papyrus.requirements.sysml.verification/src/org/eclipse/papyrus/requirements/sysml/verification/Activator.java
new file mode 100644
index 00000000000..440db7954ae
--- /dev/null
+++ b/extraplugins/requirements/org.eclipse.papyrus.requirements.sysml.verification/src/org/eclipse/papyrus/requirements/sysml/verification/Activator.java
@@ -0,0 +1,59 @@
+/*****************************************************************************
+ * 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
+ *
+ *****************************************************************************/
+
+/*****************************************************************************
+ * 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.sysml.verification;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+public class Activator implements BundleActivator {
+
+ private static BundleContext context;
+
+ static BundleContext getContext() {
+ return context;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext bundleContext) throws Exception {
+ Activator.context = bundleContext;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext bundleContext) throws Exception {
+ Activator.context = null;
+ }
+
+}
diff --git a/extraplugins/requirements/org.eclipse.papyrus.requirements.sysml.verification/src/org/eclipse/papyrus/requirements/sysml/verification/ClientSelector.java b/extraplugins/requirements/org.eclipse.papyrus.requirements.sysml.verification/src/org/eclipse/papyrus/requirements/sysml/verification/ClientSelector.java
new file mode 100644
index 00000000000..43e5c3cec6a
--- /dev/null
+++ b/extraplugins/requirements/org.eclipse.papyrus.requirements.sysml.verification/src/org/eclipse/papyrus/requirements/sysml/verification/ClientSelector.java
@@ -0,0 +1,25 @@
+/*****************************************************************************
+ * 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.sysml.verification;
+
+import org.eclipse.emf.validation.model.IClientSelector;
+import org.eclipse.uml2.uml.Element;
+
+public class ClientSelector implements IClientSelector {
+
+ public boolean selects(Object object) {
+ return (object instanceof Element);
+ }
+}

Back to the top