From f562c479206136c9f92940d4d9c3100319acea98 Mon Sep 17 00:00:00 2001
From: vlorenzo
Date: Fri, 13 May 2011 09:11:06 +0000
Subject: NEW - bug 345698: Add Table Plugins to releng
https://bugs.eclipse.org/bugs/show_bug.cgi?id=345698
NEW - bug 334240: [Enhancement] [TableEditor] Papyrus shall support Tabular Editors
https://bugs.eclipse.org/bugs/show_bug.cgi?id=334240
---
.../org.eclipse.papyrus.sysml.facets/.classpath | 7 +
.../org.eclipse.papyrus.sysml.facets/.project | 34 +++
.../META-INF/MANIFEST.MF | 21 ++
.../org.eclipse.papyrus.sysml.facets/about.html | 28 ++
.../build.properties | 11 +
.../plugin.properties | 3 +
.../org.eclipse.papyrus.sysml.facets/plugin.xml | 11 +
.../resources/requirementsFacets.facetSet | 49 ++++
.../resources/requirementsQueries.querySet | 52 ++++
.../eclipse/papyrus/sysml/facets/Activator.java | 45 ++++
.../getter/GetRequirementBase_ClassQuery.java | 34 +++
.../getter/GetRequirementDerivedFromQuery.java | 36 +++
.../value/getter/GetRequirementDerivedQuery.java | 36 +++
.../query/value/getter/GetRequirementIdQuery.java | 39 +++
.../value/getter/GetRequirementMasterQuery.java | 34 +++
.../value/getter/GetRequirementRefinedByQuery.java | 37 +++
.../getter/GetRequirementSatifiedByQuery.java | 37 +++
.../value/getter/GetRequirementTextQuery.java | 39 +++
.../value/getter/GetRequirementTracedToQuery.java | 39 +++
.../getter/GetRequirementVerifiedByQuery.java | 38 +++
.../query/value/setter/SetRequirementIdQuery.java | 91 +++++++
.../value/setter/SetRequirementTextQuery.java | 78 ++++++
.../.classpath | 7 +
.../.project | 34 +++
.../META-INF/MANIFEST.MF | 25 ++
.../about.html | 28 ++
.../build.properties | 12 +
.../icons/allocation_table.png | Bin 0 -> 555 bytes
.../plugin.properties | 3 +
.../plugin.xml | 67 +++++
.../resources/allocate.querySet | 18 ++
.../resources/allocate.tableconfiguration | 12 +
...L_Allocation_showOnlyClientAndSupplier.uiCustom | 90 +++++++
.../papyrus/sysml/table/allocation/Activator.java | 45 ++++
.../allocation/CreateAllocationTableCommand.java | 86 +++++++
.../allocation/CreateAllocationTableFactory.java | 36 +++
.../allocation/editor/AllocationTableEditor.java | 43 ++++
.../allocation/queries/CreateAbstractionQuery.java | 68 +++++
.../allocation/queries/CreateAllocateQuery.java | 69 +++++
.../table/allocation/queries/IsAllocateQuery.java | 45 ++++
.../tester/AllocationPropertyTester.java | 62 +++++
.../.classpath | 7 +
.../.project | 29 +++
.../META-INF/MANIFEST.MF | 26 ++
.../about.html | 28 ++
.../build.properties | 12 +
.../icons/table_requirement.png | Bin 0 -> 461 bytes
.../plugin.properties | 3 +
.../plugin.xml | 68 +++++
.../resources/requirements.tableconfiguration | 10 +
.../resources/requirementsTable.querySet | 13 +
.../table_UML_Class_hideAllClassFeatures.uiCustom | 282 +++++++++++++++++++++
.../papyrus/sysml/table/requirement/Activator.java | 48 ++++
.../requirement/CreateRequirementTableCommand.java | 99 ++++++++
.../requirement/CreateRequirementTableFactory.java | 29 +++
.../requirement/editor/RequirementTableEditor.java | 45 ++++
.../requirement/queries/CreateRequirement.java | 69 +++++
.../table/requirement/queries/IsRequirement.java | 51 ++++
.../tester/RequirementPropertyTester.java | 56 ++++
59 files changed, 2424 insertions(+)
create mode 100644 plugins/sysml/org.eclipse.papyrus.sysml.facets/.classpath
create mode 100644 plugins/sysml/org.eclipse.papyrus.sysml.facets/.project
create mode 100644 plugins/sysml/org.eclipse.papyrus.sysml.facets/META-INF/MANIFEST.MF
create mode 100644 plugins/sysml/org.eclipse.papyrus.sysml.facets/about.html
create mode 100644 plugins/sysml/org.eclipse.papyrus.sysml.facets/build.properties
create mode 100644 plugins/sysml/org.eclipse.papyrus.sysml.facets/plugin.properties
create mode 100644 plugins/sysml/org.eclipse.papyrus.sysml.facets/plugin.xml
create mode 100644 plugins/sysml/org.eclipse.papyrus.sysml.facets/resources/requirementsFacets.facetSet
create mode 100644 plugins/sysml/org.eclipse.papyrus.sysml.facets/resources/requirementsQueries.querySet
create mode 100644 plugins/sysml/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/Activator.java
create mode 100644 plugins/sysml/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/getter/GetRequirementBase_ClassQuery.java
create mode 100644 plugins/sysml/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/getter/GetRequirementDerivedFromQuery.java
create mode 100644 plugins/sysml/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/getter/GetRequirementDerivedQuery.java
create mode 100644 plugins/sysml/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/getter/GetRequirementIdQuery.java
create mode 100644 plugins/sysml/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/getter/GetRequirementMasterQuery.java
create mode 100644 plugins/sysml/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/getter/GetRequirementRefinedByQuery.java
create mode 100644 plugins/sysml/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/getter/GetRequirementSatifiedByQuery.java
create mode 100644 plugins/sysml/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/getter/GetRequirementTextQuery.java
create mode 100644 plugins/sysml/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/getter/GetRequirementTracedToQuery.java
create mode 100644 plugins/sysml/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/getter/GetRequirementVerifiedByQuery.java
create mode 100644 plugins/sysml/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/setter/SetRequirementIdQuery.java
create mode 100644 plugins/sysml/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/setter/SetRequirementTextQuery.java
create mode 100644 plugins/sysml/org.eclipse.papyrus.sysml.table.allocation/.classpath
create mode 100644 plugins/sysml/org.eclipse.papyrus.sysml.table.allocation/.project
create mode 100644 plugins/sysml/org.eclipse.papyrus.sysml.table.allocation/META-INF/MANIFEST.MF
create mode 100644 plugins/sysml/org.eclipse.papyrus.sysml.table.allocation/about.html
create mode 100644 plugins/sysml/org.eclipse.papyrus.sysml.table.allocation/build.properties
create mode 100644 plugins/sysml/org.eclipse.papyrus.sysml.table.allocation/icons/allocation_table.png
create mode 100644 plugins/sysml/org.eclipse.papyrus.sysml.table.allocation/plugin.properties
create mode 100644 plugins/sysml/org.eclipse.papyrus.sysml.table.allocation/plugin.xml
create mode 100644 plugins/sysml/org.eclipse.papyrus.sysml.table.allocation/resources/allocate.querySet
create mode 100644 plugins/sysml/org.eclipse.papyrus.sysml.table.allocation/resources/allocate.tableconfiguration
create mode 100644 plugins/sysml/org.eclipse.papyrus.sysml.table.allocation/resources/table_SysML_Allocation_showOnlyClientAndSupplier.uiCustom
create mode 100644 plugins/sysml/org.eclipse.papyrus.sysml.table.allocation/src/org/eclipse/papyrus/sysml/table/allocation/Activator.java
create mode 100644 plugins/sysml/org.eclipse.papyrus.sysml.table.allocation/src/org/eclipse/papyrus/sysml/table/allocation/CreateAllocationTableCommand.java
create mode 100644 plugins/sysml/org.eclipse.papyrus.sysml.table.allocation/src/org/eclipse/papyrus/sysml/table/allocation/CreateAllocationTableFactory.java
create mode 100644 plugins/sysml/org.eclipse.papyrus.sysml.table.allocation/src/org/eclipse/papyrus/sysml/table/allocation/editor/AllocationTableEditor.java
create mode 100644 plugins/sysml/org.eclipse.papyrus.sysml.table.allocation/src/org/eclipse/papyrus/sysml/table/allocation/queries/CreateAbstractionQuery.java
create mode 100644 plugins/sysml/org.eclipse.papyrus.sysml.table.allocation/src/org/eclipse/papyrus/sysml/table/allocation/queries/CreateAllocateQuery.java
create mode 100644 plugins/sysml/org.eclipse.papyrus.sysml.table.allocation/src/org/eclipse/papyrus/sysml/table/allocation/queries/IsAllocateQuery.java
create mode 100644 plugins/sysml/org.eclipse.papyrus.sysml.table.allocation/src/org/eclipse/papyrus/sysml/table/allocation/tester/AllocationPropertyTester.java
create mode 100644 plugins/sysml/org.eclipse.papyrus.sysml.table.requirement/.classpath
create mode 100644 plugins/sysml/org.eclipse.papyrus.sysml.table.requirement/.project
create mode 100644 plugins/sysml/org.eclipse.papyrus.sysml.table.requirement/META-INF/MANIFEST.MF
create mode 100644 plugins/sysml/org.eclipse.papyrus.sysml.table.requirement/about.html
create mode 100644 plugins/sysml/org.eclipse.papyrus.sysml.table.requirement/build.properties
create mode 100644 plugins/sysml/org.eclipse.papyrus.sysml.table.requirement/icons/table_requirement.png
create mode 100644 plugins/sysml/org.eclipse.papyrus.sysml.table.requirement/plugin.properties
create mode 100644 plugins/sysml/org.eclipse.papyrus.sysml.table.requirement/plugin.xml
create mode 100644 plugins/sysml/org.eclipse.papyrus.sysml.table.requirement/resources/requirements.tableconfiguration
create mode 100644 plugins/sysml/org.eclipse.papyrus.sysml.table.requirement/resources/requirementsTable.querySet
create mode 100644 plugins/sysml/org.eclipse.papyrus.sysml.table.requirement/resources/table_UML_Class_hideAllClassFeatures.uiCustom
create mode 100644 plugins/sysml/org.eclipse.papyrus.sysml.table.requirement/src/org/eclipse/papyrus/sysml/table/requirement/Activator.java
create mode 100644 plugins/sysml/org.eclipse.papyrus.sysml.table.requirement/src/org/eclipse/papyrus/sysml/table/requirement/CreateRequirementTableCommand.java
create mode 100644 plugins/sysml/org.eclipse.papyrus.sysml.table.requirement/src/org/eclipse/papyrus/sysml/table/requirement/CreateRequirementTableFactory.java
create mode 100644 plugins/sysml/org.eclipse.papyrus.sysml.table.requirement/src/org/eclipse/papyrus/sysml/table/requirement/editor/RequirementTableEditor.java
create mode 100644 plugins/sysml/org.eclipse.papyrus.sysml.table.requirement/src/org/eclipse/papyrus/sysml/table/requirement/queries/CreateRequirement.java
create mode 100644 plugins/sysml/org.eclipse.papyrus.sysml.table.requirement/src/org/eclipse/papyrus/sysml/table/requirement/queries/IsRequirement.java
create mode 100644 plugins/sysml/org.eclipse.papyrus.sysml.table.requirement/src/org/eclipse/papyrus/sysml/table/requirement/tester/RequirementPropertyTester.java
(limited to 'plugins/sysml')
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.facets/.classpath b/plugins/sysml/org.eclipse.papyrus.sysml.facets/.classpath
new file mode 100644
index 00000000000..45f024e850e
--- /dev/null
+++ b/plugins/sysml/org.eclipse.papyrus.sysml.facets/.classpath
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.facets/.project b/plugins/sysml/org.eclipse.papyrus.sysml.facets/.project
new file mode 100644
index 00000000000..f7d6054b667
--- /dev/null
+++ b/plugins/sysml/org.eclipse.papyrus.sysml.facets/.project
@@ -0,0 +1,34 @@
+
+
+ org.eclipse.papyrus.sysml.facets
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.eclipse.pde.ManifestBuilder
+
+
+
+
+ org.eclipse.pde.SchemaBuilder
+
+
+
+
+ org.eclipse.emf.facet.common.core.builder
+
+
+
+
+
+ org.eclipse.emf.facet.common.ProjectNature
+ org.eclipse.jdt.core.javanature
+ org.eclipse.pde.PluginNature
+
+
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.facets/META-INF/MANIFEST.MF b/plugins/sysml/org.eclipse.papyrus.sysml.facets/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..3eb9613ec6f
--- /dev/null
+++ b/plugins/sysml/org.eclipse.papyrus.sysml.facets/META-INF/MANIFEST.MF
@@ -0,0 +1,21 @@
+Manifest-Version: 1.0
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.emf.facet.infra.common.core,
+ org.eclipse.emf.facet.infra.query.core,
+ org.eclipse.emf.ecore,
+ org.eclipse.uml2.uml,
+ org.eclipse.papyrus.sysml;bundle-version="0.8.0",
+ org.eclipse.emf.edit,
+ org.eclipse.emf.transaction,
+ org.eclipse.uml2.common.edit
+Bundle-ActivationPolicy: lazy
+Bundle-ClassPath: .,bin
+Bundle-Version: 0.8.0.qualifier
+Bundle-Name: %pluginName
+Bundle-Activator: org.eclipse.papyrus.sysml.facets.Activator
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.eclipse.papyrus.sysml.facets;singleton:=true
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-Vendor: %providerName
+Bundle-Localization: plugin
+
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.facets/about.html b/plugins/sysml/org.eclipse.papyrus.sysml.facets/about.html
new file mode 100644
index 00000000000..82d49bf5f81
--- /dev/null
+++ b/plugins/sysml/org.eclipse.papyrus.sysml.facets/about.html
@@ -0,0 +1,28 @@
+
+
+
+
+About
+
+
+About This Content
+
+June 5, 2007
+License
+
+The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
+at http://www.eclipse.org/legal/epl-v10.html.
+For purposes of the EPL, "Program" will mean the Content.
+
+If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party ("Redistributor") and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at http://www.eclipse.org.
+
+
+
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.facets/build.properties b/plugins/sysml/org.eclipse.papyrus.sysml.facets/build.properties
new file mode 100644
index 00000000000..af947bfb91e
--- /dev/null
+++ b/plugins/sysml/org.eclipse.papyrus.sysml.facets/build.properties
@@ -0,0 +1,11 @@
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ resources/,\
+ about.html,\
+ plugin.properties
+source.. = src/
+src.includes = resources/,\
+ META-INF/,\
+ about.html
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.facets/plugin.properties b/plugins/sysml/org.eclipse.papyrus.sysml.facets/plugin.properties
new file mode 100644
index 00000000000..f0cf24e236a
--- /dev/null
+++ b/plugins/sysml/org.eclipse.papyrus.sysml.facets/plugin.properties
@@ -0,0 +1,3 @@
+#Properties file for org.eclipse.papyrus.sysml.facets
+providerName = Eclipse Modeling Project
+pluginName = EMF Facets for Papyrus SysML
\ No newline at end of file
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.facets/plugin.xml b/plugins/sysml/org.eclipse.papyrus.sysml.facets/plugin.xml
new file mode 100644
index 00000000000..db4988ec55b
--- /dev/null
+++ b/plugins/sysml/org.eclipse.papyrus.sysml.facets/plugin.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.facets/resources/requirementsFacets.facetSet b/plugins/sysml/org.eclipse.papyrus.sysml.facets/resources/requirementsFacets.facetSet
new file mode 100644
index 00000000000..a3095424567
--- /dev/null
+++ b/plugins/sysml/org.eclipse.papyrus.sysml.facets/resources/requirementsFacets.facetSet
@@ -0,0 +1,49 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.facets/resources/requirementsQueries.querySet b/plugins/sysml/org.eclipse.papyrus.sysml.facets/resources/requirementsQueries.querySet
new file mode 100644
index 00000000000..7b9454118ca
--- /dev/null
+++ b/plugins/sysml/org.eclipse.papyrus.sysml.facets/resources/requirementsQueries.querySet
@@ -0,0 +1,52 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/Activator.java b/plugins/sysml/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/Activator.java
new file mode 100644
index 00000000000..d285eeebf1d
--- /dev/null
+++ b/plugins/sysml/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/Activator.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Mia-Software.
+ * 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:
+ * Nicolas Bros (Mia-Software)
+ *******************************************************************************/
+package org.eclipse.papyrus.sysml.facets;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+/** The activator class controls the plug-in life cycle */
+public class Activator extends Plugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.papyrus.emf.facet.sysml"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ @Override
+ public void start(final BundleContext context) throws Exception {
+ super.start(context);
+ Activator.plugin = this;
+ }
+
+ @Override
+ public void stop(final BundleContext context) throws Exception {
+ Activator.plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return Activator.plugin;
+ }
+}
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/getter/GetRequirementBase_ClassQuery.java b/plugins/sysml/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/getter/GetRequirementBase_ClassQuery.java
new file mode 100644
index 00000000000..baf9708a897
--- /dev/null
+++ b/plugins/sysml/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/getter/GetRequirementBase_ClassQuery.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * Copyright (c) 2011 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:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.facets.query.value.getter;
+
+import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException;
+import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery;
+import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList;
+import org.eclipse.papyrus.sysml.util.SysmlResource;
+import org.eclipse.uml2.uml.Class;
+import org.eclipse.uml2.uml.Stereotype;
+
+/** Query to get the text of the requirement */
+public class GetRequirementBase_ClassQuery implements IJavaModelQuery {
+
+ public Class evaluate(final Class context, final ParameterValueList parameterValues) throws ModelQueryExecutionException {
+ Stereotype ste = context.getAppliedStereotype(SysmlResource.REQUIREMENT_ID);
+ if(ste != null) {
+ Object value = context.getValue(ste, SysmlResource.REQUIREMENT_BASE_CLASS_ID);
+ return (Class)value;
+ }
+ return null;
+ }
+}
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/getter/GetRequirementDerivedFromQuery.java b/plugins/sysml/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/getter/GetRequirementDerivedFromQuery.java
new file mode 100644
index 00000000000..dd02fa168ad
--- /dev/null
+++ b/plugins/sysml/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/getter/GetRequirementDerivedFromQuery.java
@@ -0,0 +1,36 @@
+/*****************************************************************************
+ * Copyright (c) 2011 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:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.facets.query.value.getter;
+
+import java.util.Collection;
+
+import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException;
+import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery;
+import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList;
+import org.eclipse.papyrus.sysml.util.SysmlResource;
+import org.eclipse.uml2.uml.Class;
+import org.eclipse.uml2.uml.Stereotype;
+
+/** Query to get the text of the requirement */
+public class GetRequirementDerivedFromQuery implements IJavaModelQuery> {
+
+ public Collection evaluate(final Class context, final ParameterValueList parameterValues) throws ModelQueryExecutionException {
+ Stereotype ste = context.getAppliedStereotype(SysmlResource.REQUIREMENT_ID);
+ if(ste != null) {
+ Object value = context.getValue(ste, SysmlResource.REQUIREMENT_DERIVED_FROM_ID);
+ return (Collection)value;
+ }
+ return null;
+ }
+}
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/getter/GetRequirementDerivedQuery.java b/plugins/sysml/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/getter/GetRequirementDerivedQuery.java
new file mode 100644
index 00000000000..0ad4a44d827
--- /dev/null
+++ b/plugins/sysml/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/getter/GetRequirementDerivedQuery.java
@@ -0,0 +1,36 @@
+/*****************************************************************************
+ * Copyright (c) 2011 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:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.facets.query.value.getter;
+
+import java.util.Collection;
+
+import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException;
+import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery;
+import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList;
+import org.eclipse.papyrus.sysml.util.SysmlResource;
+import org.eclipse.uml2.uml.Class;
+import org.eclipse.uml2.uml.Stereotype;
+
+/** Query to get the text of the requirement */
+public class GetRequirementDerivedQuery implements IJavaModelQuery> {
+
+ public Collection evaluate(final Class context, final ParameterValueList parameterValues) throws ModelQueryExecutionException {
+ Stereotype ste = context.getAppliedStereotype(SysmlResource.REQUIREMENT_ID);
+ if(ste != null) {
+ Object value = context.getValue(ste, SysmlResource.REQUIREMENT_DERIVED_ID);
+ return (Collection)value;
+ }
+ return null;
+ }
+}
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/getter/GetRequirementIdQuery.java b/plugins/sysml/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/getter/GetRequirementIdQuery.java
new file mode 100644
index 00000000000..971cefde6cb
--- /dev/null
+++ b/plugins/sysml/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/getter/GetRequirementIdQuery.java
@@ -0,0 +1,39 @@
+/*****************************************************************************
+ * Copyright (c) 2011 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:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.facets.query.value.getter;
+
+import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException;
+import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery;
+import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList;
+import org.eclipse.papyrus.sysml.util.SysmlResource;
+import org.eclipse.uml2.uml.Class;
+import org.eclipse.uml2.uml.Stereotype;
+
+/** Query to get the id of the requirement */
+public class GetRequirementIdQuery implements IJavaModelQuery {
+
+ public String evaluate(final Class context, final ParameterValueList parameterValues) throws ModelQueryExecutionException {
+ Stereotype ste = context.getAppliedStereotype(SysmlResource.REQUIREMENT_ID);
+ if(ste != null) {
+ Object value = context.getValue(ste, SysmlResource.REQUIREMENT_ID_ID);
+ if(value == null) {
+ return ""; //$NON-NLS-1$
+ }
+ if(value instanceof String) {
+ return (String)value;
+ }
+ }
+ return null;
+ }
+}
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/getter/GetRequirementMasterQuery.java b/plugins/sysml/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/getter/GetRequirementMasterQuery.java
new file mode 100644
index 00000000000..827180ac391
--- /dev/null
+++ b/plugins/sysml/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/getter/GetRequirementMasterQuery.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * Copyright (c) 2011 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:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.facets.query.value.getter;
+
+import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException;
+import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery;
+import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList;
+import org.eclipse.papyrus.sysml.util.SysmlResource;
+import org.eclipse.uml2.uml.Class;
+import org.eclipse.uml2.uml.Stereotype;
+
+/** Query to get the text of the requirement */
+public class GetRequirementMasterQuery implements IJavaModelQuery {
+
+ public Class evaluate(final Class context, final ParameterValueList parameterValues) throws ModelQueryExecutionException {
+ Stereotype ste = context.getAppliedStereotype(SysmlResource.REQUIREMENT_ID);
+ if(ste != null) {
+ Object value = context.getValue(ste, SysmlResource.REQUIREMENT_MASTER_ID);
+ return (Class)value;
+ }
+ return null;
+ }
+}
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/getter/GetRequirementRefinedByQuery.java b/plugins/sysml/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/getter/GetRequirementRefinedByQuery.java
new file mode 100644
index 00000000000..670ea5b500f
--- /dev/null
+++ b/plugins/sysml/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/getter/GetRequirementRefinedByQuery.java
@@ -0,0 +1,37 @@
+/*****************************************************************************
+ * Copyright (c) 2011 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:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.facets.query.value.getter;
+
+import java.util.Collection;
+
+import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException;
+import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery;
+import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList;
+import org.eclipse.papyrus.sysml.util.SysmlResource;
+import org.eclipse.uml2.uml.Class;
+import org.eclipse.uml2.uml.NamedElement;
+import org.eclipse.uml2.uml.Stereotype;
+
+/** Query to get the text of the requirement */
+public class GetRequirementRefinedByQuery implements IJavaModelQuery> {
+
+ public Collection evaluate(final Class context, final ParameterValueList parameterValues) throws ModelQueryExecutionException {
+ Stereotype ste = context.getAppliedStereotype(SysmlResource.REQUIREMENT_ID);
+ if(ste != null) {
+ Object value = context.getValue(ste, SysmlResource.REQUIREMENT_REFINED_BY_ID);
+ return (Collection)value;
+ }
+ return null;
+ }
+}
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/getter/GetRequirementSatifiedByQuery.java b/plugins/sysml/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/getter/GetRequirementSatifiedByQuery.java
new file mode 100644
index 00000000000..c133e91e97c
--- /dev/null
+++ b/plugins/sysml/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/getter/GetRequirementSatifiedByQuery.java
@@ -0,0 +1,37 @@
+/*****************************************************************************
+ * Copyright (c) 2011 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:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.facets.query.value.getter;
+
+import java.util.Collection;
+
+import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException;
+import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery;
+import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList;
+import org.eclipse.papyrus.sysml.util.SysmlResource;
+import org.eclipse.uml2.uml.Class;
+import org.eclipse.uml2.uml.NamedElement;
+import org.eclipse.uml2.uml.Stereotype;
+
+/** Query to get the text of the requirement */
+public class GetRequirementSatifiedByQuery implements IJavaModelQuery> {
+
+ public Collection evaluate(final Class context, final ParameterValueList parameterValues) throws ModelQueryExecutionException {
+ Stereotype ste = context.getAppliedStereotype(SysmlResource.REQUIREMENT_ID);
+ if(ste != null) {
+ Object value = context.getValue(ste, SysmlResource.REQUIREMENT_SATISFIED_BY_ID);
+ return (Collection)value;
+ }
+ return null;
+ }
+}
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/getter/GetRequirementTextQuery.java b/plugins/sysml/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/getter/GetRequirementTextQuery.java
new file mode 100644
index 00000000000..ffe1142693b
--- /dev/null
+++ b/plugins/sysml/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/getter/GetRequirementTextQuery.java
@@ -0,0 +1,39 @@
+/*****************************************************************************
+ * Copyright (c) 2011 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:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.facets.query.value.getter;
+
+import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException;
+import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery;
+import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList;
+import org.eclipse.papyrus.sysml.util.SysmlResource;
+import org.eclipse.uml2.uml.Class;
+import org.eclipse.uml2.uml.Stereotype;
+
+/** Query to get the text of the requirement */
+public class GetRequirementTextQuery implements IJavaModelQuery {
+
+ public String evaluate(final Class context, final ParameterValueList parameterValues) throws ModelQueryExecutionException {
+ Stereotype ste = context.getAppliedStereotype(SysmlResource.REQUIREMENT_ID);
+ if(ste != null) {
+ Object value = context.getValue(ste, SysmlResource.REQUIREMENT_TEXT_ID);
+ if(value == null) {
+ return ""; //$NON-NLS-1$
+ }
+ if(value instanceof String) {
+ return (String)value;
+ }
+ }
+ return null;
+ }
+}
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/getter/GetRequirementTracedToQuery.java b/plugins/sysml/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/getter/GetRequirementTracedToQuery.java
new file mode 100644
index 00000000000..f3d0d02835c
--- /dev/null
+++ b/plugins/sysml/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/getter/GetRequirementTracedToQuery.java
@@ -0,0 +1,39 @@
+/*****************************************************************************
+ * Copyright (c) 2011 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:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.facets.query.value.getter;
+
+import java.util.Collection;
+
+import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException;
+import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery;
+import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList;
+import org.eclipse.papyrus.sysml.util.SysmlResource;
+import org.eclipse.uml2.uml.Class;
+import org.eclipse.uml2.uml.NamedElement;
+import org.eclipse.uml2.uml.Stereotype;
+
+/**
+ * Query to get the text of the requirement
+ */
+public class GetRequirementTracedToQuery implements IJavaModelQuery> {
+
+ public Collection evaluate(final Class context, final ParameterValueList parameterValues) throws ModelQueryExecutionException {
+ Stereotype ste = context.getAppliedStereotype(SysmlResource.REQUIREMENT_ID);
+ if(ste != null) {
+ Object value = context.getValue(ste, SysmlResource.REQUIREMENT_TRACED_TO_ID);
+ return (Collection)value;
+ }
+ return null;
+ }
+}
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/getter/GetRequirementVerifiedByQuery.java b/plugins/sysml/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/getter/GetRequirementVerifiedByQuery.java
new file mode 100644
index 00000000000..702a6c73eb3
--- /dev/null
+++ b/plugins/sysml/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/getter/GetRequirementVerifiedByQuery.java
@@ -0,0 +1,38 @@
+/*****************************************************************************
+ * Copyright (c) 2011 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:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.facets.query.value.getter;
+
+import java.util.Collection;
+
+import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException;
+import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery;
+import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList;
+import org.eclipse.papyrus.sysml.util.SysmlResource;
+import org.eclipse.uml2.uml.Class;
+import org.eclipse.uml2.uml.Operation;
+import org.eclipse.uml2.uml.Stereotype;
+
+/** Query to get the text of the requirement */
+
+public class GetRequirementVerifiedByQuery implements IJavaModelQuery> {
+
+ public Collection evaluate(final Class context, final ParameterValueList parameterValues) throws ModelQueryExecutionException {
+ Stereotype ste = context.getAppliedStereotype(SysmlResource.REQUIREMENT_ID);
+ if(ste != null) {
+ Object value = context.getValue(ste, SysmlResource.REQUIREMENT_VERIFIED_BY_ID);
+ return (Collection)value;
+ }
+ return null;
+ }
+}
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/setter/SetRequirementIdQuery.java b/plugins/sysml/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/setter/SetRequirementIdQuery.java
new file mode 100644
index 00000000000..a60705e49e3
--- /dev/null
+++ b/plugins/sysml/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/setter/SetRequirementIdQuery.java
@@ -0,0 +1,91 @@
+/*****************************************************************************
+ * Copyright (c) 2011 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:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.facets.query.value.setter;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException;
+import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQueryWithEditingDomain;
+import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList;
+import org.eclipse.emf.facet.infra.query.runtime.ModelQueryParameterValue;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.transaction.util.TransactionUtil;
+import org.eclipse.papyrus.sysml.util.SysmlResource;
+import org.eclipse.uml2.uml.Class;
+import org.eclipse.uml2.uml.Stereotype;
+
+/** Query to set the attribute "id" of the requirement */
+public class SetRequirementIdQuery implements IJavaModelQueryWithEditingDomain {
+
+ /**
+ *
+ * @see org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery#evaluate(org.eclipse.emf.ecore.EObject,
+ * org.eclipse.emf.facet.infra.query.core.java.ParameterValueList)
+ *
+ * @param context
+ * @param parameterValues
+ * @return
+ * @throws ModelQueryExecutionException
+ */
+ public EObject evaluate(final Class context, final ParameterValueList parameterValues) throws ModelQueryExecutionException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /**
+ *
+ * @see org.eclipse.emf.facet.infra.query.core.java.IJavaModelQueryWithEditingDomain#evaluate(org.eclipse.emf.ecore.EObject,
+ * org.eclipse.emf.facet.infra.query.core.java.ParameterValueList, org.eclipse.emf.edit.domain.EditingDomain)
+ *
+ * @param arg0
+ * @param parameter
+ * @param arg2
+ * @return
+ * @throws ModelQueryExecutionException
+ */
+ public EObject evaluate(final Class context, final ParameterValueList parameter, final EditingDomain editingDomain) throws ModelQueryExecutionException {
+ final Stereotype ste = context.getAppliedStereotype(SysmlResource.REQUIREMENT_ID);
+ if(ste != null) {
+ if(parameter.size() != 0) {
+ final ModelQueryParameterValue newValue = parameter.get(0);
+ if(newValue != null && newValue.getValue() instanceof String) {
+ Command command = null;
+ TransactionalEditingDomain domain = null;
+ if(!(editingDomain instanceof TransactionalEditingDomain)) {
+ //if we work with a uml file, it is possible to get a UML2AdapterFactoryEditingDomain instead of TransactionEditingDomain
+ domain = TransactionUtil.getEditingDomain(context);
+ } else {
+ domain = (TransactionalEditingDomain)editingDomain;
+ }
+ if(domain != null) {
+ command = new RecordingCommand(domain) {
+
+ @Override
+ protected void doExecute() {
+ context.setValue(ste, SysmlResource.REQUIREMENT_ID_ID, newValue.getValue());
+ }
+ };
+ }
+ if(command != null && command.canExecute()) {
+ domain.getCommandStack().execute(command);
+ }
+ }
+ }
+ }
+ return context;
+ }
+
+}
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/setter/SetRequirementTextQuery.java b/plugins/sysml/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/setter/SetRequirementTextQuery.java
new file mode 100644
index 00000000000..cc0683a3a89
--- /dev/null
+++ b/plugins/sysml/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/setter/SetRequirementTextQuery.java
@@ -0,0 +1,78 @@
+/*****************************************************************************
+ * Copyright (c) 2011 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:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.facets.query.value.setter;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException;
+import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQueryWithEditingDomain;
+import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList;
+import org.eclipse.emf.facet.infra.query.runtime.ModelQueryParameterValue;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.papyrus.sysml.util.SysmlResource;
+import org.eclipse.uml2.uml.Class;
+import org.eclipse.uml2.uml.Stereotype;
+
+/** Query to set the attribute "text" of the requirement */
+public class SetRequirementTextQuery implements IJavaModelQueryWithEditingDomain {
+
+ /**
+ *
+ * @see org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery#evaluate(org.eclipse.emf.ecore.EObject,
+ * org.eclipse.emf.facet.infra.query.core.java.ParameterValueList)
+ *
+ * @param context
+ * @param parameterValues
+ * @return
+ * @throws ModelQueryExecutionException
+ */
+ public EObject evaluate(final Class context, final ParameterValueList parameterValues) throws ModelQueryExecutionException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /**
+ *
+ * @see org.eclipse.emf.facet.infra.query.core.java.IJavaModelQueryWithEditingDomain#evaluate(org.eclipse.emf.ecore.EObject,
+ * org.eclipse.emf.facet.infra.query.core.java.ParameterValueList, org.eclipse.emf.edit.domain.EditingDomain)
+ *
+ * @param context
+ * @param parameter
+ * @param editingDomain
+ * @return
+ * @throws ModelQueryExecutionException
+ */
+ public EObject evaluate(final Class context, final ParameterValueList parameter, final EditingDomain editingDomain) throws ModelQueryExecutionException {
+ final Stereotype ste = context.getAppliedStereotype(SysmlResource.REQUIREMENT_ID);
+ if(ste != null && editingDomain instanceof TransactionalEditingDomain) {
+ if(parameter.size() != 0) {
+ final ModelQueryParameterValue newValue = parameter.get(0);
+ if(newValue != null && newValue.getValue() instanceof String) {
+ RecordingCommand command = new RecordingCommand((TransactionalEditingDomain)editingDomain) {
+
+ @Override
+ protected void doExecute() {
+ context.setValue(ste, SysmlResource.REQUIREMENT_TEXT_ID, newValue.getValue());
+ }
+ };
+ if(command.canExecute()) {
+ editingDomain.getCommandStack().execute(command);
+ }
+ }
+ }
+ }
+ return context;
+ }
+}
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.table.allocation/.classpath b/plugins/sysml/org.eclipse.papyrus.sysml.table.allocation/.classpath
new file mode 100644
index 00000000000..45f024e850e
--- /dev/null
+++ b/plugins/sysml/org.eclipse.papyrus.sysml.table.allocation/.classpath
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.table.allocation/.project b/plugins/sysml/org.eclipse.papyrus.sysml.table.allocation/.project
new file mode 100644
index 00000000000..8415b6fa7a1
--- /dev/null
+++ b/plugins/sysml/org.eclipse.papyrus.sysml.table.allocation/.project
@@ -0,0 +1,34 @@
+
+
+ org.eclipse.papyrus.sysml.table.allocation
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.eclipse.pde.ManifestBuilder
+
+
+
+
+ org.eclipse.pde.SchemaBuilder
+
+
+
+
+ org.eclipse.emf.facet.common.core.builder
+
+
+
+
+
+ org.eclipse.emf.facet.common.ProjectNature
+ org.eclipse.jdt.core.javanature
+ org.eclipse.pde.PluginNature
+
+
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.table.allocation/META-INF/MANIFEST.MF b/plugins/sysml/org.eclipse.papyrus.sysml.table.allocation/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..eca96784d8f
--- /dev/null
+++ b/plugins/sysml/org.eclipse.papyrus.sysml.table.allocation/META-INF/MANIFEST.MF
@@ -0,0 +1,25 @@
+Manifest-Version: 1.0
+Require-Bundle: org.eclipse.emf.facet.infra.common.core,
+ org.eclipse.emf.facet.infra.query.core,
+ org.eclipse.papyrus.service.edit;bundle-version="0.8.0",
+ org.eclipse.papyrus.sysml.service.types;bundle-version="0.8.0",
+ org.eclipse.papyrus.diagram.common;bundle-version="0.8.0",
+ org.eclipse.papyrus.table.common,
+ org.eclipse.core.expressions,
+ org.eclipse.papyrus.table.instance;bundle-version="0.8.0",
+ org.eclipse.emf.facet.widgets.nattable;bundle-version="0.1.0",
+ org.eclipse.emf.facet.widgets.nattable.tableconfiguration;bundle-version="0.1.0",
+ org.eclipse.emf.facet.widgets.nattable.instance;bundle-version="0.1.0",
+ org.eclipse.papyrus.sysml
+Bundle-ActivationPolicy: lazy
+Bundle-ClassPath: .,bin
+Bundle-Version: 0.8.0.qualifier
+Bundle-Name: %pluginName
+Bundle-Activator: org.eclipse.papyrus.sysml.table.allocation.Activator
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.eclipse.papyrus.sysml.table.allocation;single
+ ton:=true
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-Vendor: %providerName
+Bundle-Localization: plugin
+
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.table.allocation/about.html b/plugins/sysml/org.eclipse.papyrus.sysml.table.allocation/about.html
new file mode 100644
index 00000000000..82d49bf5f81
--- /dev/null
+++ b/plugins/sysml/org.eclipse.papyrus.sysml.table.allocation/about.html
@@ -0,0 +1,28 @@
+
+
+
+
+About
+
+
+About This Content
+
+June 5, 2007
+License
+
+The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
+at http://www.eclipse.org/legal/epl-v10.html.
+For purposes of the EPL, "Program" will mean the Content.
+
+If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party ("Redistributor") and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at http://www.eclipse.org.
+
+
+
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.table.allocation/build.properties b/plugins/sysml/org.eclipse.papyrus.sysml.table.allocation/build.properties
new file mode 100644
index 00000000000..1ddc2f6b354
--- /dev/null
+++ b/plugins/sysml/org.eclipse.papyrus.sysml.table.allocation/build.properties
@@ -0,0 +1,12 @@
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.properties,\
+ resources/,\
+ plugin.xml,\
+ icons/,\
+ about.html
+source.. = src/
+src.includes = about.html,\
+ resources/,\
+ icons/
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.table.allocation/icons/allocation_table.png b/plugins/sysml/org.eclipse.papyrus.sysml.table.allocation/icons/allocation_table.png
new file mode 100644
index 00000000000..2188991260e
Binary files /dev/null and b/plugins/sysml/org.eclipse.papyrus.sysml.table.allocation/icons/allocation_table.png differ
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.table.allocation/plugin.properties b/plugins/sysml/org.eclipse.papyrus.sysml.table.allocation/plugin.properties
new file mode 100644
index 00000000000..842ff06fe4c
--- /dev/null
+++ b/plugins/sysml/org.eclipse.papyrus.sysml.table.allocation/plugin.properties
@@ -0,0 +1,3 @@
+#Properties file for org.eclipse.papyrus.sysml.table.allocation
+providerName = Eclipse Modeling Project
+pluginName = Papyrus Table Editor For Allocation
\ No newline at end of file
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.table.allocation/plugin.xml b/plugins/sysml/org.eclipse.papyrus.sysml.table.allocation/plugin.xml
new file mode 100644
index 00000000000..8970b328ab4
--- /dev/null
+++ b/plugins/sysml/org.eclipse.papyrus.sysml.table.allocation/plugin.xml
@@ -0,0 +1,67 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.table.allocation/resources/allocate.querySet b/plugins/sysml/org.eclipse.papyrus.sysml.table.allocation/resources/allocate.querySet
new file mode 100644
index 00000000000..bb53c6cba0a
--- /dev/null
+++ b/plugins/sysml/org.eclipse.papyrus.sysml.table.allocation/resources/allocate.querySet
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.table.allocation/resources/allocate.tableconfiguration b/plugins/sysml/org.eclipse.papyrus.sysml.table.allocation/resources/allocate.tableconfiguration
new file mode 100644
index 00000000000..eec8474c97a
--- /dev/null
+++ b/plugins/sysml/org.eclipse.papyrus.sysml.table.allocation/resources/allocate.tableconfiguration
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.table.allocation/resources/table_SysML_Allocation_showOnlyClientAndSupplier.uiCustom b/plugins/sysml/org.eclipse.papyrus.sysml.table.allocation/resources/table_SysML_Allocation_showOnlyClientAndSupplier.uiCustom
new file mode 100644
index 00000000000..f760181f0e3
--- /dev/null
+++ b/plugins/sysml/org.eclipse.papyrus.sysml.table.allocation/resources/table_SysML_Allocation_showOnlyClientAndSupplier.uiCustom
@@ -0,0 +1,90 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.table.allocation/src/org/eclipse/papyrus/sysml/table/allocation/Activator.java b/plugins/sysml/org.eclipse.papyrus.sysml.table.allocation/src/org/eclipse/papyrus/sysml/table/allocation/Activator.java
new file mode 100644
index 00000000000..5f829acfd95
--- /dev/null
+++ b/plugins/sysml/org.eclipse.papyrus.sysml.table.allocation/src/org/eclipse/papyrus/sysml/table/allocation/Activator.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Mia-Software.
+ * 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:
+ * Nicolas Bros (Mia-Software)
+ *******************************************************************************/
+package org.eclipse.papyrus.sysml.table.allocation;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+/** The activator class controls the plug-in life cycle */
+public class Activator extends Plugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.papyrus.sysml.table.allocation"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ @Override
+ public void start(final BundleContext context) throws Exception {
+ super.start(context);
+ Activator.plugin = this;
+ }
+
+ @Override
+ public void stop(final BundleContext context) throws Exception {
+ Activator.plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return Activator.plugin;
+ }
+}
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.table.allocation/src/org/eclipse/papyrus/sysml/table/allocation/CreateAllocationTableCommand.java b/plugins/sysml/org.eclipse.papyrus.sysml.table.allocation/src/org/eclipse/papyrus/sysml/table/allocation/CreateAllocationTableCommand.java
new file mode 100644
index 00000000000..7aebcb536bc
--- /dev/null
+++ b/plugins/sysml/org.eclipse.papyrus.sysml.table.allocation/src/org/eclipse/papyrus/sysml/table/allocation/CreateAllocationTableCommand.java
@@ -0,0 +1,86 @@
+/*****************************************************************************
+ * Copyright (c) 2011 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:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.table.allocation;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.eclipse.emf.facet.widgets.nattable.tableconfiguration.TableConfiguration;
+import org.eclipse.papyrus.sysml.table.allocation.editor.AllocationTableEditor;
+import org.eclipse.papyrus.sysml.util.SysmlResource;
+import org.eclipse.papyrus.table.common.handlers.AbstractCreateNattableEditorCommand;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.Package;
+
+
+
+/**
+ * The command to create the Requirement Table
+ *
+ *
+ *
+ */
+public class CreateAllocationTableCommand extends AbstractCreateNattableEditorCommand {
+
+ /**
+ *
+ * Constructor.
+ *
+ */
+ public CreateAllocationTableCommand() {
+ super(AllocationTableEditor.EDITOR_TYPE, AllocationTableEditor.DEFAULT_NAME);
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.table.common.handlers.AbstractCreateNattableEditorCommand#getTableConfiguration()
+ *
+ * @return
+ */
+ @Override
+ protected TableConfiguration getTableConfiguration() {
+ ResourceSet resourceSet = new ResourceSetImpl();
+
+ String symbolicName = Activator.getDefault().getBundle().getSymbolicName();
+ URI uri = URI.createPlatformPluginURI(symbolicName + "/resources/allocate.tableconfiguration", true); //$NON-NLS-1$
+ Resource resource = resourceSet.getResource(uri, true);
+
+ TableConfiguration tableConfiguration = null;
+ if(resource.getContents().get(0) instanceof org.eclipse.emf.facet.widgets.nattable.tableconfiguration.TableConfiguration) {
+ tableConfiguration = (TableConfiguration)resource.getContents().get(0);
+ return tableConfiguration;
+ }
+ return null;
+ }
+ /**
+ *
+ * @see org.eclipse.papyrus.table.common.handlers.AbstractCreateNattableEditorCommand#isEnabled()
+ *
+ * @return
+ */
+ @Override
+ public boolean isEnabled() {
+ EObject object = getTableContext();
+ if(object instanceof Element) {
+ Element el = (Element)object;
+ Package pack = el.getNearestPackage();
+ //we can create an Allocation Table only when the profile is applied
+ return pack.getAppliedProfile(SysmlResource.ALLOCATIONS_ID, true) != null;
+ }
+ return false;
+ }
+
+}
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.table.allocation/src/org/eclipse/papyrus/sysml/table/allocation/CreateAllocationTableFactory.java b/plugins/sysml/org.eclipse.papyrus.sysml.table.allocation/src/org/eclipse/papyrus/sysml/table/allocation/CreateAllocationTableFactory.java
new file mode 100644
index 00000000000..60db909131b
--- /dev/null
+++ b/plugins/sysml/org.eclipse.papyrus.sysml.table.allocation/src/org/eclipse/papyrus/sysml/table/allocation/CreateAllocationTableFactory.java
@@ -0,0 +1,36 @@
+/*****************************************************************************
+ * Copyright (c) 2011 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:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.table.allocation;
+
+import org.eclipse.papyrus.sysml.table.allocation.editor.AllocationTableEditor;
+import org.eclipse.papyrus.table.common.factory.AbstractNattableEditorFactory;
+
+/**
+ * the factory for the AllocationTable
+ *
+ *
+ *
+ */
+public class CreateAllocationTableFactory extends AbstractNattableEditorFactory {
+
+ /**
+ * Constructor.
+ *
+ * @param diagramClass
+ * @param expectedType
+ */
+ public CreateAllocationTableFactory() {
+ super(AllocationTableEditor.class, AllocationTableEditor.EDITOR_TYPE);
+ }
+}
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.table.allocation/src/org/eclipse/papyrus/sysml/table/allocation/editor/AllocationTableEditor.java b/plugins/sysml/org.eclipse.papyrus.sysml.table.allocation/src/org/eclipse/papyrus/sysml/table/allocation/editor/AllocationTableEditor.java
new file mode 100644
index 00000000000..6c41d9ad24b
--- /dev/null
+++ b/plugins/sysml/org.eclipse.papyrus.sysml.table.allocation/src/org/eclipse/papyrus/sysml/table/allocation/editor/AllocationTableEditor.java
@@ -0,0 +1,43 @@
+/*****************************************************************************
+ * Copyright (c) 2011 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:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.table.allocation.editor;
+
+import org.eclipse.papyrus.core.services.ServicesRegistry;
+import org.eclipse.papyrus.table.common.editor.AbstractNattableEditor;
+import org.eclipse.papyrus.table.instance.papyrustableinstance.PapyrusTableInstance;
+
+
+/**
+ *
+ * The requirement table editor
+ *
+ */
+public class AllocationTableEditor extends AbstractNattableEditor {
+
+
+ /** the type of the editor */
+ public static final String EDITOR_TYPE = "PapyrusAllocationTable"; //$NON-NLS-1$
+
+ public static final String DEFAULT_NAME = "AllocationTable"; //$NON-NLS-1$
+
+ /**
+ * @param servicesRegistry
+ * @param rawModel2
+ *
+ */
+ public AllocationTableEditor(ServicesRegistry servicesRegistry, PapyrusTableInstance rawModel) {
+ super(servicesRegistry, rawModel);
+ }
+
+}
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.table.allocation/src/org/eclipse/papyrus/sysml/table/allocation/queries/CreateAbstractionQuery.java b/plugins/sysml/org.eclipse.papyrus.sysml.table.allocation/src/org/eclipse/papyrus/sysml/table/allocation/queries/CreateAbstractionQuery.java
new file mode 100644
index 00000000000..e5bce405b57
--- /dev/null
+++ b/plugins/sysml/org.eclipse.papyrus.sysml.table.allocation/src/org/eclipse/papyrus/sysml/table/allocation/queries/CreateAbstractionQuery.java
@@ -0,0 +1,68 @@
+/*****************************************************************************
+ * Copyright (c) 2011 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:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.table.allocation.queries;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException;
+import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery;
+import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList;
+import org.eclipse.emf.facet.infra.query.runtime.ModelQueryParameterValue;
+import org.eclipse.emf.facet.widgets.celleditors.ICommandFactoriesRegistry;
+import org.eclipse.emf.facet.widgets.celleditors.ICommandFactory;
+import org.eclipse.emf.facet.widgets.nattable.tableconfiguration.InstantiationMethodParameters;
+import org.eclipse.uml2.uml.Abstraction;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/** Create a new Abstraction */
+public class CreateAbstractionQuery implements IJavaModelQuery {
+
+ /**
+ *
+ * @see org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery#evaluate(org.eclipse.emf.ecore.EObject,
+ * org.eclipse.emf.facet.infra.query.core.java.ParameterValueList)
+ *
+ * @param context
+ * @param parameterValues
+ * @return
+ * @throws ModelQueryExecutionException
+ */
+ public Abstraction evaluate(final Package context, final ParameterValueList parameterValues) throws ModelQueryExecutionException {
+ EditingDomain editingDomain = null;
+ ModelQueryParameterValue model = parameterValues.getParameterValueByName(InstantiationMethodParameters.getEditingDomainParameter().getName());
+ if(model != null) {
+ if(model.getValue() instanceof EditingDomain) {
+ editingDomain = (EditingDomain)model.getValue();
+ }
+ }
+ if(editingDomain != null) {
+ ICommandFactory commandFactory = ICommandFactoriesRegistry.INSTANCE.getCommandFactoryFor(editingDomain);
+
+ if(context != null) {
+ Abstraction abstraction = UMLFactory.eINSTANCE.createAbstraction();
+
+ String name = org.eclipse.papyrus.diagram.common.helper.NamedElementHelper.EINSTANCE.getNewUMLElementName(context, abstraction.eClass());
+ abstraction.setName(name);
+ Command command = commandFactory.createAddCommand(editingDomain, context, UMLPackage.eINSTANCE.getPackage_PackagedElement(), abstraction);
+
+ editingDomain.getCommandStack().execute(command);
+ return abstraction;
+ }
+ }
+
+ return null;
+ }
+}
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.table.allocation/src/org/eclipse/papyrus/sysml/table/allocation/queries/CreateAllocateQuery.java b/plugins/sysml/org.eclipse.papyrus.sysml.table.allocation/src/org/eclipse/papyrus/sysml/table/allocation/queries/CreateAllocateQuery.java
new file mode 100644
index 00000000000..ee3d793a881
--- /dev/null
+++ b/plugins/sysml/org.eclipse.papyrus.sysml.table.allocation/src/org/eclipse/papyrus/sysml/table/allocation/queries/CreateAllocateQuery.java
@@ -0,0 +1,69 @@
+/*****************************************************************************
+ * Copyright (c) 2011 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:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.table.allocation.queries;
+
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException;
+import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery;
+import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList;
+import org.eclipse.emf.facet.infra.query.runtime.ModelQueryParameterValue;
+import org.eclipse.emf.facet.widgets.nattable.tableconfiguration.InstantiationMethodParameters;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.papyrus.diagram.common.command.wrappers.GMFtoEMFCommandWrapper;
+import org.eclipse.papyrus.service.edit.service.ElementEditServiceUtils;
+import org.eclipse.papyrus.service.edit.service.IElementEditService;
+import org.eclipse.papyrus.sysml.service.types.element.SysMLElementTypes;
+import org.eclipse.uml2.uml.Abstraction;
+import org.eclipse.uml2.uml.Package;
+
+/** Test if the element is an Allocation */
+public class CreateAllocateQuery implements IJavaModelQuery {
+
+ /**
+ *
+ * @see org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery#evaluate(org.eclipse.emf.ecore.EObject,
+ * org.eclipse.emf.facet.infra.query.core.java.ParameterValueList)
+ *
+ * @param context
+ * @param parameterValues
+ * @return
+ * @throws ModelQueryExecutionException
+ */
+ public Abstraction evaluate(final Package context, final ParameterValueList parameterValues) throws ModelQueryExecutionException {
+ EditingDomain editingDomain = null;
+ ModelQueryParameterValue model = parameterValues.getParameterValueByName(InstantiationMethodParameters.getEditingDomainParameter().getName());
+ if(model != null) {
+ if(model.getValue() instanceof EditingDomain) {
+ editingDomain = (EditingDomain)model.getValue();
+ }
+ }
+ if(editingDomain != null) {
+ if(context != null) {
+
+ IElementEditService provider = ElementEditServiceUtils.getCommandProvider(context);
+ CreateElementRequest createRequest = new CreateElementRequest(context, SysMLElementTypes.ALLOCATE);
+ ICommand createGMFCommand = provider.getEditCommand(createRequest);
+ editingDomain.getCommandStack().execute(new GMFtoEMFCommandWrapper(createGMFCommand));
+ if(createGMFCommand.getCommandResult() != null) {//when the Model is not a SysML model, return null!
+ Object returnedValue = createGMFCommand.getCommandResult().getReturnValue();
+ return (Abstraction)returnedValue;
+ }
+ return null;
+ }
+ }
+
+ return null;
+ }
+}
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.table.allocation/src/org/eclipse/papyrus/sysml/table/allocation/queries/IsAllocateQuery.java b/plugins/sysml/org.eclipse.papyrus.sysml.table.allocation/src/org/eclipse/papyrus/sysml/table/allocation/queries/IsAllocateQuery.java
new file mode 100644
index 00000000000..84b81b061f3
--- /dev/null
+++ b/plugins/sysml/org.eclipse.papyrus.sysml.table.allocation/src/org/eclipse/papyrus/sysml/table/allocation/queries/IsAllocateQuery.java
@@ -0,0 +1,45 @@
+/*****************************************************************************
+ * Copyright (c) 2011 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:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.table.allocation.queries;
+
+import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException;
+import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery;
+import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList;
+import org.eclipse.uml2.uml.Abstraction;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.Stereotype;
+
+/** Test is the element is an Abstraction */
+public class IsAllocateQuery implements IJavaModelQuery {
+
+ /**
+ *
+ * @see org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery#evaluate(org.eclipse.emf.ecore.EObject,
+ * org.eclipse.emf.facet.infra.query.core.java.ParameterValueList)
+ *
+ * @param context
+ * @param parameterValues
+ * @return
+ * @throws ModelQueryExecutionException
+ */
+ public Boolean evaluate(final Element context, final ParameterValueList parameterValues) throws ModelQueryExecutionException {
+
+ if(context instanceof Abstraction) {
+ Abstraction abstraction = (Abstraction)context;
+ Stereotype ste = abstraction.getAppliedStereotype("SysML::Allocations::Allocate"); //$NON-NLS-1$
+ return new Boolean(ste != null);
+ }
+ return new Boolean(false);
+ }
+}
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.table.allocation/src/org/eclipse/papyrus/sysml/table/allocation/tester/AllocationPropertyTester.java b/plugins/sysml/org.eclipse.papyrus.sysml.table.allocation/src/org/eclipse/papyrus/sysml/table/allocation/tester/AllocationPropertyTester.java
new file mode 100644
index 00000000000..3677994f225
--- /dev/null
+++ b/plugins/sysml/org.eclipse.papyrus.sysml.table.allocation/src/org/eclipse/papyrus/sysml/table/allocation/tester/AllocationPropertyTester.java
@@ -0,0 +1,62 @@
+/*****************************************************************************
+ * Copyright (c) 2011 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:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.table.allocation.tester;
+
+import org.eclipse.core.expressions.PropertyTester;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.papyrus.sysml.table.allocation.CreateAllocationTableCommand;
+
+/**
+ * Property tester for Allocation Table
+ *
+ *
+ *
+ */
+public class AllocationPropertyTester extends PropertyTester {
+
+ /**
+ * the property to test
+ */
+ public static final String IS_APPLIED_ALLOCATIONS = "isAppliedAllocations"; //$NON-NLS-1$
+
+ /**
+ *
+ * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object)
+ *
+ * @param receiver
+ * @param property
+ * @param args
+ * @param expectedValue
+ * @return
+ */
+ public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
+ if(IS_APPLIED_ALLOCATIONS.equals(property) && receiver instanceof IStructuredSelection) {
+ boolean currentValue = testIsAppliedAllocation((IStructuredSelection)receiver);
+ return (new Boolean(currentValue).equals(expectedValue));
+ }
+ return false;
+ }
+
+ /**
+ * returns true
if the first selected element is inside a package where the profile SysML::Allocations is applied
+ *
+ * @param selection
+ * @return
+ */
+ private boolean testIsAppliedAllocation(IStructuredSelection selection) {
+ CreateAllocationTableCommand handler = new CreateAllocationTableCommand();
+ return handler.isEnabled();
+ }
+
+}
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.table.requirement/.classpath b/plugins/sysml/org.eclipse.papyrus.sysml.table.requirement/.classpath
new file mode 100644
index 00000000000..45f024e850e
--- /dev/null
+++ b/plugins/sysml/org.eclipse.papyrus.sysml.table.requirement/.classpath
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.table.requirement/.project b/plugins/sysml/org.eclipse.papyrus.sysml.table.requirement/.project
new file mode 100644
index 00000000000..606bd416f06
--- /dev/null
+++ b/plugins/sysml/org.eclipse.papyrus.sysml.table.requirement/.project
@@ -0,0 +1,29 @@
+
+
+ org.eclipse.papyrus.sysml.table.requirement
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.eclipse.pde.ManifestBuilder
+
+
+
+
+ org.eclipse.pde.SchemaBuilder
+
+
+
+
+
+ org.eclipse.emf.facet.common.ProjectNature
+ org.eclipse.jdt.core.javanature
+ org.eclipse.pde.PluginNature
+
+
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.table.requirement/META-INF/MANIFEST.MF b/plugins/sysml/org.eclipse.papyrus.sysml.table.requirement/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..d6d3cb88a5d
--- /dev/null
+++ b/plugins/sysml/org.eclipse.papyrus.sysml.table.requirement/META-INF/MANIFEST.MF
@@ -0,0 +1,26 @@
+Manifest-Version: 1.0
+Require-Bundle: org.eclipse.emf.facet.widgets.nattable.instance,
+ org.eclipse.emf.facet.infra.query.core,
+ org.eclipse.papyrus.diagram.common,
+ org.eclipse.papyrus.service.edit,
+ org.eclipse.papyrus.sysml.service.types,
+ org.eclipse.papyrus.table.common;bundle-version="0.8.0",
+ org.eclipse.core.expressions,
+ org.eclipse.emf.facet.infra.common.core;bundle-version="0.1.0",
+ org.eclipse.papyrus.table.instance;bundle-version="0.8.0",
+ org.eclipse.emf.facet.widgets.nattable;bundle-version="0.1.0",
+ org.eclipse.emf.facet.infra.browser.custom.core,
+ org.eclipse.papyrus.sysml;bundle-version="0.8.0"
+Bundle-Vendor: %providerName
+Bundle-ActivationPolicy: lazy
+Bundle-ClassPath: .,bin
+Bundle-Version: 0.8.0.qualifier
+Bundle-Localization: plugin
+Bundle-Name: %pluginName
+Bundle-Activator: org.eclipse.papyrus.sysml.table.requirement.Activato
+ r
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.eclipse.papyrus.sysml.table.requirement;singl
+ eton:=true
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.table.requirement/about.html b/plugins/sysml/org.eclipse.papyrus.sysml.table.requirement/about.html
new file mode 100644
index 00000000000..82d49bf5f81
--- /dev/null
+++ b/plugins/sysml/org.eclipse.papyrus.sysml.table.requirement/about.html
@@ -0,0 +1,28 @@
+
+
+
+
+About
+
+
+About This Content
+
+June 5, 2007
+License
+
+The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
+at http://www.eclipse.org/legal/epl-v10.html.
+For purposes of the EPL, "Program" will mean the Content.
+
+If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party ("Redistributor") and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at http://www.eclipse.org.
+
+
+
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.table.requirement/build.properties b/plugins/sysml/org.eclipse.papyrus.sysml.table.requirement/build.properties
new file mode 100644
index 00000000000..8ffbec87079
--- /dev/null
+++ b/plugins/sysml/org.eclipse.papyrus.sysml.table.requirement/build.properties
@@ -0,0 +1,12 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.properties,\
+ icons/,\
+ about.html,\
+ resources/,\
+ plugin.xml
+src.includes = about.html,\
+ resources/,\
+ icons/
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.table.requirement/icons/table_requirement.png b/plugins/sysml/org.eclipse.papyrus.sysml.table.requirement/icons/table_requirement.png
new file mode 100644
index 00000000000..b56387b43e0
Binary files /dev/null and b/plugins/sysml/org.eclipse.papyrus.sysml.table.requirement/icons/table_requirement.png differ
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.table.requirement/plugin.properties b/plugins/sysml/org.eclipse.papyrus.sysml.table.requirement/plugin.properties
new file mode 100644
index 00000000000..0161afc7aa4
--- /dev/null
+++ b/plugins/sysml/org.eclipse.papyrus.sysml.table.requirement/plugin.properties
@@ -0,0 +1,3 @@
+#Properties file for org.eclipse.papyrus.sysml.table.requirement
+providerName = Eclipse Modeling Project
+pluginName = Papyrus Table Editor For Requirements
\ No newline at end of file
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.table.requirement/plugin.xml b/plugins/sysml/org.eclipse.papyrus.sysml.table.requirement/plugin.xml
new file mode 100644
index 00000000000..8d484f5efc8
--- /dev/null
+++ b/plugins/sysml/org.eclipse.papyrus.sysml.table.requirement/plugin.xml
@@ -0,0 +1,68 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.table.requirement/resources/requirements.tableconfiguration b/plugins/sysml/org.eclipse.papyrus.sysml.table.requirement/resources/requirements.tableconfiguration
new file mode 100644
index 00000000000..cccdc4cc986
--- /dev/null
+++ b/plugins/sysml/org.eclipse.papyrus.sysml.table.requirement/resources/requirements.tableconfiguration
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.table.requirement/resources/requirementsTable.querySet b/plugins/sysml/org.eclipse.papyrus.sysml.table.requirement/resources/requirementsTable.querySet
new file mode 100644
index 00000000000..cafdda9349a
--- /dev/null
+++ b/plugins/sysml/org.eclipse.papyrus.sysml.table.requirement/resources/requirementsTable.querySet
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.table.requirement/resources/table_UML_Class_hideAllClassFeatures.uiCustom b/plugins/sysml/org.eclipse.papyrus.sysml.table.requirement/resources/table_UML_Class_hideAllClassFeatures.uiCustom
new file mode 100644
index 00000000000..e3b98a64c7f
--- /dev/null
+++ b/plugins/sysml/org.eclipse.papyrus.sysml.table.requirement/resources/table_UML_Class_hideAllClassFeatures.uiCustom
@@ -0,0 +1,282 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.table.requirement/src/org/eclipse/papyrus/sysml/table/requirement/Activator.java b/plugins/sysml/org.eclipse.papyrus.sysml.table.requirement/src/org/eclipse/papyrus/sysml/table/requirement/Activator.java
new file mode 100644
index 00000000000..bf6ad48cd11
--- /dev/null
+++ b/plugins/sysml/org.eclipse.papyrus.sysml.table.requirement/src/org/eclipse/papyrus/sysml/table/requirement/Activator.java
@@ -0,0 +1,48 @@
+/*****************************************************************************
+ * Copyright (c) 2011 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:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.table.requirement;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+/** The activator class controls the plug-in life cycle */
+public class Activator extends Plugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.papyrus.sysml.table.requirement"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ @Override
+ public void start(final BundleContext context) throws Exception {
+ super.start(context);
+ Activator.plugin = this;
+ }
+
+ @Override
+ public void stop(final BundleContext context) throws Exception {
+ Activator.plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return Activator.plugin;
+ }
+}
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.table.requirement/src/org/eclipse/papyrus/sysml/table/requirement/CreateRequirementTableCommand.java b/plugins/sysml/org.eclipse.papyrus.sysml.table.requirement/src/org/eclipse/papyrus/sysml/table/requirement/CreateRequirementTableCommand.java
new file mode 100644
index 00000000000..27eec6e6ce6
--- /dev/null
+++ b/plugins/sysml/org.eclipse.papyrus.sysml.table.requirement/src/org/eclipse/papyrus/sysml/table/requirement/CreateRequirementTableCommand.java
@@ -0,0 +1,99 @@
+/*****************************************************************************
+ * Copyright (c) 2011 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:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.table.requirement;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.eclipse.emf.facet.widgets.nattable.internal.Messages;
+import org.eclipse.emf.facet.widgets.nattable.tableconfiguration.TableConfiguration;
+import org.eclipse.papyrus.sysml.table.requirement.editor.RequirementTableEditor;
+import org.eclipse.papyrus.sysml.util.SysmlResource;
+import org.eclipse.papyrus.table.common.handlers.AbstractCreateNattableEditorCommand;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.Package;
+
+
+
+/**
+ * The command to create the Requirement Table
+ *
+ *
+ *
+ */
+public class CreateRequirementTableCommand extends AbstractCreateNattableEditorCommand {
+
+ /**
+ *
+ * Constructor.
+ *
+ */
+ public CreateRequirementTableCommand() {
+ super(RequirementTableEditor.EDITOR_TYPE, RequirementTableEditor.DEFAULT_NAME);
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.table.common.handlers.AbstractCreateNattableEditorCommand#getTableConfiguration()
+ *
+ * @return
+ */
+ @Override
+ protected TableConfiguration getTableConfiguration() {
+ ResourceSet resourceSet = new ResourceSetImpl();
+
+ String symbolicName = org.eclipse.papyrus.sysml.table.requirement.Activator.getDefault().getBundle().getSymbolicName();
+ URI uri = URI.createPlatformPluginURI(symbolicName + "/resources/requirements.tableconfiguration", true); //$NON-NLS-1$
+ Resource resource = resourceSet.getResource(uri, true);
+
+ TableConfiguration tableConfiguration = null;
+ if(resource.getContents().get(0) instanceof org.eclipse.emf.facet.widgets.nattable.tableconfiguration.TableConfiguration) {
+ tableConfiguration = (TableConfiguration)resource.getContents().get(0);
+ return tableConfiguration;
+ }
+ return null;
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.table.common.handlers.AbstractCreateNattableEditorCommand#isEnabled()
+ *
+ * @return
+ */
+ @Override
+ public boolean isEnabled() {
+ EObject object = getTableContext();
+ if(object instanceof Element) {
+ Element el = (Element)object;
+ Package pack = el.getNearestPackage();
+ //we can create an Allocation Table only when the profile is applied
+ return pack.getAppliedProfile(SysmlResource.REQUIREMENTS_ID, true) != null;
+ }
+ return false;
+ }
+
+ @Override
+ protected List getHiddenColumnName() {
+ List hiddenColumns = new ArrayList();
+ hiddenColumns.add(Messages.NatTableWidget_metaclass);
+ //TODO should be externalized, currently not externalized in EMF-Facet
+ hiddenColumns.add("/eContainer"); //$NON-NLS-1$
+ return hiddenColumns;
+ }
+}
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.table.requirement/src/org/eclipse/papyrus/sysml/table/requirement/CreateRequirementTableFactory.java b/plugins/sysml/org.eclipse.papyrus.sysml.table.requirement/src/org/eclipse/papyrus/sysml/table/requirement/CreateRequirementTableFactory.java
new file mode 100644
index 00000000000..c4232b6bc59
--- /dev/null
+++ b/plugins/sysml/org.eclipse.papyrus.sysml.table.requirement/src/org/eclipse/papyrus/sysml/table/requirement/CreateRequirementTableFactory.java
@@ -0,0 +1,29 @@
+/*****************************************************************************
+ * Copyright (c) 2011 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:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.table.requirement;
+
+import org.eclipse.papyrus.sysml.table.requirement.editor.RequirementTableEditor;
+
+public class CreateRequirementTableFactory extends org.eclipse.papyrus.table.common.factory.AbstractNattableEditorFactory {
+
+ /**
+ * Constructor.
+ *
+ * @param diagramClass
+ * @param expectedType
+ */
+ public CreateRequirementTableFactory() {
+ super(RequirementTableEditor.class, RequirementTableEditor.EDITOR_TYPE);
+ }
+}
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.table.requirement/src/org/eclipse/papyrus/sysml/table/requirement/editor/RequirementTableEditor.java b/plugins/sysml/org.eclipse.papyrus.sysml.table.requirement/src/org/eclipse/papyrus/sysml/table/requirement/editor/RequirementTableEditor.java
new file mode 100644
index 00000000000..664dac97f24
--- /dev/null
+++ b/plugins/sysml/org.eclipse.papyrus.sysml.table.requirement/src/org/eclipse/papyrus/sysml/table/requirement/editor/RequirementTableEditor.java
@@ -0,0 +1,45 @@
+/*****************************************************************************
+ * Copyright (c) 2011 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:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.table.requirement.editor;
+
+import org.eclipse.papyrus.core.services.ServicesRegistry;
+import org.eclipse.papyrus.table.common.editor.AbstractNattableEditor;
+import org.eclipse.papyrus.table.instance.papyrustableinstance.PapyrusTableInstance;
+
+
+
+
+/**
+ *
+ * The requirement table editor
+ *
+ */
+public class RequirementTableEditor extends AbstractNattableEditor {
+
+
+ /** the type of the editor */
+ public static final String EDITOR_TYPE = "PapyrusRequirementTable"; //$NON-NLS-1$
+
+ /** the default name */
+ public static final String DEFAULT_NAME = "RequirementTable"; //$NON-NLS-1$
+
+ /**
+ * @param servicesRegistry
+ * @param rawModel2
+ *
+ */
+ public RequirementTableEditor(final ServicesRegistry servicesRegistry, final PapyrusTableInstance rawModel) {
+ super(servicesRegistry, rawModel);
+ }
+}
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.table.requirement/src/org/eclipse/papyrus/sysml/table/requirement/queries/CreateRequirement.java b/plugins/sysml/org.eclipse.papyrus.sysml.table.requirement/src/org/eclipse/papyrus/sysml/table/requirement/queries/CreateRequirement.java
new file mode 100644
index 00000000000..85b16416ab1
--- /dev/null
+++ b/plugins/sysml/org.eclipse.papyrus.sysml.table.requirement/src/org/eclipse/papyrus/sysml/table/requirement/queries/CreateRequirement.java
@@ -0,0 +1,69 @@
+/*****************************************************************************
+ * Copyright (c) 2011 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:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.table.requirement.queries;
+
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException;
+import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery;
+import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList;
+import org.eclipse.emf.facet.infra.query.runtime.ModelQueryParameterValue;
+import org.eclipse.emf.facet.widgets.nattable.tableconfiguration.InstantiationMethodParameters;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.papyrus.diagram.common.command.wrappers.GMFtoEMFCommandWrapper;
+import org.eclipse.papyrus.service.edit.service.ElementEditServiceUtils;
+import org.eclipse.papyrus.service.edit.service.IElementEditService;
+import org.eclipse.papyrus.sysml.service.types.element.SysMLElementTypes;
+import org.eclipse.uml2.uml.Package;
+
+/** a query which creates a new requirement and associates it with its parent (contained by the scope) */
+public class CreateRequirement implements IJavaModelQuery {
+
+ /**
+ *
+ * @see org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery#evaluate(org.eclipse.emf.ecore.EObject,
+ * org.eclipse.emf.facet.infra.query.core.java.ParameterValueList)
+ *
+ * @param context
+ * @param parameterValues
+ * @return
+ * @throws ModelQueryExecutionException
+ */
+ public org.eclipse.uml2.uml.Class evaluate(final Package context, final ParameterValueList parameterValues) throws ModelQueryExecutionException {
+ EditingDomain editingDomain = null;
+ ModelQueryParameterValue model = parameterValues.getParameterValueByName(InstantiationMethodParameters.getEditingDomainParameter().getName());
+ if(model != null) {
+ if(model.getValue() instanceof EditingDomain) {
+ editingDomain = (EditingDomain)model.getValue();
+ }
+ }
+ if(editingDomain != null) {
+ if(context != null) {
+
+ IElementEditService provider = ElementEditServiceUtils.getCommandProvider(context);
+
+ CreateElementRequest createRequest = new CreateElementRequest(context, SysMLElementTypes.REQUIREMENT);
+ ICommand createGMFCommand = provider.getEditCommand(createRequest);
+
+ editingDomain.getCommandStack().execute(new GMFtoEMFCommandWrapper(createGMFCommand));
+ if(createGMFCommand.getCommandResult() != null) {//it's null, when the model is not a SysML model
+ Object returnedValue = createGMFCommand.getCommandResult().getReturnValue();
+ return (org.eclipse.uml2.uml.Class)returnedValue;
+ }
+
+ }
+ }
+ return null;
+ }
+}
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.table.requirement/src/org/eclipse/papyrus/sysml/table/requirement/queries/IsRequirement.java b/plugins/sysml/org.eclipse.papyrus.sysml.table.requirement/src/org/eclipse/papyrus/sysml/table/requirement/queries/IsRequirement.java
new file mode 100644
index 00000000000..895bb06a4f4
--- /dev/null
+++ b/plugins/sysml/org.eclipse.papyrus.sysml.table.requirement/src/org/eclipse/papyrus/sysml/table/requirement/queries/IsRequirement.java
@@ -0,0 +1,51 @@
+/*****************************************************************************
+ * Copyright (c) 2011 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:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.table.requirement.queries;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException;
+import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery;
+import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList;
+import org.eclipse.papyrus.sysml.util.SysmlResource;
+import org.eclipse.uml2.uml.Classifier;
+import org.eclipse.uml2.uml.Stereotype;
+
+/**
+ * Test if the eobject is a Requirement
+ *
+ *
+ *
+ */
+public class IsRequirement implements IJavaModelQuery {
+
+ /**
+ *
+ * @see org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery#evaluate(org.eclipse.emf.ecore.EObject,
+ * org.eclipse.emf.facet.infra.query.core.java.ParameterValueList)
+ *
+ * @param context
+ * @param parameterValues
+ * @return
+ * @throws ModelQueryExecutionException
+ */
+ public Boolean evaluate(final EObject context, final ParameterValueList parameterValues) throws ModelQueryExecutionException {
+
+ if(context instanceof Classifier) {
+ Classifier classifier = (Classifier)context;
+ Stereotype ste = classifier.getAppliedStereotype(SysmlResource.REQUIREMENT_ID);
+ return ste != null ? Boolean.TRUE : Boolean.FALSE;
+ }
+ return Boolean.FALSE;
+ }
+}
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.table.requirement/src/org/eclipse/papyrus/sysml/table/requirement/tester/RequirementPropertyTester.java b/plugins/sysml/org.eclipse.papyrus.sysml.table.requirement/src/org/eclipse/papyrus/sysml/table/requirement/tester/RequirementPropertyTester.java
new file mode 100644
index 00000000000..b60ac2ac388
--- /dev/null
+++ b/plugins/sysml/org.eclipse.papyrus.sysml.table.requirement/src/org/eclipse/papyrus/sysml/table/requirement/tester/RequirementPropertyTester.java
@@ -0,0 +1,56 @@
+/*****************************************************************************
+ * Copyright (c) 2011 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:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.table.requirement.tester;
+
+import org.eclipse.core.expressions.PropertyTester;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.papyrus.sysml.table.requirement.CreateRequirementTableCommand;
+
+
+public class RequirementPropertyTester extends PropertyTester {
+
+ /**
+ * the property to test
+ */
+ public static final String IS_APPLIED_REQUIREMENTS = "isAppliedRequirements"; //$NON-NLS-1$
+
+ /**
+ *
+ * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object)
+ *
+ * @param receiver
+ * @param property
+ * @param args
+ * @param expectedValue
+ * @return
+ */
+ public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
+ if(IS_APPLIED_REQUIREMENTS.equals(property) && receiver instanceof IStructuredSelection) {
+ boolean currentValue = testIsAppliedRequirements((IStructuredSelection)receiver);
+ return (new Boolean(currentValue).equals(expectedValue));
+ }
+ return false;
+ }
+
+ /**
+ * returns true
if the first selected element is inside a package where the profile SysML::Allocations is applied
+ *
+ * @param selection
+ * @return
+ */
+ private boolean testIsAppliedRequirements(IStructuredSelection selection) {
+ CreateRequirementTableCommand handler = new CreateRequirementTableCommand();
+ return handler.isEnabled();
+ }
+}
--
cgit v1.2.3