Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Lorenzo2017-05-18 14:22:52 +0000
committervincent lorenzo2017-05-23 13:57:57 +0000
commit15f5077b10889a0f7bf7c750777e1668f6df98b9 (patch)
tree705f9f12c3c34e66e93aeacd616251cb20afe849 /plugins/infra/nattable
parent99f1de201d505d88d8f00206e642c7556256af47 (diff)
downloadorg.eclipse.papyrus-15f5077b10889a0f7bf7c750777e1668f6df98b9.tar.gz
org.eclipse.papyrus-15f5077b10889a0f7bf7c750777e1668f6df98b9.tar.xz
org.eclipse.papyrus-15f5077b10889a0f7bf7c750777e1668f6df98b9.zip
Bug 512564: [Table][Matrix] Papyrus must provide a generic way to the user to create relationship matrix.
Bug 516579: [Table][Matrix]Papyrus must provide a dedicated Property View for Matrix - provides a new nattableconfiguration file for a Generic Matrix For Relationship - provides the required changes to interprete this new configuration file - provides a dedicated property view Change-Id: Ia56b23086891614ac332ca678a0967593789f691 Signed-off-by: Vincent Lorenzo <vincent.lorenzo@cea.fr>
Diffstat (limited to 'plugins/infra/nattable')
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/META-INF/MANIFEST.MF5
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/plugin.xml4
-rwxr-xr-xplugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/manager/axis/EObjectColumnMatrixAxisManager.java597
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/manager/axis/EObjectTreeAxisManagerForEventList.java11
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/editor/AbstractEMFNattableEditor.java7
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/META-INF/MANIFEST.MF6
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/model/nattable.ctx4
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/src/org/eclipse/papyrus/infra/nattable/properties/modelelement/NatTableModelElement.java8
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/src/org/eclipse/papyrus/infra/nattable/properties/observable/AbstractConfigurationElementObservableValue.java4
-rwxr-xr-xplugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/contentprovider/MatrixDirectionContentProvider.java56
-rwxr-xr-xplugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/contentprovider/MatrixSourcesContentProvider.java49
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/layerstack/ColumnHeaderLayerStack.java1
-rwxr-xr-xplugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/axis/CompositeAxisManager.java2
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/cell/CellManagerFactory.java20
-rwxr-xr-xplugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/cell/IGenericMatrixRelationshipCellManager.java32
-rwxr-xr-xplugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/IMatrixTableWidgetManager.java23
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/ITreeNattableModelManager.java2
-rwxr-xr-xplugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/MatrixTableWidgetModelManager.java183
-rwxr-xr-x[-rw-r--r--]plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/TreeNattableModelManager.java43
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/messages/Messages.java6
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/messages/messages.properties5
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/provider/MANIFEST.MF39
-rwxr-xr-xplugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/provider/MatrixRelationshipDirectionLabelProvider.java113
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/HeaderAxisConfigurationManagementUtils.java52
-rwxr-xr-xplugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/NattableModelManagerFactory.java4
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/TableHelper.java32
26 files changed, 1266 insertions, 42 deletions
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/META-INF/MANIFEST.MF b/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/META-INF/MANIFEST.MF
index f0e77c08cd9..27ab27b5165 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/META-INF/MANIFEST.MF
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/META-INF/MANIFEST.MF
@@ -13,11 +13,12 @@ Export-Package: org.eclipse.papyrus.infra.emf.nattable,
Require-Bundle: org.eclipse.papyrus.infra.nattable;bundle-version="[3.0.0,4.0.0)";visibility:=reexport,
org.eclipse.papyrus.infra.emf;bundle-version="[3.0.0,4.0.0)",
org.eclipse.papyrus.infra.services.edit;bundle-version="[3.0.0,4.0.0)",
- org.eclipse.papyrus.infra.emf.gmf;bundle-version="[1.2.0,2.0.0)"
+ org.eclipse.papyrus.infra.emf.gmf;bundle-version="[1.2.0,2.0.0)",
+ org.eclipse.papyrus.infra.emf.expressions;bundle-version="[1.0.0,2.0.0)"
Bundle-Vendor: Eclipse Modeling Project
Bundle-ActivationPolicy: lazy
Bundle-Version: 3.0.0.qualifier
-Bundle-Name: EMF Nattable
+Bundle-Name: Papyrus EMF Nattable
Bundle-Activator: org.eclipse.papyrus.infra.emf.nattable.Activator
Bundle-ManifestVersion: 2
Bundle-Description: %pluginDescription
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/plugin.xml b/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/plugin.xml
index 0607e42a007..764c6afb885 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/plugin.xml
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/plugin.xml
@@ -86,6 +86,10 @@
id="org.eclipse.papyrus.infra.emf.nattable.operation.axis.manager"
manager="org.eclipse.papyrus.infra.emf.nattable.manager.axis.EOperationAxisManager">
</axisManager>
+ <axisManager
+ id="org.eclipse.papyrus.infra.emf.nattable.axis.column.eobject.matrix.manager"
+ manager="org.eclipse.papyrus.infra.emf.nattable.manager.axis.EObjectColumnMatrixAxisManager">
+ </axisManager>
</extension>
<extension
point="org.eclipse.papyrus.infra.nattable.cellmanager">
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/manager/axis/EObjectColumnMatrixAxisManager.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/manager/axis/EObjectColumnMatrixAxisManager.java
new file mode 100755
index 00000000000..5f4321efc3c
--- /dev/null
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/manager/axis/EObjectColumnMatrixAxisManager.java
@@ -0,0 +1,597 @@
+/*****************************************************************************
+ * Copyright (c) 2017 CEA LIST and others.
+ *
+ * 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.infra.emf.nattable.manager.axis;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.impl.AdapterImpl;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.papyrus.infra.emf.expressions.ExpressionsPackage;
+import org.eclipse.papyrus.infra.emf.expressions.booleanexpressions.BooleanExpressionsFactory;
+import org.eclipse.papyrus.infra.emf.expressions.booleanexpressions.IBooleanEObjectExpression;
+import org.eclipse.papyrus.infra.emf.expressions.booleanexpressions.LiteralTrueExpression;
+import org.eclipse.papyrus.infra.nattable.manager.axis.ITreeItemAxisManagerForEventList;
+import org.eclipse.papyrus.infra.nattable.manager.cell.CellManagerFactory;
+import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
+import org.eclipse.papyrus.infra.nattable.model.nattable.NattablePackage;
+import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.IAxis;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AbstractHeaderAxisConfiguration;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AxisManagerRepresentation;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.IAxisConfiguration;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.LocalTableHeaderAxisConfiguration;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.NattableaxisconfigurationPackage;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.TreeFillingConfiguration;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.AbstractAxisProvider;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.IMasterAxisProvider;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.MasterObjectAxisProvider;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.NattableaxisproviderPackage;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablecelleditor.GenericRelationshipMatrixCellEditorConfiguration;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablecelleditor.ICellEditorConfiguration;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablewrapper.IWrapper;
+import org.eclipse.papyrus.infra.nattable.utils.HeaderAxisConfigurationManagementUtils;
+
+/**
+ * This axis manager has been developed to manage the columns for Matrix. It can't be used row manager
+ *
+ * @since 3.0
+ *
+ *
+ * TODO : update contents on stereotype application/unapplication (in case of stereotype expression)
+ * TODO : update contents when a property of a displayed object changes (in case of custom expression used to filter contents)
+ */
+public class EObjectColumnMatrixAxisManager extends AbstractSynchronizedOnEStructuralFeatureAxisManager {
+
+ /**
+ * the expression returned when there is no expression registered in the TreeFillingConfiguration
+ */
+ private final IBooleanEObjectExpression defaultFIlter = BooleanExpressionsFactory.eINSTANCE.createLiteralTrueExpression();
+
+ /**
+ * The table eobjects to listen to be notified when the table configuration changes
+ */
+ private List<EObject> listenEObjects = new ArrayList<EObject>();
+
+ /**
+ * This map takes the {@link TreeFillingConfiguration} as key and its helper as value
+ */
+ private Map<TreeFillingConfiguration, TreeFillingConfigurationHelper> map;
+
+ /**
+ * This map takes a {@link EStructuralFeature} as key and the TreeFillingConfiguration providing it as value
+ */
+ private Map<EStructuralFeature, TreeFillingConfiguration> featureVSConfiguration;
+
+ /**
+ * The list of feature to listen to be notified when the table configuration change
+ */
+ private List<EStructuralFeature> tableFeatureToListen = new ArrayList<EStructuralFeature>();
+
+
+ /**
+ * the listener used to be notified when the table configuration change
+ */
+ private Adapter tableConfigurationChangesListener = new AdapterImpl() {
+
+ public void notifyChanged(final Notification msg) {
+ if (msg.isReset() || msg.isTouch()) {
+ return;
+ }
+ final Object listenFeature = msg.getFeature();
+ boolean toListen = false;
+ if (listenFeature instanceof EStructuralFeature) {
+ final EClass eClass = (EClass) ((EStructuralFeature) listenFeature).getEContainingClass();// eContainer();
+ toListen = ExpressionsPackage.eINSTANCE.getIExpression().isSuperTypeOf(eClass);
+
+ }
+ // final boolean toListen = listenFeature instanceof EStructuralFeature && ((EClass) ((EStructuralFeature) listenFeature).eContainer()).isInstance(ExpressionsPackage.eINSTANCE.getIExpression());
+ if (toListen || tableFeatureToListen.contains(msg.getFeature())) {
+ updateAxisAfterConfigurationChange();
+ // 2. we init the listener to be notified when the current table configuration changes, to be able to update the columns list
+ cleanAndReinitListenObjects();
+
+ // 3. we init the list of feature to listen for the columns sources elements
+ cleanAndFillTreeFillingConfigurationMap();
+ // TODO : update the values
+ // TODO reinit the listener
+ // TODO reinit the maps
+ }
+ };
+ };
+
+
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.emf.nattable.manager.axis.AbstractSynchronizedOnEStructuralFeatureAxisManager#init(org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager,
+ * org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AxisManagerRepresentation, org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.AbstractAxisProvider)
+ *
+ * @param manager
+ * @param rep
+ * @param provider
+ */
+ @Override
+ public void init(final INattableModelManager manager, final AxisManagerRepresentation rep, final AbstractAxisProvider provider) {
+ super.init(manager, rep, provider);
+ Assert.isTrue(getRepresentedContentProvider() instanceof MasterObjectAxisProvider);
+ // 1. we init list of feature to listen
+ this.listenEObjects = new ArrayList<EObject>();
+ this.tableFeatureToListen = new ArrayList<EStructuralFeature>();
+ this.tableFeatureToListen.add(NattablePackage.eINSTANCE.getTable_LocalColumnHeaderAxisConfiguration());
+ this.tableFeatureToListen.add(NattableaxisconfigurationPackage.eINSTANCE.getLocalTableHeaderAxisConfiguration_AxisManagerConfigurations());
+ this.tableFeatureToListen.add(NattableaxisconfigurationPackage.eINSTANCE.getTreeFillingConfiguration_AxisUsedAsAxisProvider());
+ this.tableFeatureToListen.add(NattableaxisconfigurationPackage.eINSTANCE.getTreeFillingConfiguration_FilterRule());
+ this.tableFeatureToListen.add(NattableaxisproviderPackage.eINSTANCE.getIMasterAxisProvider_Sources());
+
+ // 2. we init the listener to be notified when the current table configuration changes, to be able to update the columns list
+ cleanAndReinitListenObjects();
+
+ // 3. we init the list of feature to listen for the columns sources elements
+ cleanAndFillTreeFillingConfigurationMap();
+
+ }
+
+
+ /**
+ * This method add the {@link #tableConfigurationChangesListener} on this object
+ *
+ * @param eobject
+ * a table configuration obhect
+ */
+ private void addListenerOnTableConfigurationObjects(final EObject eobject) {
+ if (null != eobject) {
+ if (!eobject.eAdapters().contains(this.tableConfigurationChangesListener)) {// to avoid infinite loop in some case ?
+ eobject.eAdapters().add(this.tableConfigurationChangesListener);
+ this.listenEObjects.add(eobject);
+ }
+ }
+ }
+
+ /**
+ * This method remove the {@link #tableConfigurationChangesListener} on this object
+ *
+ * @param eobject
+ * a table configuration obhect
+ */
+ private void removeListenersOnTableConfigurationObjects() {
+ for (final EObject current : this.listenEObjects) {
+ current.eAdapters().remove(this.tableConfigurationChangesListener);
+ }
+ }
+
+ /**
+ * This method removes the registered listener {@link #tableConfigurationChangesListener} on all objects referenced by {@link #listenEObjects},
+ * Then the listener {@link #tableConfigurationChangesListener} is applied on all interesting objects of the tableS
+ *
+ */
+ private void cleanAndReinitListenObjects() {
+ removeListenersOnTableConfigurationObjects();
+
+ final Table table = getTableManager().getTable();
+ if (null == table) {
+ return;
+ }
+
+ addListenerOnTableConfigurationObjects(table);
+ final LocalTableHeaderAxisConfiguration columnHeaderAxisConfiguration = table.getLocalColumnHeaderAxisConfiguration();
+
+ // COLUMNS MANAGEMENT
+ // we add a listener on the columnHeaderAxisConfiguration
+ if (columnHeaderAxisConfiguration instanceof LocalTableHeaderAxisConfiguration) {
+ addListenerOnTableConfigurationObjects(columnHeaderAxisConfiguration);
+
+ // the best way will be to listen the TreeFillingConfiguration of the AxisManagerConfigruation, but it is useless, because the referenced TreeFillingConfiguration are also accessible
+ // from the owned axis configuration
+ for (final IAxisConfiguration current : columnHeaderAxisConfiguration.getOwnedAxisConfigurations()) {
+ if (current instanceof TreeFillingConfiguration && ((TreeFillingConfiguration) current).getDepth() == 1) {
+ final TreeFillingConfiguration treeFillingConfiguration = (TreeFillingConfiguration) current;
+ addListenerOnTableConfigurationObjects(treeFillingConfiguration);
+
+ IAxis provider = treeFillingConfiguration.getAxisUsedAsAxisProvider();
+ addListenerOnTableConfigurationObjects(provider);
+ final IBooleanEObjectExpression filterRule = treeFillingConfiguration.getFilterRule();
+ addListenerOnTableConfigurationObjects(filterRule);
+ }
+ }
+ }
+
+ final ICellEditorConfiguration cellEditorConfiguration = table.getOwnedCellEditorConfigurations();
+ if (null != cellEditorConfiguration) {
+ addListenerOnTableConfigurationObjects(cellEditorConfiguration);
+ if (cellEditorConfiguration instanceof GenericRelationshipMatrixCellEditorConfiguration) {
+ final GenericRelationshipMatrixCellEditorConfiguration tmp = (GenericRelationshipMatrixCellEditorConfiguration) cellEditorConfiguration;
+ final IBooleanEObjectExpression filter = tmp.getCellContentsFilter();
+ addListenerOnTableConfigurationObjects(filter);
+ }
+ }
+
+ final AbstractAxisProvider axisProvider = table.getCurrentColumnAxisProvider();
+ if (axisProvider instanceof IMasterAxisProvider) {
+ addListenerOnTableConfigurationObjects(axisProvider);
+ }
+
+ final AbstractAxisProvider rowAxisProvider = table.getCurrentRowAxisProvider();
+ if (rowAxisProvider instanceof IMasterAxisProvider) {
+ addListenerOnTableConfigurationObjects(rowAxisProvider);
+ }
+ }
+
+ /**
+ * This method clear the map {@link #map} and {@link #featureVSConfiguration}, then fill them a new time with the new values
+ */
+ private void cleanAndFillTreeFillingConfigurationMap() {
+ if (null == this.map) {
+ this.map = new HashMap<TreeFillingConfiguration, EObjectColumnMatrixAxisManager.TreeFillingConfigurationHelper>();
+ }
+ if (null == featureVSConfiguration) {
+ this.featureVSConfiguration = new HashMap<EStructuralFeature, TreeFillingConfiguration>();
+ }
+ this.map.clear();
+ this.featureVSConfiguration.clear();
+
+ final Table table = getTableManager().getTable();
+ if (null != table) {
+ final AbstractHeaderAxisConfiguration columnHeaderAxisConfiguration = HeaderAxisConfigurationManagementUtils.getColumnAbstractHeaderAxisConfigurationUsedInTable(table);
+
+ for (final IAxisConfiguration current : columnHeaderAxisConfiguration.getOwnedAxisConfigurations()) {
+ if (current instanceof TreeFillingConfiguration && ((TreeFillingConfiguration) current).getDepth() == 1) {
+ final TreeFillingConfiguration treeFillingConfiguration = (TreeFillingConfiguration) current;
+ final TreeFillingConfigurationHelper helper = new TreeFillingConfigurationHelper(treeFillingConfiguration);
+ this.map.put(treeFillingConfiguration, helper);
+ this.featureVSConfiguration.put(helper.getEStructuralFeatureToListen(), treeFillingConfiguration);
+ }
+ }
+ }
+ }
+
+
+
+ /**
+ * @return
+ * the features to listen according to the current table configuration or <code>null</code> if it is not defined
+ */
+ protected Collection<EStructuralFeature> getListenFeatures() {// TODO : avoid to update listenfeature each time, maybe we should remove this field ?
+ if (null == this.map) {
+ cleanAndFillTreeFillingConfigurationMap();
+ }
+ this.listenFeatures = new HashSet<EStructuralFeature>();
+ for (TreeFillingConfigurationHelper helper : this.map.values()) {// TODO avoid to clean a fill each time!
+ final EStructuralFeature current = helper.getEStructuralFeatureToListen();
+ this.listenFeatures.add(current);
+ }
+ return this.listenFeatures;
+ }
+
+
+ /**
+ * @see org.eclipse.papyrus.infra.emf.nattable.manager.axis.AbstractSynchronizedOnEStructuralFeatureAxisManager#verifyFeatureMultiplicity()
+ *
+ */
+ @Override
+ protected void verifyFeatureMultiplicity() {
+ // nothing to do
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.emf.nattable.manager.axis.AbstractSynchronizedOnEStructuralFeatureAxisManager#verifyValues()
+ *
+ */
+ @Override
+ protected void verifyValues() {
+ // nothing to do
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.emf.nattable.manager.axis.AbstractSynchronizedOnEStructuralFeatureAxisManager#getFeaturesValue()
+ *
+ * @return
+ */
+ @Override
+ protected List<Object> getFeaturesValue() {
+ getListenFeatures();// for initialization
+ final List<Object> values = new ArrayList<Object>();
+ for (final EObject source : getColumnSources()) {
+ values.addAll(getListenFeatureValueFor(source));
+
+ }
+ return values;
+ }
+
+ /**
+ *
+ * @param listenObject
+ * @return
+ */
+ protected List<Object> getListenFeatureValueFor(final EObject listenObject) {
+ final List<Object> values = new ArrayList<Object>();
+ for (final TreeFillingConfigurationHelper current : this.map.values()) {
+ final EStructuralFeature feature = current.getEStructuralFeatureToListen();
+ final IBooleanEObjectExpression exp = current.getFilterRule();
+ if (null != feature) {
+ Object value = listenObject.eGet(feature);
+ if (feature.isMany()) {
+ for (Object tmp : (Collection<?>) value) {
+ if (tmp instanceof EObject && exp.evaluate((EObject) tmp)) {
+ values.add(tmp);
+ }
+ }
+ } else if (value instanceof EObject && exp.evaluate((EObject) value)) {
+ values.add(value);
+ }
+ }
+ }
+ return values;
+
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.nattable.manager.axis.AbstractAxisManager#isAllowedContents(java.lang.Object)
+ *
+ * @param object
+ * @return
+ */
+ @Override
+ public boolean isAllowedContents(Object object) {
+ return true;
+ }
+
+ /**
+ * This method returns <code>true</code> if the new object can be added to the column list and <code>false</code> otherwise
+ *
+ * The signature of this method has been copied from the interface {@link ITreeItemAxisManagerForEventList}
+ *
+ * @param objectToTest
+ * an object
+ * @param semanticParent
+ * the semantic parent of the object to test
+ * @param conf
+ * the configuration which provides the object to test
+ * @param depth
+ * the depth on which we want to apply this object
+ * @return
+ * <code>true</code> if the object is accepted and false if not
+ */
+ public boolean isAllowedContents(final Object objectToTest, final Object semanticParent, final TreeFillingConfiguration conf, final int depth) {
+ boolean result = false;
+ if (semanticParent instanceof EObject && objectToTest instanceof EObject && null != conf && null != conf.getAxisUsedAsAxisProvider()) {
+ final IBooleanEObjectExpression filter = null != conf.getFilterRule() ? conf.getFilterRule() : this.defaultFIlter;
+ if (filter.evaluate((EObject) objectToTest)) {
+ result = CellManagerFactory.INSTANCE.getCrossValueAsCollection(semanticParent, conf.getAxisUsedAsAxisProvider(), this.tableManager).contains(objectToTest);
+ }
+ }
+ return result;
+ }
+
+ /**
+ *
+ * @param notification
+ * update the list of the managed objects if its required
+ */
+ @Override
+ protected void featureValueHasChanged(final Notification notification) {
+ if (notification.isTouch()) {
+ return;
+ }
+ final EStructuralFeature editedFeature = (EStructuralFeature) (notification.getFeature() instanceof EStructuralFeature ? notification.getFeature() : null);
+ if (null == editedFeature) {
+ return;
+ }
+
+ final TreeFillingConfiguration configuration = this.featureVSConfiguration.get(editedFeature);
+ if (null == configuration) {
+ return;
+ }
+
+ final int eventType = notification.getEventType();
+ final EObject editedObject = (EObject) (notification.getNotifier() instanceof EObject ? notification.getNotifier() : null);
+ if (null == editedObject) {
+ return;
+ }
+ final List<Object> toAdd = new ArrayList<Object>();
+ final List<Object> toRemove = new ArrayList<Object>();
+
+ switch (eventType) {
+ case Notification.REMOVING_ADAPTER:
+ break;// nothing to do
+ case Notification.ADD:
+ Object newValue = notification.getNewValue();
+ if (isAllowedContents(newValue, editedObject, configuration, configuration.getDepth()) && !isAlreadyManaged(newValue)) {
+ toAdd.add(newValue);
+ }
+ break;
+ case Notification.ADD_MANY:
+ Collection<?> newValues = (Collection<?>) notification.getNewValue();
+ for (final Object current : newValues) {
+ if (isAllowedContents(current, editedObject, configuration, configuration.getDepth()) && !isAlreadyManaged(current)) {
+ toAdd.add(current);
+ }
+ }
+ break;
+ case Notification.EVENT_TYPE_COUNT:
+ break;
+ case Notification.MOVE:
+ final Collection<EObject> collection = (Collection<EObject>) ((EObject) notification.getNotifier()).eGet((EStructuralFeature) notification.getFeature());
+ final Collection<EObject> subList = getSubFromFirstNotEquals(collection, (Integer) notification.getOldValue(), getIndex(collection, (EObject) notification.getNewValue()));
+
+ toRemove.addAll(subList);
+ toAdd.addAll(subList);
+ break;
+ case Notification.REMOVE:
+ final Object oldValue = notification.getOldValue();
+ if (this.managedObject.contains(oldValue)) {
+ toRemove.add(oldValue);
+ }
+ break;
+ case Notification.REMOVE_MANY:
+ Collection<?> oldValues = (Collection<?>) notification.getOldValue();
+ for (final Object current : oldValues) {
+ if (this.managedObject.contains(oldValues)) {
+ toRemove.add(current);
+ }
+ }
+ break;
+ case Notification.RESOLVE:
+ case Notification.SET:
+ case Notification.UNSET:
+ // case Notification.NO_FEATURE_ID:
+ // case Notification.NO_INDEX:
+
+ default:
+ break;
+ }
+ if (toAdd.size() > 0 || toRemove.size() > 0) {
+ updateManagedList(toAdd, toRemove);
+ }
+ }
+
+
+ /**
+ * @see org.eclipse.papyrus.infra.nattable.manager.axis.AbstractAxisManager#canBeUsedAsRowManager()
+ *
+ * @return
+ */
+ @Override
+ public boolean canBeUsedAsRowManager() {
+ return false;
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.nattable.manager.axis.AbstractAxisManager#canBeUsedAsColumnManager()
+ *
+ * @return
+ */
+ @Override
+ public boolean canBeUsedAsColumnManager() {
+ return true;
+ }
+
+ /**
+ *
+ * @return
+ * the list of the objects used as sources to provide the columns
+ */
+ protected List<EObject> getColumnSources() {
+ AbstractAxisProvider columnProvider = getTableManager().getTable().getCurrentColumnAxisProvider();
+ List<EObject> context = new ArrayList<EObject>();
+ if (columnProvider instanceof MasterObjectAxisProvider) {
+ for (IWrapper wrapper : ((MasterObjectAxisProvider) columnProvider).getSources()) {
+ if (wrapper.getElement() instanceof EObject) {
+ context.add((EObject) wrapper.getElement());
+ }
+ }
+ }
+ return context;
+ }
+
+
+ /**
+ * This method allows to update the displayed column after changes in the table configuration
+ */
+ protected void updateAxisAfterConfigurationChange() {
+ List<Object> allAxisToDisplay = new ArrayList<Object>();
+ for (final IWrapper current : ((IMasterAxisProvider) getTableManager().getTable().getCurrentColumnAxisProvider()).getSources()) {
+ allAxisToDisplay = getListenFeatureValueFor((EObject) current.getElement());
+ }
+ List<Object> toAdd = new ArrayList<Object>(allAxisToDisplay);
+ toAdd.removeAll(this.managedObject);
+
+
+ List<Object> toRemove = new ArrayList<Object>(this.managedObject);
+ toRemove.removeAll(allAxisToDisplay);
+
+ updateManagedList(toAdd, toRemove);
+ }
+
+
+
+ /**
+ * @see org.eclipse.papyrus.infra.nattable.manager.axis.AbstractAxisManager#dispose()
+ *
+ */
+ @Override
+ public void dispose() {
+ removeListenersOnTableConfigurationObjects();
+ getTableManager().getTable().eAdapters().remove(this.tableConfigurationChangesListener);
+ this.tableFeatureToListen.clear();
+ this.featureVSConfiguration.clear();
+ this.map.clear();
+ super.dispose();
+ }
+
+ /**
+ *
+ * An helper to ease access to TreeFillingConfiguration data
+ *
+ */
+ protected class TreeFillingConfigurationHelper {
+
+ /**
+ * the expression returned when there is no expression registered in the TreeFillingConfiguration
+ */
+ private final IBooleanEObjectExpression defaultExpression = BooleanExpressionsFactory.eINSTANCE.createLiteralTrueExpression();
+
+ /**
+ * The TreeFillingConfiguration
+ */
+ private final TreeFillingConfiguration fillingConfiguration;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param configuration
+ * the TreeFillingConfiguration on which will work this helper
+ */
+ public TreeFillingConfigurationHelper(final TreeFillingConfiguration configuration) {
+ this.fillingConfiguration = configuration;
+ }
+
+ /**
+ *
+ * @return
+ * the filter rule registered in the TreeFillingConfiguration or {@link LiteralTrueExpression} when no expression is registered
+ */
+ public IBooleanEObjectExpression getFilterRule() {
+ return null == this.fillingConfiguration.getFilterRule() ? this.defaultExpression : this.fillingConfiguration.getFilterRule();
+ }
+
+ private Object getFeatureToListen() {
+ if (null != this.fillingConfiguration.getAxisUsedAsAxisProvider()) {
+ return this.fillingConfiguration.getAxisUsedAsAxisProvider().getElement();
+ }
+ return null;
+ }
+
+ /**
+ *
+ * @return
+ * the {@link EStructuralFeature} to listen
+ */
+ public EStructuralFeature getEStructuralFeatureToListen() {
+ return (EStructuralFeature) (getFeatureToListen() instanceof EStructuralFeature ? getFeatureToListen() : null);
+ }
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/manager/axis/EObjectTreeAxisManagerForEventList.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/manager/axis/EObjectTreeAxisManagerForEventList.java
index 50d4c426794..f2d81d6de77 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/manager/axis/EObjectTreeAxisManagerForEventList.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/manager/axis/EObjectTreeAxisManagerForEventList.java
@@ -26,6 +26,7 @@ import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
import org.eclipse.papyrus.infra.core.sashwindows.di.PageRef;
import org.eclipse.papyrus.infra.core.sashwindows.di.Window;
+import org.eclipse.papyrus.infra.emf.expressions.booleanexpressions.IBooleanEObjectExpression;
import org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper;
import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
import org.eclipse.papyrus.infra.nattable.manager.axis.AbstractTreeAxisManagerForEventList;
@@ -116,10 +117,14 @@ public class EObjectTreeAxisManagerForEventList extends AbstractTreeAxisManagerF
*/
@Override
public boolean isAllowedContents(Object objectToTest, Object semanticParent, TreeFillingConfiguration conf, int depth) {
+ boolean result = false;
if (objectToTest instanceof EObject) {
- return true;
+ if (null != conf && null != conf.getFilterRule() && conf.getFilterRule() instanceof IBooleanEObjectExpression) {
+ return ((IBooleanEObjectExpression) conf.getFilterRule()).evaluate((EObject) objectToTest).booleanValue();
+ }
+ result = true;
}
- return false;
+ return result;
}
/**
@@ -152,7 +157,7 @@ public class EObjectTreeAxisManagerForEventList extends AbstractTreeAxisManagerF
* @param notification
* a notification
* @return
- * <code>true</code> if the notification must be ignored
+ * <code>true</code> if the notification must be ignored
*/
protected boolean ignoreEvent(final Notification notification) {
boolean res = super.ignoreEvent(notification);
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/editor/AbstractEMFNattableEditor.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/editor/AbstractEMFNattableEditor.java
index 00112572b60..eb4a42b15f2 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/editor/AbstractEMFNattableEditor.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/editor/AbstractEMFNattableEditor.java
@@ -40,6 +40,7 @@ import org.eclipse.papyrus.infra.nattable.common.Activator;
import org.eclipse.papyrus.infra.nattable.common.helper.TableReconcileHelper;
import org.eclipse.papyrus.infra.nattable.common.reconciler.TableVersioningUtils;
import org.eclipse.papyrus.infra.nattable.common.utils.TableEditorInput;
+import org.eclipse.papyrus.infra.nattable.manager.table.IMatrixTableWidgetManager;
import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
import org.eclipse.papyrus.infra.nattable.model.nattable.nattableconfiguration.NattableconfigurationPackage;
@@ -238,6 +239,12 @@ public abstract class AbstractEMFNattableEditor extends EditorPart implements Na
if (adapter == INattableModelManager.class) {
return this.tableManager;
}
+ if(adapter == IMatrixTableWidgetManager.class) {
+ if(this.tableManager instanceof IMatrixTableWidgetManager) {
+ return this.tableManager;
+ }
+ return null;
+ }
// Give direct access to the Table model element
// Most actions should be done through the TableManager.
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/META-INF/MANIFEST.MF b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/META-INF/MANIFEST.MF
index e760eb8c197..5196ef686b6 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/META-INF/MANIFEST.MF
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/META-INF/MANIFEST.MF
@@ -1,5 +1,6 @@
Manifest-Version: 1.0
-Export-Package: org.eclipse.papyrus.infra.nattable.properties.constraints
+Export-Package: org.eclipse.papyrus.infra.nattable.properties.constraints,
+ org.eclipse.papyrus.infra.nattable.properties.observable
Require-Bundle: org.eclipse.papyrus.infra.properties.ui;bundle-version="[2.0.0,3.0.0)",
org.eclipse.papyrus.infra.emf.gmf;bundle-version="[1.2.0,2.0.0)",
org.eclipse.papyrus.infra.constraints;bundle-version="[2.0.0,3.0.0)";visibility:=reexport,
@@ -8,7 +9,8 @@ Require-Bundle: org.eclipse.papyrus.infra.properties.ui;bundle-version="[2.0.0,3
org.eclipse.papyrus.infra.emf.nattable;bundle-version="[3.0.0,4.0.0)",
org.eclipse.papyrus.infra.nattable.common;bundle-version="[3.0.0,4.0.0)",
org.eclipse.papyrus.infra.internationalization.utils;bundle-version="[1.0.0,2.0.0)",
- org.eclipse.papyrus.infra.internationalization;bundle-version="[1.0.0,2.0.0)"
+ org.eclipse.papyrus.infra.internationalization;bundle-version="[1.0.0,2.0.0)",
+ org.eclipse.papyrus.infra.nattable;bundle-version="[3.0.0,4.0.0)"
Bundle-Vendor: %Bundle-Vendor
Bundle-ActivationPolicy: lazy
Bundle-Version: 2.2.0.qualifier
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/model/nattable.ctx b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/model/nattable.ctx
index bed8cc6b562..b83c60e1abe 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/model/nattable.ctx
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/model/nattable.ctx
@@ -204,7 +204,7 @@
<widget href="ui/EObjectInTreeTable.xwt#/"/>
</sections>
</tabs>
- <tabs xmi:id="_bYfDCJLDEeWbp4A9_-WIrQ" label="Appearance" id="TableAppearance" category="org.eclipse.papyrus" afterTab="_bYd04ZLDEeWbp4A9_-WIrQ" priority="12">
+ <tabs xmi:id="_bYfDCJLDEeWbp4A9_-WIrQ" label="Appearance" id="TableAppearance" category="org.eclipse.papyrus" afterTab="_bYd04ZLDEeWbp4A9_-WIrQ" priority="13">
<sections xmi:id="_hIAtIJQtEeWx9KtEop_Tug" name="SingleNormalTableAppearance" sectionFile="ui/SingleNormalTableAppearance.xwt">
<constraints xsi:type="constraints:SimpleConstraint" xmi:id="_2SAlsJQtEeWx9KtEop_Tug" name="isNormalTable">
<constraintType href="ppe:/environment/org.eclipse.papyrus.infra.nattable.properties/model/Environment.xmi#//@constraintTypes.0"/>
@@ -282,7 +282,7 @@
<widget href="ui/EObjectInTableRowObjectLabelProviderConfiguration.xwt#/"/>
</sections>
</tabs>
- <tabs xmi:id="_bYfDFpLDEeWbp4A9_-WIrQ" label="Paste" id="Paste In Table" category="org.eclipse.papyrus" afterTab="_bYfDCJLDEeWbp4A9_-WIrQ" priority="13">
+ <tabs xmi:id="_bYfDFpLDEeWbp4A9_-WIrQ" label="Paste" id="Paste In Table" category="org.eclipse.papyrus" afterTab="_bYfDCJLDEeWbp4A9_-WIrQ" priority="14">
<sections xmi:id="_bYfDF5LDEeWbp4A9_-WIrQ" name="CanPasteEObjectColumnSection" sectionFile="ui/CanPasteEObjectColumnSection.xwt">
<constraints xsi:type="constraints:SimpleConstraint" xmi:id="_bYfDGJLDEeWbp4A9_-WIrQ" name="canPasteColumnEObjectConstraint">
<constraintType href="ppe:/environment/org.eclipse.papyrus.infra.properties.ui/model/Environment.xmi#//@constraintTypes.4"/>
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/src/org/eclipse/papyrus/infra/nattable/properties/modelelement/NatTableModelElement.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/src/org/eclipse/papyrus/infra/nattable/properties/modelelement/NatTableModelElement.java
index e759b7a95ae..ee6662205aa 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/src/org/eclipse/papyrus/infra/nattable/properties/modelelement/NatTableModelElement.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/src/org/eclipse/papyrus/infra/nattable/properties/modelelement/NatTableModelElement.java
@@ -250,7 +250,7 @@ public class NatTableModelElement extends EMFModelElement {
*/
private void removeListeners() {
// COLUMNS MANAGEMENT
- // we add a listener on the columnHeaderAxisConfiguration
+ // we remove the listener on the columnHeaderAxisConfiguration
if (columnHeaderAxisConfiguration != null) {
columnHeaderAxisConfiguration.eAdapters().remove(tableListener);
}
@@ -258,20 +258,20 @@ public class NatTableModelElement extends EMFModelElement {
if (this.columnLabelProviderConfigurations != null) {
- // we add listener on all column label configurations
+ // we remove the listener on all column label configurations
for (final ILabelProviderConfiguration conf : columnLabelProviderConfigurations) {
conf.eAdapters().remove(tableListener);
}
}
// ROW MANAGEMENT
- // we add a listener on the rowHeaderAxisConfiguration
+ // we remove the listener on the rowHeaderAxisConfiguration
if (rowHeaderAxisConfiguration != null) {
rowHeaderAxisConfiguration.eAdapters().remove(tableListener);
}
if (this.rowLabelProviderConfigurations != null) {
- // we add listener on all column label configurations
+ // we remove the listener on all row label configurations
for (final ILabelProviderConfiguration conf : rowLabelProviderConfigurations) {
conf.eAdapters().remove(tableListener);
}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/src/org/eclipse/papyrus/infra/nattable/properties/observable/AbstractConfigurationElementObservableValue.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/src/org/eclipse/papyrus/infra/nattable/properties/observable/AbstractConfigurationElementObservableValue.java
index 81b821e066d..441dadc6141 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/src/org/eclipse/papyrus/infra/nattable/properties/observable/AbstractConfigurationElementObservableValue.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/src/org/eclipse/papyrus/infra/nattable/properties/observable/AbstractConfigurationElementObservableValue.java
@@ -24,7 +24,7 @@ import org.eclipse.swt.widgets.Listener;
/**
* Abstract Observable Value to update axis configuration
*
- * @author vl222926
+ * @since 2.2
*
*/
public abstract class AbstractConfigurationElementObservableValue extends AbstractObservableValue implements Listener {
@@ -42,7 +42,7 @@ public abstract class AbstractConfigurationElementObservableValue extends Abstra
/**
* the last value of the managed feature
*/
- private Object oldValue;
+ protected Object oldValue;
/**
*
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/contentprovider/MatrixDirectionContentProvider.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/contentprovider/MatrixDirectionContentProvider.java
new file mode 100755
index 00000000000..bfc65745969
--- /dev/null
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/contentprovider/MatrixDirectionContentProvider.java
@@ -0,0 +1,56 @@
+/*****************************************************************************
+ * Copyright (c) 2017 CEA LIST and others.
+ *
+ * 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.infra.nattable.contentprovider;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.emf.ecore.EEnumLiteral;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablecelleditor.NattablecelleditorPackage;
+import org.eclipse.papyrus.infra.widgets.providers.IStaticContentProvider;
+
+/**
+ * This class provides the available relationship direction required to edit relationship in case of matrix table
+ *
+ * @since 3.0
+ *
+ */
+public class MatrixDirectionContentProvider implements IStaticContentProvider {
+
+ /**
+ * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
+ *
+ * @param inputElement
+ * @return
+ */
+ @Override
+ public Object[] getElements(Object inputElement) {
+ return getElements();
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.widgets.providers.IStaticContentProvider#getElements()
+ *
+ * @return
+ */
+ @Override
+ public Object[] getElements() {
+ final List<Object> values = new ArrayList<Object>();
+ for (EEnumLiteral lit : NattablecelleditorPackage.eINSTANCE.getMatrixRelationShipDirection().getELiterals()) {
+ values.add(lit.getInstance());
+ }
+ return values.toArray();
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/contentprovider/MatrixSourcesContentProvider.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/contentprovider/MatrixSourcesContentProvider.java
new file mode 100755
index 00000000000..6cf95d70e8b
--- /dev/null
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/contentprovider/MatrixSourcesContentProvider.java
@@ -0,0 +1,49 @@
+/*****************************************************************************
+ * Copyright (c) 2017 CEA LIST and others.
+ *
+ * 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.infra.nattable.contentprovider;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.papyrus.infra.ui.emf.utils.EcoreModelContentProvider;
+import org.eclipse.papyrus.infra.widgets.providers.IStaticContentProvider;
+
+/**
+ *
+ * This class provides the elements of the model to used them as source for the rows and columns of the matrix
+ *
+ * @since 3.0
+ *
+ */
+public class MatrixSourcesContentProvider extends EcoreModelContentProvider implements IStaticContentProvider {
+
+ /**
+ * Constructor.
+ *
+ * @param root
+ */
+ public MatrixSourcesContentProvider(EObject root) {
+ super(root);
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.widgets.providers.IStaticContentProvider#getElements()
+ *
+ * @return
+ */
+ @Override
+ public Object[] getElements() {
+ return getElements(null);
+ }
+
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/layerstack/ColumnHeaderLayerStack.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/layerstack/ColumnHeaderLayerStack.java
index 84ac4e5de32..dad48147c3e 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/layerstack/ColumnHeaderLayerStack.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/layerstack/ColumnHeaderLayerStack.java
@@ -29,7 +29,6 @@ import org.eclipse.papyrus.infra.nattable.dataprovider.BodyDataProvider;
import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
import org.eclipse.papyrus.infra.nattable.sort.IPapyrusSortModel;
import org.eclipse.papyrus.infra.nattable.sort.PapyrusCompositeGlazedListSortModel;
-import org.eclipse.papyrus.infra.nattable.sort.PapyrusGlazedListsSortModel;
import org.eclipse.papyrus.infra.nattable.utils.DefaultSizeUtils;
/**
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/axis/CompositeAxisManager.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/axis/CompositeAxisManager.java
index a5e9842f24a..0919d528366 100755
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/axis/CompositeAxisManager.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/axis/CompositeAxisManager.java
@@ -80,7 +80,7 @@ public class CompositeAxisManager extends AbstractAxisManager implements ICompos
*/
@Override
protected void axisManagerHasChanged(final Notification notification) {
- if (notification.isTouch()) {
+ if (notification.isTouch() || NattableaxisproviderPackage.eINSTANCE.getAxisProvider_Axis()!=notification.getFeature()) {
return;
}
final List<Object> newListValue = new ArrayList<Object>(this.managedObject);
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/cell/CellManagerFactory.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/cell/CellManagerFactory.java
index 638feaa400f..c35b9bc4948 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/cell/CellManagerFactory.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/cell/CellManagerFactory.java
@@ -13,11 +13,13 @@
*****************************************************************************/
package org.eclipse.papyrus.infra.nattable.manager.cell;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
+import java.util.List;
import java.util.Map;
import java.util.TreeMap;
@@ -58,6 +60,11 @@ public final class CellManagerFactory {
private final Map<Integer, Collection<ICellManager>> managersMap;
/**
+ * The list of registered axis manager
+ */
+ private final List<IGenericMatrixRelationshipCellManager> matrixManagers;
+
+ /**
* The cell manager factory
*/
public static final CellManagerFactory INSTANCE = new CellManagerFactory();
@@ -69,6 +76,7 @@ public final class CellManagerFactory {
*/
private CellManagerFactory() {
this.managersMap = new TreeMap<Integer, Collection<ICellManager>>();
+ this.matrixManagers = new ArrayList<IGenericMatrixRelationshipCellManager>();
final IConfigurationElement[] configElements = Platform.getExtensionRegistry().getConfigurationElementsFor(EXTENSION_ID);
for (final IConfigurationElement iConfigurationElement : configElements) {
@@ -81,6 +89,9 @@ public final class CellManagerFactory {
if (!this.managersMap.containsKey(order)) {
this.managersMap.put(order, new HashSet<ICellManager>());
}
+ if (solver instanceof IGenericMatrixRelationshipCellManager) {
+ this.matrixManagers.add((IGenericMatrixRelationshipCellManager) solver);
+ }
this.managersMap.get(order).add(new StringResolutionProblemWrapperCellManager(solver));
} catch (final CoreException e) {
Activator.log.error(e);
@@ -385,4 +396,13 @@ public final class CellManagerFactory {
}
return null;
}
+
+ /**
+ * @return
+ * the list of known {@link IGenericMatrixRelationshipCellManager}. Warning, this method ignores the order defined by the user
+ * @since 3.0
+ */
+ public List<IGenericMatrixRelationshipCellManager> getRegisteredGenericMatrixRelationshipCellManager() {
+ return matrixManagers;
+ }
}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/cell/IGenericMatrixRelationshipCellManager.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/cell/IGenericMatrixRelationshipCellManager.java
new file mode 100755
index 00000000000..394dc80d6ca
--- /dev/null
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/cell/IGenericMatrixRelationshipCellManager.java
@@ -0,0 +1,32 @@
+/*****************************************************************************
+ * Copyright (c) 2017 CEA LIST and others.
+ *
+ * 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.infra.nattable.manager.cell;
+
+import org.eclipse.emf.ecore.EClass;
+
+/**
+ * Common interface for matrix cell manager
+ *
+ * @since 3.0
+ *
+ */
+public interface IGenericMatrixRelationshipCellManager extends ICellManager /* , IUnsetValueCellManager */ { // unset have no sense for relationship
+
+ /**
+ *
+ * @return
+ * the EClass representing the managed relationship
+ */
+ public EClass getManagedRelationship();
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/IMatrixTableWidgetManager.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/IMatrixTableWidgetManager.java
new file mode 100755
index 00000000000..e4f45b661cb
--- /dev/null
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/IMatrixTableWidgetManager.java
@@ -0,0 +1,23 @@
+/*****************************************************************************
+ * Copyright (c) 2017 CEA LIST and others.
+ *
+ * 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.infra.nattable.manager.table;
+
+/**
+ * This interface is here to manage the code specific for Matrix
+ *
+ * @since 3.0
+ */
+public interface IMatrixTableWidgetManager extends INattableModelManager {
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/ITreeNattableModelManager.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/ITreeNattableModelManager.java
index 098656b446b..91c03ed55f5 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/ITreeNattableModelManager.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/ITreeNattableModelManager.java
@@ -7,7 +7,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * CEA LIST - Initial API and implementation
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
*
*****************************************************************************/
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/MatrixTableWidgetModelManager.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/MatrixTableWidgetModelManager.java
new file mode 100755
index 00000000000..0bf56c01928
--- /dev/null
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/MatrixTableWidgetModelManager.java
@@ -0,0 +1,183 @@
+/*****************************************************************************
+ * Copyright (c) 2017 CEA LIST and others.
+ *
+ * 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.infra.nattable.manager.table;
+
+import java.util.Collection;
+
+import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
+import org.eclipse.papyrus.infra.nattable.selection.ISelectionExtractor;
+
+/**
+ * The manager to use for Matrix
+ *
+ * @since 3.0
+ *
+ */
+public class MatrixTableWidgetModelManager extends TreeNattableModelManager implements IMatrixTableWidgetManager {
+
+ /**
+ * Constructor.
+ *
+ * @param rawModel
+ * @param selectionExtractor
+ * @param initializeListeners
+ */
+ public MatrixTableWidgetModelManager(Table rawModel, ISelectionExtractor selectionExtractor, boolean initializeListeners) {
+ super(rawModel, selectionExtractor, initializeListeners);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param rawModel
+ * @param selectionExtractor
+ */
+ public MatrixTableWidgetModelManager(Table rawModel, ISelectionExtractor selectionExtractor) {
+ super(rawModel, selectionExtractor);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param rawModel
+ */
+ public MatrixTableWidgetModelManager(Table rawModel) {
+ super(rawModel);
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.nattable.manager.table.NattableModelManager#canDropRowElement(java.util.Collection)
+ *
+ * @param objectsToAdd
+ * @return
+ */
+ @Override
+ public boolean canDropRowElement(Collection<Object> objectsToAdd) {
+ return false;
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.nattable.manager.table.NattableModelManager#canDropColumnsElement(java.util.Collection)
+ *
+ * @param objectsToAdd
+ * @return
+ */
+ @Override
+ public boolean canDropColumnsElement(Collection<Object> objectsToAdd) {
+ return false;
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.nattable.manager.table.NattableModelManager#canInvertAxis()
+ *
+ * @return
+ */
+ @Override
+ public boolean canInvertAxis() {
+ return false;
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.nattable.manager.table.NattableModelManager#canCreateColumnElement(java.lang.String)
+ *
+ * @param elementType
+ * @return
+ */
+ @Override
+ public boolean canCreateColumnElement(String elementType) {
+ return false;
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.nattable.manager.table.NattableModelManager#canCreateDestroyRowsAxis()
+ *
+ * @return
+ */
+ @Override
+ public boolean canCreateDestroyRowsAxis() {
+ return false;
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.nattable.manager.table.NattableModelManager#canMoveColumns()
+ *
+ * @return
+ */
+ @Override
+ public boolean canMoveColumns() {
+ return false;
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.manager.table.NattableModelManager#canInsertRow(java.util.Collection, int)
+ *
+ * @param objectsToAdd
+ * @param index
+ * @return
+ */
+ @Override
+ public boolean canInsertRow(Collection<Object> objectsToAdd, int index) {
+ return false;
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.manager.table.NattableModelManager#canInsertColumns(java.util.Collection, int)
+ *
+ * @param objectsToAdd
+ * @param index
+ * @return
+ */
+ @Override
+ public boolean canInsertColumns(Collection<Object> objectsToAdd, int index) {
+ return false;
+ }
+
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.manager.table.NattableModelManager#canMoveRows()
+ *
+ * @return
+ */
+ @Override
+ public boolean canMoveRows() {
+ return false;
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.manager.table.NattableModelManager#canCreateRowElement(java.lang.String)
+ *
+ * @param elementType
+ * @return
+ */
+ @Override
+ public boolean canCreateRowElement(String elementType) {
+ return false;
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.manager.table.NattableModelManager#canCreateDestroyColumnsAxis()
+ *
+ * @return
+ */
+ @Override
+ public boolean canCreateDestroyColumnsAxis() {
+ return false;
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/TreeNattableModelManager.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/TreeNattableModelManager.java
index 5f6a26dce13..ef8e9290ce2 100644..100755
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/TreeNattableModelManager.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/TreeNattableModelManager.java
@@ -564,24 +564,37 @@ public class TreeNattableModelManager extends NattableModelManager implements IT
if (columnAxisManager) {
return super.createAxisManager(representations, contentProvider, columnAxisManager);
} else {
- CompositeTreeAxisManagerForEventList compositeAxisManager = new CompositeTreeAxisManagerForEventList(horizontalFilterList);
- final List<IAxisManagerForEventList> managers = new ArrayList<IAxisManagerForEventList>();
- for (AxisManagerRepresentation current : representations) {
- final IAxisManager manager = AxisManagerFactory.INSTANCE.getAxisManager(current);
- Assert.isTrue(manager instanceof IAxisManagerForEventList);
- manager.init(this, current, contentProvider);
- managers.add((IAxisManagerForEventList) manager);
-
- }
- compositeAxisManager.init(this, null, contentProvider);
- DatumTreeFormat treeFormat = getTreeFormat();
- treeFormat.setTreeComparatorProvider(compositeAxisManager);
- this.expansionModel.setAxisManager(compositeAxisManager);
- ((CompositeAxisManagerForEventList) compositeAxisManager).setSubManagers(managers);
- return compositeAxisManager;
+ return createTreeAxisManager(representations, contentProvider, columnAxisManager);
}
}
+
+ /**
+ *
+ * @param representations
+ * @param contentProvider
+ * @param columnAxisManager
+ * @return
+ * the Composite axis manager used to manage Tree
+ * @since 3.0
+ */
+ protected ICompositeAxisManager createTreeAxisManager(List<AxisManagerRepresentation> representations, AbstractAxisProvider contentProvider, boolean columnAxisManager) {
+ CompositeTreeAxisManagerForEventList compositeAxisManager = new CompositeTreeAxisManagerForEventList(horizontalFilterList);
+ final List<IAxisManagerForEventList> managers = new ArrayList<IAxisManagerForEventList>();
+ for (AxisManagerRepresentation current : representations) {
+ final IAxisManager manager = AxisManagerFactory.INSTANCE.getAxisManager(current);
+ Assert.isTrue(manager instanceof IAxisManagerForEventList);
+ manager.init(this, current, contentProvider);
+ managers.add((IAxisManagerForEventList) manager);
+
+ }
+ compositeAxisManager.init(this, null, contentProvider);
+ DatumTreeFormat treeFormat = getTreeFormat();
+ treeFormat.setTreeComparatorProvider(compositeAxisManager);
+ this.expansionModel.setAxisManager(compositeAxisManager);
+ ((CompositeAxisManagerForEventList) compositeAxisManager).setSubManagers(managers);
+ return compositeAxisManager;
+ }
/**
* @see org.eclipse.papyrus.infra.nattable.manager.table.ITreeNattableModelManager#getTreeFormat()
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/messages/Messages.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/messages/Messages.java
index 4094c995644..a7c441a628e 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/messages/Messages.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/messages/Messages.java
@@ -490,6 +490,12 @@ public class Messages extends NLS {
*/
public static String ExportTableDialog_OverrideConfirmMessasgeDialogText;
+ public static String MatrixRelationshipDirectionLabelProvider_None;
+
+ public static String MatrixRelationshipDirectionLabelProvider_RowToColumn;
+
+ public static String MatrixRelationshipDirectionLabelProvider_ColumnToRow;
+
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/messages/messages.properties b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/messages/messages.properties
index 257bb34c177..fbf2c43eae7 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/messages/messages.properties
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/messages/messages.properties
@@ -213,4 +213,7 @@ ExportTableDialog_SelectOutputFormatLabel=Select the output format
ExportTableDialog_ContainerSelectionDialogTitle=Please select the output directory
ExportTableDialog_SelectTreeActionLabel=Select the action for tree table
ExportTableDialog_OverrideConfirmMessasgeDialogMessage=The destination directory already contains the file "{0}". Do you really want to override it?
-ExportTableDialog_OverrideConfirmMessasgeDialogText=Override confirmation \ No newline at end of file
+ExportTableDialog_OverrideConfirmMessasgeDialogText=Override confirmation
+MatrixRelationshipDirectionLabelProvider_None=None
+MatrixRelationshipDirectionLabelProvider_RowToColumn=From Row To Column
+MatrixRelationshipDirectionLabelProvider_ColumnToRow=From Column To Row
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/provider/MANIFEST.MF b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/provider/MANIFEST.MF
new file mode 100644
index 00000000000..e1781eafb36
--- /dev/null
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/provider/MANIFEST.MF
@@ -0,0 +1,39 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %Bundle-Name
+Bundle-SymbolicName: org.eclipse.papyrus.customization.nattableconfiguration;singleton:=true
+Bundle-Version: 2.0.0.qualifier
+Bundle-Activator: org.eclipse.papyrus.customization.nattableconfiguration.Activator
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.emf.transaction;bundle-version="1.9.0",
+ org.eclipse.ui.forms,
+ org.eclipse.jface,
+ org.eclipse.swt,
+ org.eclipse.emf.common.ui,
+ org.eclipse.emf.edit.ui,
+ org.eclipse.ui.ide,
+ org.eclipse.pde.ui,
+ org.eclipse.nebula.widgets.nattable.core;bundle-version="1.4.0",
+ org.eclipse.gmf.runtime.emf.type.core,
+ org.eclipse.papyrus.infra.core;bundle-version="[3.0.0,4.0.0)",
+ org.eclipse.papyrus.infra.emf;bundle-version="[3.0.0,4.0.0)",
+ org.eclipse.papyrus.infra.nattable;bundle-version="[3.0.0,4.0.0)",
+ org.eclipse.papyrus.infra.nattable.model;bundle-version="[3.0.0,4.0.0)",
+ org.eclipse.papyrus.infra.nattable.model.edit;bundle-version="[3.0.0,4.0.0)",
+ org.eclipse.papyrus.infra.services.edit;bundle-version="[3.0.0,4.0.0)",
+ org.eclipse.papyrus.infra.ui;bundle-version="[2.0.0,3.0.0)",
+ org.eclipse.papyrus.infra.ui.emf;bundle-version="[2.0.0,3.0.0)",
+ org.eclipse.papyrus.infra.widgets;bundle-version="[3.0.0,4.0.0)"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Bundle-ActivationPolicy: lazy
+Export-Package: org.eclipse.papyrus.customization.nattableconfiguration,
+ org.eclipse.papyrus.customization.nattableconfiguration.edition,
+ org.eclipse.papyrus.customization.nattableconfiguration.handlers,
+ org.eclipse.papyrus.customization.nattableconfiguration.helper,
+ org.eclipse.papyrus.customization.nattableconfiguration.messages,
+ org.eclipse.papyrus.customization.nattableconfiguration.pages,
+ org.eclipse.papyrus.customization.nattableconfiguration.utils
+Bundle-Vendor: %Bundle-Vendor
+Bundle-Description: %Bundle-Description
+Bundle-Localization: plugin
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/provider/MatrixRelationshipDirectionLabelProvider.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/provider/MatrixRelationshipDirectionLabelProvider.java
new file mode 100755
index 00000000000..e90f124e62c
--- /dev/null
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/provider/MatrixRelationshipDirectionLabelProvider.java
@@ -0,0 +1,113 @@
+/*****************************************************************************
+ * Copyright (c) 2017 CEA LIST and others.
+ *
+ * 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.infra.nattable.provider;
+
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.papyrus.infra.nattable.messages.Messages;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablecelleditor.MatrixRelationShipDirection;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * The label provider to use for the enumeration used to define the relationship direction
+ *
+ * @since 3.0
+ *
+ */
+public class MatrixRelationshipDirectionLabelProvider implements ILabelProvider {
+
+ /**
+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#addListener(org.eclipse.jface.viewers.ILabelProviderListener)
+ *
+ * @param listener
+ */
+ @Override
+ public void addListener(ILabelProviderListener listener) {
+
+ }
+
+ /**
+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose()
+ *
+ */
+ @Override
+ public void dispose() {
+
+ }
+
+ /**
+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(java.lang.Object, java.lang.String)
+ *
+ * @param element
+ * @param property
+ * @return
+ */
+ @Override
+ public boolean isLabelProperty(Object element, String property) {
+ return false;
+ }
+
+ /**
+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#removeListener(org.eclipse.jface.viewers.ILabelProviderListener)
+ *
+ * @param listener
+ */
+ @Override
+ public void removeListener(ILabelProviderListener listener) {
+
+ }
+
+ /**
+ * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object)
+ *
+ * @param element
+ * @return
+ */
+ @Override
+ public Image getImage(Object element) {
+ return null;
+ }
+
+ /**
+ * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
+ *
+ * @param direction
+ * @return
+ */
+ @Override
+ public String getText(Object direction) {
+ MatrixRelationShipDirection instance = null;
+ if (direction instanceof MatrixRelationShipDirection) {
+ instance = (MatrixRelationShipDirection) direction;
+ }
+ String label = ""; //$NON-NLS-1$
+ if (null != instance) {
+ switch (instance.getValue()) {
+ case MatrixRelationShipDirection.NONE_VALUE:
+ label = Messages.MatrixRelationshipDirectionLabelProvider_None;
+ break;
+ case MatrixRelationShipDirection.FROM_ROW_TO_COLUMN_VALUE:
+ label = Messages.MatrixRelationshipDirectionLabelProvider_RowToColumn;
+ break;
+ case MatrixRelationShipDirection.FROM_COLUMN_TO_ROW_VALUE:
+ label = Messages.MatrixRelationshipDirectionLabelProvider_ColumnToRow;
+ break;
+ default:
+ // nothing to do
+ }
+ }
+ return label;
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/HeaderAxisConfigurationManagementUtils.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/HeaderAxisConfigurationManagementUtils.java
index 7b04732a7a9..7b47f84626b 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/HeaderAxisConfigurationManagementUtils.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/HeaderAxisConfigurationManagementUtils.java
@@ -17,9 +17,13 @@ import org.eclipse.core.runtime.Assert;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AbstractHeaderAxisConfiguration;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AxisManagerConfiguration;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AxisManagerRepresentation;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.IAxisConfiguration;
import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.LocalTableHeaderAxisConfiguration;
import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.NattableaxisconfigurationFactory;
import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.TableHeaderAxisConfiguration;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.ILabelProviderConfiguration;
import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.Style;
/**
@@ -39,7 +43,7 @@ public class HeaderAxisConfigurationManagementUtils {
* @param table
* a table
* @return
- * the header configuration defined in the table and used for rows, mananing the inversion of the axis or <code>null</code> if we aer
+ * the header configuration defined in the table and used for rows, managing the inversion of the axis or <code>null</code> if we aer
* using the
* configuration defined in the table configuration
*/
@@ -56,7 +60,7 @@ public class HeaderAxisConfigurationManagementUtils {
* @param table
* a table
* @return
- * the header configuration defined in the tableconfiguration for rows, mananing the inversion of the axis. The result can't be <code>null</code>
+ * the header configuration defined in the tableconfiguration for rows, managing the inversion of the axis. The result can't be <code>null</code>
*/
public static final AbstractHeaderAxisConfiguration getRowAbstractHeaderAxisInTableConfiguration(final Table table) {
AbstractHeaderAxisConfiguration config = table.getTableConfiguration().getRowHeaderAxisConfiguration();
@@ -72,7 +76,7 @@ public class HeaderAxisConfigurationManagementUtils {
* @param table
* the table
* @return
- * the header configuration used for rows in the table. The result can't be <code>null</code>
+ * the header configuration used for rows in the table. The result can't be <code>null</code>
*/
public static final AbstractHeaderAxisConfiguration getRowAbstractHeaderAxisConfigurationUsedInTable(final Table table) {
AbstractHeaderAxisConfiguration config = getRowAbstractHeaderAxisInTable(table);
@@ -88,7 +92,7 @@ public class HeaderAxisConfigurationManagementUtils {
* @param table
* a table
* @return
- * the header configuration defined in the table and used for columns, managing the inversion of the axis or <code>null</code> if we are
+ * the header configuration defined in the table and used for columns, managing the inversion of the axis or <code>null</code> if we are
* using the configuration defined in the table configuration
*/
public static final AbstractHeaderAxisConfiguration getColumnAbstractHeaderAxisInTable(final Table table) {
@@ -104,7 +108,7 @@ public class HeaderAxisConfigurationManagementUtils {
* @param table
* a table
* @return
- * the header configuration defined in the tableconfiguration for columns, mananing the inversion of the axis. The result can't be <code>null</code>
+ * the header configuration defined in the tableconfiguration for columns, mananing the inversion of the axis. The result can't be <code>null</code>
*/
public static final AbstractHeaderAxisConfiguration getColumnAbstractHeaderAxisInTableConfiguration(final Table table) {
AbstractHeaderAxisConfiguration config = table.getTableConfiguration().getColumnHeaderAxisConfiguration();
@@ -120,7 +124,7 @@ public class HeaderAxisConfigurationManagementUtils {
* @param table
* the table
* @return
- * the header configuration used for columns in the table. The result can't be <code>null</code>
+ * the header configuration used for columns in the table. The result can't be <code>null</code>
*/
public static final AbstractHeaderAxisConfiguration getColumnAbstractHeaderAxisConfigurationUsedInTable(final Table table) {
AbstractHeaderAxisConfiguration config = getColumnAbstractHeaderAxisInTable(table);
@@ -136,7 +140,7 @@ public class HeaderAxisConfigurationManagementUtils {
* @param table
* the table
* @return
- * the header configuration used for row in the table. The result can't be <code>null</code>
+ * the header configuration used for row in the table. The result can't be <code>null</code>
*/
public static final AbstractHeaderAxisConfiguration getRowAbstractHeaderAxisUsedInTable(final Table table) {
AbstractHeaderAxisConfiguration config = getRowAbstractHeaderAxisInTable(table);
@@ -152,7 +156,7 @@ public class HeaderAxisConfigurationManagementUtils {
* @param configuration
* the configuration to duplicate
* @return
- * the {@link LocalTableHeaderAxisConfiguration} mapped on the {@link TableHeaderAxisConfiguration}
+ * the {@link LocalTableHeaderAxisConfiguration} mapped on the {@link TableHeaderAxisConfiguration}
*/
public static LocalTableHeaderAxisConfiguration transformToLocalHeaderConfiguration(final TableHeaderAxisConfiguration configuration) {
LocalTableHeaderAxisConfiguration conf = NattableaxisconfigurationFactory.eINSTANCE.createLocalTableHeaderAxisConfiguration();
@@ -167,4 +171,36 @@ public class HeaderAxisConfigurationManagementUtils {
return conf;
}
+ /**
+ *
+ * @param configuration
+ * the configuration to duplicate, with all its configuration
+ * @return
+ * the {@link LocalTableHeaderAxisConfiguration} mapped on the {@link TableHeaderAxisConfiguration}
+ * @since 3.0
+ */
+ public static LocalTableHeaderAxisConfiguration transformToLocalHeaderConfigurationIncludingAllConfigurations(final TableHeaderAxisConfiguration configuration) {
+ final LocalTableHeaderAxisConfiguration conf = transformToLocalHeaderConfiguration(configuration);
+ for (final AxisManagerRepresentation axisManagers : configuration.getAxisManagers()) {
+ final AxisManagerConfiguration currentConfiguration = NattableaxisconfigurationFactory.eINSTANCE.createAxisManagerConfiguration();
+ currentConfiguration.setAxisManager(axisManagers);
+ for (final Style current : axisManagers.getStyles()) {
+ Style copy = EcoreUtil.copy(current);
+ axisManagers.getStyles().add(copy);
+ }
+
+ for (final IAxisConfiguration axisConf : axisManagers.getSpecificAxisConfigurations()) {
+ final IAxisConfiguration tmp = EcoreUtil.copy(axisConf);
+ conf.getOwnedAxisConfigurations().add(tmp);
+ currentConfiguration.getLocalSpecificConfigurations().add(tmp);
+ }
+ final ILabelProviderConfiguration labelProviderConfiguration = EcoreUtil.copy(axisManagers.getHeaderLabelConfiguration());
+ currentConfiguration.setLocalHeaderLabelConfiguration(labelProviderConfiguration);
+ conf.getOwnedLabelConfigurations().add(labelProviderConfiguration);
+ conf.getAxisManagerConfigurations().add(currentConfiguration);
+
+ }
+ return conf;
+ }
+
}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/NattableModelManagerFactory.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/NattableModelManagerFactory.java
index 2c30cef5f39..efaa6ceb0f4 100755
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/NattableModelManagerFactory.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/NattableModelManagerFactory.java
@@ -15,6 +15,7 @@
package org.eclipse.papyrus.infra.nattable.utils;
import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
+import org.eclipse.papyrus.infra.nattable.manager.table.MatrixTableWidgetModelManager;
import org.eclipse.papyrus.infra.nattable.manager.table.NattableModelManager;
import org.eclipse.papyrus.infra.nattable.manager.table.TreeNattableModelManager;
import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
@@ -58,6 +59,9 @@ public class NattableModelManagerFactory {
* @since 3.0
*/
public INattableModelManager createNatTableModelManager(final Table table, final ISelectionExtractor selectionExtractor, final boolean initializeListeners) {
+ if(TableHelper.isMatrixTreeTable(table)) {
+ return new MatrixTableWidgetModelManager(table, selectionExtractor, initializeListeners);
+ }
if (TableHelper.isTreeTable(table)) {
return new TreeNattableModelManager(table,selectionExtractor, initializeListeners);
}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/TableHelper.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/TableHelper.java
index 51074485947..6cab18cdc17 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/TableHelper.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/TableHelper.java
@@ -25,6 +25,9 @@ import org.eclipse.papyrus.infra.nattable.model.nattable.NattablePackage;
import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.ITreeItemAxis;
import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.AbstractAxisProvider;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.IMasterAxisProvider;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablecelleditor.GenericRelationshipMatrixCellEditorConfiguration;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablecelleditor.NattablecelleditorFactory;
import org.eclipse.papyrus.infra.nattable.model.nattable.nattableconfiguration.CellEditorDeclaration;
import org.eclipse.papyrus.infra.nattable.model.nattable.nattableconfiguration.TableConfiguration;
import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.DisplayStyle;
@@ -122,6 +125,20 @@ public class TableHelper {
IntListValueStyle copy = EcoreUtil.copy(style);
table.getStyles().add(copy);
}
+
+
+ if(isMatrixTreeTable(table)) {
+ if(null!=configuration.getOwnedCellEditorConfigurations()) {
+ table.setOwnedCellEditorConfigurations(EcoreUtil.copy(configuration.getOwnedCellEditorConfigurations()));
+ }else {
+ //we can do it because currently, we only have one possible type for that!
+ GenericRelationshipMatrixCellEditorConfiguration conf = NattablecelleditorFactory.eINSTANCE.createGenericRelationshipMatrixCellEditorConfiguration();
+ conf.setCellEditorId("GenericRelationshipMatrixEditorConfiguration"); //$NON-NLS-1$
+ table.setOwnedCellEditorConfigurations(conf);
+ }
+ Assert.isNotNull(table.getOwnedCellEditorConfigurations(), "A matrix must own a CellEditorConfiguration"); //$NON-NLS-1$
+ }
+
return table;
}
@@ -349,5 +366,20 @@ public class TableHelper {
parent = parent.getParent();
}
}
+
+ /**
+ *
+ * @param table
+ * a table
+ * @return
+ * <code>true</code> if the table is a matrix. That is to say
+ * @since 3.0
+ */
+ public static final boolean isMatrixTreeTable(final Table table) {
+ final AbstractAxisProvider rowsAxisProvider = table.getCurrentRowAxisProvider();
+ final AbstractAxisProvider columnsAxisProvider = table.getCurrentColumnAxisProvider();
+ return isTreeTable(table) && rowsAxisProvider instanceof IMasterAxisProvider && columnsAxisProvider instanceof IMasterAxisProvider;
+
+ }
}

Back to the top