Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvlorenzo2013-05-15 07:19:01 -0400
committervlorenzo2013-05-15 07:19:01 -0400
commit3687927d7da4652d36a69b8ac11a2e52dabd4b38 (patch)
tree97223742ab8b5d657d90d9b3c3b2380c6864cf28 /sandbox
parent740816cf018450f6a46e6504cab49b333ae82598 (diff)
downloadorg.eclipse.papyrus-3687927d7da4652d36a69b8ac11a2e52dabd4b38.tar.gz
org.eclipse.papyrus-3687927d7da4652d36a69b8ac11a2e52dabd4b38.tar.xz
org.eclipse.papyrus-3687927d7da4652d36a69b8ac11a2e52dabd4b38.zip
408089: [Table 2] Papyrus must provides a table for SysML Allocate
https://bugs.eclipse.org/bugs/show_bug.cgi?id=408089
Diffstat (limited to 'sandbox')
-rw-r--r--sandbox/TableV3/org.eclipse.papyrus.sysml.nattable/META-INF/MANIFEST.MF3
-rw-r--r--sandbox/TableV3/org.eclipse.papyrus.sysml.nattable/plugin.xml4
-rw-r--r--sandbox/TableV3/org.eclipse.papyrus.sysml.nattable/src/org/eclipse/papyrus/sysml/nattable/manager/axis/AllocateAxisManager.java88
-rw-r--r--sandbox/TableV3/org.eclipse.papyrus.sysml.nattable/src/org/eclipse/papyrus/sysml/nattable/manager/axis/RequirementAxisManager.java4
4 files changed, 97 insertions, 2 deletions
diff --git a/sandbox/TableV3/org.eclipse.papyrus.sysml.nattable/META-INF/MANIFEST.MF b/sandbox/TableV3/org.eclipse.papyrus.sysml.nattable/META-INF/MANIFEST.MF
index 7c0151e6de3..b20c0eee3ae 100644
--- a/sandbox/TableV3/org.eclipse.papyrus.sysml.nattable/META-INF/MANIFEST.MF
+++ b/sandbox/TableV3/org.eclipse.papyrus.sysml.nattable/META-INF/MANIFEST.MF
@@ -17,7 +17,8 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.papyrus.sysml.service.types,
org.eclipse.emf.edit;bundle-version="2.9.0",
org.eclipse.papyrus.infra.nattable.model,
- org.eclipse.papyrus.infra.widgets;bundle-version="0.10.0"
+ org.eclipse.papyrus.infra.widgets;bundle-version="0.10.0",
+ org.eclipse.gmf.runtime.emf.type.core
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ActivationPolicy: lazy
Export-Package: org.eclipse.papyrus.sysml.nattable.manager.axis
diff --git a/sandbox/TableV3/org.eclipse.papyrus.sysml.nattable/plugin.xml b/sandbox/TableV3/org.eclipse.papyrus.sysml.nattable/plugin.xml
index 78886927098..c8f6f79da45 100644
--- a/sandbox/TableV3/org.eclipse.papyrus.sysml.nattable/plugin.xml
+++ b/sandbox/TableV3/org.eclipse.papyrus.sysml.nattable/plugin.xml
@@ -25,5 +25,9 @@
id="org.eclipse.papyrus.sysml.nattable.requirement.axis.manager"
manager="org.eclipse.papyrus.sysml.nattable.manager.axis.RequirementAxisManager">
</axisManager>
+ <axisManager
+ id="org.eclipse.papyrus.sysml.nattable.allocate.axis.manager"
+ manager="org.eclipse.papyrus.sysml.nattable.manager.axis.AllocateAxisManager">
+ </axisManager>
</extension>
</plugin>
diff --git a/sandbox/TableV3/org.eclipse.papyrus.sysml.nattable/src/org/eclipse/papyrus/sysml/nattable/manager/axis/AllocateAxisManager.java b/sandbox/TableV3/org.eclipse.papyrus.sysml.nattable/src/org/eclipse/papyrus/sysml/nattable/manager/axis/AllocateAxisManager.java
new file mode 100644
index 00000000000..ba2d132db0b
--- /dev/null
+++ b/sandbox/TableV3/org.eclipse.papyrus.sysml.nattable/src/org/eclipse/papyrus/sysml/nattable/manager/axis/AllocateAxisManager.java
@@ -0,0 +1,88 @@
+/*****************************************************************************
+ * Copyright (c) 2013 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.nattable.manager.axis;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.impl.AdapterImpl;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.emf.type.core.ISpecializationType;
+import org.eclipse.papyrus.infra.nattable.manager.axis.AbstractSynchronizedOnFeatureAxisManager;
+import org.eclipse.papyrus.sysml.service.types.element.SysMLElementTypes;
+import org.eclipse.papyrus.sysml.service.types.matcher.AllocateMatcher;
+import org.eclipse.uml2.uml.UMLPackage;
+
+public class AllocateAxisManager extends AbstractSynchronizedOnFeatureAxisManager {
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.manager.axis.AbstractSynchronizedOnFeatureAxisManager#addContextFeatureValueListener()
+ *
+ */
+ @Override
+ protected void addContextFeatureValueListener() {
+ this.featureListener = new AdapterImpl() {
+
+ @Override
+ public void notifyChanged(Notification msg) {
+ if(msg.getFeature() == AllocateAxisManager.this.currentListenFeature || msg.getFeature() == UMLPackage.eINSTANCE.getPackage_PackagedElement()) {
+ getTableManager().updateAxisContents(getRepresentedContentProvider());
+ }
+ }
+ };
+ getTableContext().eAdapters().add(this.featureListener);
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.manager.axis.AbstractSynchronizedOnFeatureAxisManager#dispose()
+ *
+ */
+ @Override
+ public void dispose() {
+ getTableContext().eAdapters().remove(this.featureListener);
+ super.dispose();
+ }
+
+
+ @Override
+ public boolean canCreateAxisElement(String elementId) {
+ //FIXME : use the same tricks in others AxisManager
+ return ((ISpecializationType)SysMLElementTypes.ALLOCATE).getId().equals(elementId);
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.manager.axis.AbstractSynchronizedOnFeatureAxisManager#filterObject(java.util.List)
+ *
+ * @param objects
+ * @return
+ */
+ @Override
+ protected List<Object> filterObject(final List<?> objects) {
+ final List<Object> interestingObjects = new ArrayList<Object>();
+ final AllocateMatcher matcher = new AllocateMatcher();
+ for(Object object : objects) {
+ if(object instanceof EObject) {
+ if(matcher.matches((EObject)object)) {
+ interestingObjects.add(object);
+ }
+ }
+ }
+ return interestingObjects;
+ }
+
+}
diff --git a/sandbox/TableV3/org.eclipse.papyrus.sysml.nattable/src/org/eclipse/papyrus/sysml/nattable/manager/axis/RequirementAxisManager.java b/sandbox/TableV3/org.eclipse.papyrus.sysml.nattable/src/org/eclipse/papyrus/sysml/nattable/manager/axis/RequirementAxisManager.java
index 1ebb612cf7e..7ef3848c192 100644
--- a/sandbox/TableV3/org.eclipse.papyrus.sysml.nattable/src/org/eclipse/papyrus/sysml/nattable/manager/axis/RequirementAxisManager.java
+++ b/sandbox/TableV3/org.eclipse.papyrus.sysml.nattable/src/org/eclipse/papyrus/sysml/nattable/manager/axis/RequirementAxisManager.java
@@ -19,7 +19,9 @@ import java.util.List;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.impl.AdapterImpl;
import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.emf.type.core.ISpecializationType;
import org.eclipse.papyrus.infra.nattable.manager.axis.AbstractSynchronizedOnFeatureAxisManager;
+import org.eclipse.papyrus.sysml.service.types.element.SysMLElementTypes;
import org.eclipse.papyrus.sysml.service.types.matcher.RequirementMatcher;
import org.eclipse.uml2.uml.UMLPackage;
@@ -65,7 +67,7 @@ public class RequirementAxisManager extends AbstractSynchronizedOnFeatureAxisMan
@Override
public boolean canCreateAxisElement(String elementId) {
- return "org.eclipse.papyrus.sysml.Requirement".equals(elementId); //$NON-NLS-1$
+ return ((ISpecializationType)SysMLElementTypes.REQUIREMENT).getId().equals(elementId);
}
/**

Back to the top