Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Lorenzo2020-04-03 15:04:56 +0000
committerPatrick Tessier2020-04-09 08:07:34 +0000
commitae79e9815491fc1d50563000ef8457435e92c771 (patch)
tree162b9b930e2311930bccf8b0a40c9dc771eb0b95 /plugins
parent373385222ee40e92d1ec436fcd36913b42079dfd (diff)
downloadorg.eclipse.papyrus-ae79e9815491fc1d50563000ef8457435e92c771.tar.gz
org.eclipse.papyrus-ae79e9815491fc1d50563000ef8457435e92c771.tar.xz
org.eclipse.papyrus-ae79e9815491fc1d50563000ef8457435e92c771.zip
Bug 561409: [Table] The Papyrus row axis manager used by tree table must support empty rows.
Change-Id: I2a935e03b13e0108e608b2aba9bf1a4778520b44 Signed-off-by: Vincent Lorenzo <vincent.lorenzo@cea.fr>
Diffstat (limited to 'plugins')
-rw-r--r--plugins/doc/org.eclipse.papyrus.infra.nattable.doc/src/site/mediawiki/tableDevDoc.mediawiki82
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/META-INF/MANIFEST.MF2
-rwxr-xr-xplugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/pom.xml2
-rwxr-xr-xplugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/provider/AbstractEmptyLineRowHeaderLabelProvider.java113
-rwxr-xr-xplugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/cell/AbstractEmptyAxisCellManager.java148
-rwxr-xr-xplugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/mouse/action/EmptyLineRowHeaderEventMatch.java61
-rw-r--r--plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display/src/org/eclipse/papyrus/uml/nattable/stereotype/display/Activator.java22
-rw-r--r--plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display/src/org/eclipse/papyrus/uml/nattable/stereotype/display/manager/axis/NotationTreeTableAxisManager.java23
-rw-r--r--plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display/src/org/eclipse/papyrus/uml/nattable/stereotype/display/manager/axis/StereotypeDisplayPropertiesAxisManager.java14
-rwxr-xr-xplugins/uml/nattable/org.eclipse.papyrus.uml.nattable/plugin.xml4
-rwxr-xr-xplugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/manager/axis/EmptyLineUMLElementTreeAxisManagerForEventList.java99
11 files changed, 558 insertions, 12 deletions
diff --git a/plugins/doc/org.eclipse.papyrus.infra.nattable.doc/src/site/mediawiki/tableDevDoc.mediawiki b/plugins/doc/org.eclipse.papyrus.infra.nattable.doc/src/site/mediawiki/tableDevDoc.mediawiki
index 3e477a8165c..c0d6fee6bd8 100644
--- a/plugins/doc/org.eclipse.papyrus.infra.nattable.doc/src/site/mediawiki/tableDevDoc.mediawiki
+++ b/plugins/doc/org.eclipse.papyrus.infra.nattable.doc/src/site/mediawiki/tableDevDoc.mediawiki
@@ -2414,10 +2414,86 @@ The classes managing the NatTable widget in the property view are:
These tables have some custom behaviors:
* the tree table is always expand all ath the beginning
-* <pre style="color:red">the table will use percentage sizing for the columns display, excepted if you set a BooleanNamedStyle columnsWidthAsPercentage to false has a child of your TableConfiguration.</pre>
+* <pre style="color:red"> the table will use percentage sizing for the columns display, excepted if you set a BooleanNamedStyle columnsWidthAsPercentage to false has a child of your TableConfiguration.</pre>
* the table are not really persisted, but we keep the user configuration for a given table opened on an object of a given EClass. See
<code>org.eclipse.papyrus.uml.properties.widgets.NattablePropertyEditor.createTableURI(EObject, TableConfiguration)</code> for further information.
* <pre style="color:red"> So during your table development, you need to clear your workspace each time to test your table configuration, or you need to remove your table instance from the location yourRuntimeWorkspace/.metadata.plugins/org.eclipse.papyrus.uml.properties/tables.</pre>
-
-
+=What are the existing axis manager ?=
+*Axis Managers for EMF
+**EObject management (used for rows, flat)
+***''description:'' allows to manage EObject as rows
+***''id:'' '''org.eclipse.papyrus.infra.emf.nattable.user.axis.manager'''
+***''java class:'' <code>org.eclipse.papyrus.infra.emf.nattable.manager.axis.EObjectAxisManager</code>
+**EObject management (used for rows, tree)
+***''description:'' allows to manage EObject as rows in a tree
+***''id:'' '''org.eclipse.papyrus.infra.emf.nattable.tree.axis.manager'''
+***''java class:'' <code>org.eclipse.papyrus.infra.emf.nattable.manager.axis.EObjectTreeAxisManagerForEventList</code>
+**EObject management (used for columns, in Matrix)
+***''description:'' allows to manage EObject as columns
+***''id:'' '''org.eclipse.papyrus.infra.emf.nattable.axis.column.eobject.matrix.manager'''
+***''java class:'' <code>org.eclipse.papyrus.infra.emf.nattable.manager.axis.EObjectColumnMatrixAxisManager</code>
+**EStructuralFeature management (used for columns)
+***''description:'' allows to manage EStructuralFeature as columns
+***''id:'' '''org.eclipse.papyrus.infra.emf.nattable.feature.axis.manager'''
+***''java class:'' <code>org.eclipse.papyrus.infra.emf.nattable.manager.axis.EStructuralFeatureAxisManager</code>
+**EOperation management (used for columns)
+***''description:'' allows to manage EOperation as columns (operations with no parameters and a return value only)
+***''id:'' '''org.eclipse.papyrus.infra.emf.nattable.operation.axis.manager'''
+***''java class:'' <code>org.eclipse.papyrus.infra.emf.nattable.manager.axis.EOperationAxisManager</code>
+*Axis Manager for UML
+**Element management (used for rows, flat)
+***''description:'' allows to manage UML Element as rows
+***''id:'' '''org.eclipse.papyrus.uml.nattable.element.axis.manager'''
+***''java class:'' <code>org.eclipse.papyrus.uml.nattable.manager.axis.UMLElementAxisManager</code>
+**Element management (used for tree rows, tree)
+***''description:'' allows to manage UML Element as rows in a tree
+***''id:'' '''org.eclipse.papyrus.infra.uml.nattable.tree.axis.manager'''
+***''java class:'' <code>org.eclipse.papyrus.uml.nattable.manager.axis.UMLElementTreeAxisManagerForEventList</code>
+**(deprecated) Class managements (used for rows, tree)
+***''description:'' allows to manage UML Classes (with their Properties, Operation (and their Parameters), Nested Classes). Must not be used anymore, used '''org.eclipse.papyrus.infra.uml.nattable.tree.axis.manager''' instead.
+***''id:'' '''org.eclipse.papyrus.infra.uml.nattable.class.tree.axis.manager'''
+***''java class:'' <code>org.eclipse.papyrus.uml.nattable.clazz.config.manager.axis.UMLClassTreeAxisManagerForEventList</code>
+**Element management with empty lines(used for tree rows, tree) - EXPERIMENTAL
+***''description:'' allows to manage UML Element as rows in a tree, with an empty line at each level in addition
+***''id:'' '''org.eclipse.papyrus.uml.nattable.manager.axis.EmptyLineUMLElementTreeAxisManagerForEventList'''
+***''java class:'' <code>org.eclipse.papyrus.uml.nattable.manager.axis.EmptyLineUMLElementTreeAxisManagerForEventList</code>
+**Element properties management (used for columns, flat)
+***''description:'' allows to manage the properties of UML Element as columns
+***''id:'' '''org.eclipse.papyrus.uml.nattable.feature.axis.manager'''
+***''java class:'' <code>org.eclipse.papyrus.uml.nattable.manager.axis.UMLFeatureAxisManager</code>
+**Element operations management (used for columns, flat)
+***''description:'' allows to manage the operations of UML Element as columns (operations with no parameters and a return value only)
+***''id:'' '''org.eclipse.papyrus.uml.nattable.operation.axis.manager'''
+***''java class:'' <code>org.eclipse.papyrus.uml.nattable.manager.axis.UMLOperationAxisManager</code>
+**Stereotypes properties management (used for columns, flat)
+***''description:'' allows to manage the properties of Stereotype as columns
+***''id:'' '''org.eclipse.papyrus.uml.nattable.element.axis.manager'''
+***''java class:'' <code>org.eclipse.papyrus.uml.nattable.manager.axis.UMLStereotypePropertyAxisManager</code>
+**Stereotypes operations management (used for columns, flat)
+***''description:'' allows to manage the operations of Stereotype as columns (operations with no parameters and a return value only)
+***''id:'' '''org.eclipse.papyrus.uml.nattable.stereotype.operation.axis.manager'''
+***''java class:'' <code>org.eclipse.papyrus.uml.nattable.manager.axis.UMLStereotypeOperationAxisManager</code>
+*Axis Manager for Papyrus Editors (Table of Views)
+**Axis Manager to display Papyrus editors (used for row, flat)
+***''description:'' allows to display all diagrams/tables of the model as rows
+***''id:'' '''org.eclipse.papyrus.infra.nattable.pagelist.contents.axis.manager'''
+***''java class:'' <code>org.eclipse.papyrus.infra.nattable.views.config.manager.axis.EditorContextSynchronizerAxisManager</code>
+**Axis Manager for Papyrus editors properties (used for columns)
+***''description:'' allows to display some properties of the editors in columns
+***''id:'' '''org.eclipse.papyrus.infra.nattable.page.view.feature.axis.manager'''
+***''java class:'' <code>org.eclipse.papyrus.infra.nattable.views.config.manager.axis.EditorFeatureAxisManager</code>
+*Axis Manager to manage stereotypes from a selected GMF View (used in Appearance Tab of the properties View, to define how to display stereotype in GMF View)
+**Management of stereotypes applied on the selected views (used for rows, tree)
+***''description:'' allows to display applied stereotypes from a GMF View representing a UML Element (used by a Table embedded in Properties View, to define how applied stereotypes must be displayed in the GMF View)
+***''id:'' '''org.eclipse.papyrus.uml.nattable.stereotype.display.axis.manager'''
+***''java class:'' <code>org.eclipse.papyrus.uml.nattable.stereotype.display.manager.axis.NotationTreeTableAxisManager</code>
+**Axis Manager managing the properties used for display on GMF View
+***''description:'' manage soallows to display some properties of the editors in columns (used by a Table embedded in Properties View, to define how applied stereotypes must be displayed in the GMF View)
+***''id:'' '''org.eclipse.papyrus.uml.nattable.stereotype.display.properties.axis.manager'''
+***''java class:'' <code>org.eclipse.papyrus.uml.nattable.stereotype.display.manager.axis.StereotypeDisplayPropertiesAxisManager</code>
+*Other Axis Manager
+**Axis Manager for actions (used for columns)
+***''description:'' allows to manage one action for all cells of the column (typically we display an icon in the cell, and register an action of single click on a cell of this column). The action is defined as a FeatureId, with this value: ''action:/myActionName''.
+***''id:'' '''org.eclipse.papyrus.infra.nattable.action.axis.manager'''
+***''java class:'' <code>org.eclipse.papyrus.infra.nattable.manager.axis.ActionAxisManager</code>
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 c61a570adae..8f189457077 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
@@ -17,7 +17,7 @@ Require-Bundle: org.eclipse.papyrus.infra.nattable;bundle-version="[6.0.0,7.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: 5.1.0.qualifier
+Bundle-Version: 5.2.0.qualifier
Bundle-Name: Papyrus EMF Nattable
Bundle-Activator: org.eclipse.papyrus.infra.emf.nattable.Activator
Bundle-ManifestVersion: 2
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/pom.xml b/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/pom.xml
index 3138f121f72..f4de16b2f2e 100755
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/pom.xml
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/pom.xml
@@ -9,6 +9,6 @@
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.papyrus.infra.emf.nattable</artifactId>
- <version>5.1.0-SNAPSHOT</version>
+ <version>5.2.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project> \ No newline at end of file
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/provider/AbstractEmptyLineRowHeaderLabelProvider.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/provider/AbstractEmptyLineRowHeaderLabelProvider.java
new file mode 100755
index 00000000000..b814b05b0a3
--- /dev/null
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/provider/AbstractEmptyLineRowHeaderLabelProvider.java
@@ -0,0 +1,113 @@
+/*****************************************************************************
+ * Copyright (c) 2020 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.nattable.provider;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.ITreeItemAxis;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.TreeFillingConfiguration;
+import org.eclipse.papyrus.infra.nattable.utils.LabelProviderCellContextElementWrapper;
+import org.eclipse.papyrus.infra.nattable.utils.NattableConfigAttributes;
+import org.eclipse.papyrus.infra.widgets.Activator;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * Abstract label provider allows to get a label in the row header for empty line
+ *
+ * @since 5.2
+ */
+public abstract class AbstractEmptyLineRowHeaderLabelProvider extends EMFEObjectHeaderLabelProvider {
+
+ /**
+ * the kindId of the table on which this label provider must be activated
+ */
+ private final String kindId;
+
+ /**
+ * the kindId of the table on which this label provider must be activated
+ */
+ public AbstractEmptyLineRowHeaderLabelProvider(final String tableKind) {
+ Assert.isNotNull(tableKind);
+ Assert.isTrue(!tableKind.isEmpty());
+ this.kindId = tableKind;
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.emf.nattable.provider.EMFEObjectHeaderLabelProvider#accept(java.lang.Object)
+ *
+ * @param element
+ * @return
+ */
+ @Override
+ public boolean accept(Object element) {
+ String currentTableKindId = ""; //$NON-NLS-1$
+ if (element instanceof LabelProviderCellContextElementWrapper) {
+ LabelProviderCellContextElementWrapper wrapper = (LabelProviderCellContextElementWrapper) element;
+ INattableModelManager manager = wrapper.getConfigRegistry().getConfigAttribute(NattableConfigAttributes.NATTABLE_MODEL_MANAGER_CONFIG_ATTRIBUTE, org.eclipse.nebula.widgets.nattable.style.DisplayMode.NORMAL,
+ NattableConfigAttributes.NATTABLE_MODEL_MANAGER_ID);
+ currentTableKindId = manager.getTable().getTableKindId();
+
+ element = ((LabelProviderCellContextElementWrapper) element).getObject();
+
+ }
+ return this.kindId.equals(currentTableKindId) && element instanceof ITreeItemAxis && ((ITreeItemAxis) element).getElement() == null;
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.emf.nattable.provider.EMFEObjectHeaderLabelProvider#getText(java.lang.Object)
+ *
+ * @param element
+ * @return
+ */
+ @Override
+ public String getText(Object element) {
+ if (element instanceof LabelProviderCellContextElementWrapper) {
+ element = ((LabelProviderCellContextElementWrapper) element).getObject();
+ }
+ if (element instanceof ITreeItemAxis) {
+ final ITreeItemAxis axis = (ITreeItemAxis) element;
+ ITreeItemAxis parentAxis = axis.getParent();
+ final Object parentElement = parentAxis.getElement();
+ if (parentElement instanceof TreeFillingConfiguration) {
+ final TreeFillingConfiguration conf = (TreeFillingConfiguration) parentElement;
+ return getCreationHeaderMessage(conf);
+ }
+ }
+
+ return "";//$NON-NLS-1$
+ }
+
+ /**
+ *
+ * @param configuration
+ * the tree filling configuration for which we display an empty line
+ * @return
+ * the label to display for the row header cell, can't be <code>null</code>
+ */
+ protected abstract String getCreationHeaderMessage(final TreeFillingConfiguration configuration);
+
+ /**
+ * @see org.eclipse.papyrus.infra.emf.nattable.provider.EMFEObjectHeaderLabelProvider#getImage(java.lang.Object)
+ *
+ * @param element
+ * @return
+ */
+ @Override
+ public Image getImage(Object element) {
+ return Activator.getDefault().getImage("/icons/Add_12x12.gif"); //$NON-NLS-1$
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/cell/AbstractEmptyAxisCellManager.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/cell/AbstractEmptyAxisCellManager.java
new file mode 100755
index 00000000000..c6e3ee1342f
--- /dev/null
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/cell/AbstractEmptyAxisCellManager.java
@@ -0,0 +1,148 @@
+/*****************************************************************************
+ * Copyright (c) 2020 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.manager.cell;
+
+import java.util.Map;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
+import org.eclipse.papyrus.infra.nattable.utils.AxisUtils;
+
+/**
+ * Abstract class to get values (<code>null</code> with this implementation), on specific table which use the empty line feature.
+ *
+ * @since 6.7
+ */
+public abstract class AbstractEmptyAxisCellManager extends AbstractCellManager {
+
+ /**
+ * the kindId of the table I manage
+ */
+ private final String tableKindId;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param tableKindId
+ * the kindId of the table I manage
+ *
+ */
+ public AbstractEmptyAxisCellManager(final String tableKindId) {
+ this.tableKindId = tableKindId;
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.nattable.manager.cell.ICellManager#handles(java.lang.Object, java.lang.Object, org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager)
+ *
+ * @param columnElement
+ * @param rowElement
+ * @param tableManager
+ * @return
+ */
+ @Override
+ public boolean handles(final Object columnElement, final Object rowElement, final INattableModelManager tableManager) {
+ final Object column = AxisUtils.getRepresentedElement(columnElement);
+ final Object row = AxisUtils.getRepresentedElement(rowElement);
+ return this.tableKindId.equals(tableManager.getTable().getTableKindId()) && (column == null || row == null);
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.nattable.manager.cell.AbstractCellManager#doGetValue(java.lang.Object, java.lang.Object, org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager)
+ *
+ * @param columnElement
+ * @param rowElement
+ * @param tableManager
+ * @return
+ */
+ @Override
+ protected Object doGetValue(final Object columnElement, final Object rowElement, final INattableModelManager tableManager) {
+ return ""; //$NON-NLS-1$
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.nattable.manager.cell.AbstractCellManager#isCellEditable(java.lang.Object, java.lang.Object, org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager)
+ *
+ * @param columnElement
+ * @param rowElement
+ * @param tableManager
+ * @return
+ */
+ @Override
+ public boolean isCellEditable(Object columnElement, Object rowElement, INattableModelManager tableManager) {
+ return false;
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.nattable.manager.cell.AbstractCellManager#isCellEditable(java.lang.Object, java.lang.Object, java.util.Map, org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager)
+ *
+ * @param columnElement
+ * @param rowElement
+ * @param sharedMap
+ * @param tableManager
+ * @return
+ */
+ @Override
+ public boolean isCellEditable(Object columnElement, Object rowElement, Map<?, ?> sharedMap, INattableModelManager tableManager) {
+ // method not yet supported in the context of the AMS
+ return false;
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.nattable.manager.cell.AbstractCellManager#unsetCellValue(org.eclipse.emf.transaction.TransactionalEditingDomain, java.lang.Object, java.lang.Object, org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager)
+ *
+ * @param domain
+ * @param columnElement
+ * @param rowElement
+ * @param tableManager
+ */
+ @Override
+ public void unsetCellValue(TransactionalEditingDomain domain, Object columnElement, Object rowElement, INattableModelManager tableManager) {
+ // nothing to do
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.nattable.manager.cell.AbstractCellManager#getUnsetCellValueCommand(org.eclipse.emf.transaction.TransactionalEditingDomain, java.lang.Object, java.lang.Object,
+ * org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager)
+ *
+ * @param domain
+ * @param columnElement
+ * @param rowElement
+ * @param tableManager
+ * @return
+ */
+ @Override
+ public Command getUnsetCellValueCommand(TransactionalEditingDomain domain, Object columnElement, Object rowElement, INattableModelManager tableManager) {
+ return null;
+
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.nattable.manager.cell.AbstractCellManager#getSetValueCommand(org.eclipse.emf.transaction.TransactionalEditingDomain, java.lang.Object, java.lang.Object, java.lang.Object,
+ * org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager)
+ *
+ * @param domain
+ * @param columnElement
+ * @param rowElement
+ * @param newValue
+ * @param tableManager
+ * @return
+ */
+ @Override
+ public Command getSetValueCommand(final TransactionalEditingDomain domain, final Object columnElement, final Object rowElement, final Object newValue, final INattableModelManager tableManager) {
+ return null;
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/mouse/action/EmptyLineRowHeaderEventMatch.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/mouse/action/EmptyLineRowHeaderEventMatch.java
new file mode 100755
index 00000000000..ec71119c1a8
--- /dev/null
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/mouse/action/EmptyLineRowHeaderEventMatch.java
@@ -0,0 +1,61 @@
+/*****************************************************************************
+ * Copyright (c) 2020 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are the property of CEA LIST, their use is subject to specific
+ * agreement with the CEA LIST.
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) <vincent.lorenzo@cea.fr>
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.nattable.mouse.action;
+
+import org.eclipse.nebula.widgets.nattable.NatTable;
+import org.eclipse.nebula.widgets.nattable.layer.LabelStack;
+import org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell;
+import org.eclipse.nebula.widgets.nattable.ui.matcher.MouseEventMatcher;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.ITreeItemAxis;
+import org.eclipse.swt.events.MouseEvent;
+
+/**
+ * Matcher for empty line selection in row header
+ *
+ * @since 6.7
+ */
+public class EmptyLineRowHeaderEventMatch extends MouseEventMatcher {
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param stateMask
+ * @param eventRegion
+ * @param button
+ * @param actionId
+ */
+ public EmptyLineRowHeaderEventMatch(final int stateMask, final String eventRegion, final int button) {
+ super(stateMask, eventRegion, button);
+ }
+
+ /**
+ * @see org.eclipse.nebula.widgets.nattable.ui.matcher.MouseEventMatcher#matches(org.eclipse.nebula.widgets.nattable.NatTable, org.eclipse.swt.events.MouseEvent, org.eclipse.nebula.widgets.nattable.layer.LabelStack)
+ *
+ * @param natTable
+ * @param event
+ * @param regionLabels
+ * @return
+ */
+ @Override
+ public boolean matches(final NatTable natTable, final MouseEvent event, final LabelStack regionLabels) {
+ final int colPos = natTable.getColumnPositionByX(event.x);
+ final int rowPos = natTable.getRowPositionByY(event.y);
+ final ILayerCell cellLayer = natTable.getCellByPosition(colPos, rowPos);
+ final Object value = cellLayer.getDataValue();
+ if (value instanceof ITreeItemAxis) {
+ return super.matches(natTable, event, regionLabels) && ((ITreeItemAxis) value).getElement() == null;
+ }
+ return false;
+ }
+} \ No newline at end of file
diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display/src/org/eclipse/papyrus/uml/nattable/stereotype/display/Activator.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display/src/org/eclipse/papyrus/uml/nattable/stereotype/display/Activator.java
index eecf51dad00..891d8e3845a 100644
--- a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display/src/org/eclipse/papyrus/uml/nattable/stereotype/display/Activator.java
+++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display/src/org/eclipse/papyrus/uml/nattable/stereotype/display/Activator.java
@@ -1,3 +1,17 @@
+/*****************************************************************************
+ * Copyright (c) 2015 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
package org.eclipse.papyrus.uml.nattable.stereotype.display;
import org.eclipse.papyrus.infra.core.log.LogHelper;
@@ -14,10 +28,10 @@ public class Activator extends AbstractUIPlugin {
// The shared instance
private static Activator plugin;
-
+
/** The plug-in's logger */
public static LogHelper log;
-
+
/**
* The constructor
*/
@@ -26,8 +40,10 @@ public class Activator extends AbstractUIPlugin {
/*
* (non-Javadoc)
+ *
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
*/
+ @Override
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
@@ -36,8 +52,10 @@ public class Activator extends AbstractUIPlugin {
/*
* (non-Javadoc)
+ *
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
*/
+ @Override
public void stop(BundleContext context) throws Exception {
plugin = null;
super.stop(context);
diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display/src/org/eclipse/papyrus/uml/nattable/stereotype/display/manager/axis/NotationTreeTableAxisManager.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display/src/org/eclipse/papyrus/uml/nattable/stereotype/display/manager/axis/NotationTreeTableAxisManager.java
index 68a48d1bbee..89515a72096 100644
--- a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display/src/org/eclipse/papyrus/uml/nattable/stereotype/display/manager/axis/NotationTreeTableAxisManager.java
+++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display/src/org/eclipse/papyrus/uml/nattable/stereotype/display/manager/axis/NotationTreeTableAxisManager.java
@@ -1,4 +1,17 @@
-
+/*****************************************************************************
+ * Copyright (c) 2015 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
package org.eclipse.papyrus.uml.nattable.stereotype.display.manager.axis;
import java.util.ArrayList;
@@ -90,7 +103,7 @@ public class NotationTreeTableAxisManager extends EObjectTreeAxisManagerForEvent
} else if (part instanceof DiagramEditor) {
editor = (DiagramEditor) part;
}
- selectionList = new ArrayList<Object>();
+ selectionList = new ArrayList<>();
if (editor != null && !editor.getDiagramGraphicalViewer().getSelection().isEmpty()) {
IStructuredSelection selection = (IStructuredSelection) editor.getDiagramGraphicalViewer().getSelection();
Iterator<?> iter = selection.iterator();
@@ -130,7 +143,7 @@ public class NotationTreeTableAxisManager extends EObjectTreeAxisManagerForEvent
/**
* Check is the element of the view is stereotyped.
- *
+ *
* @param view
* The view.
* @return <code>true</code> if the element of view is stereotyped, <code>false</code> otherwise.
@@ -340,7 +353,7 @@ public class NotationTreeTableAxisManager extends EObjectTreeAxisManagerForEvent
* Get the tree layer.
*
* @return
- * the tree layer
+ * the tree layer
*/
private TreeLayer getTreeLayer() {
NatTable natTable = (NatTable) getTableManager().getAdapter(NatTable.class);
@@ -357,7 +370,7 @@ public class NotationTreeTableAxisManager extends EObjectTreeAxisManagerForEvent
/**
* {@inheritDoc}
- *
+ *
* @see org.eclipse.papyrus.infra.nattable.manager.axis.AbstractTreeAxisManagerForEventList#dispose()
*/
@Override
diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display/src/org/eclipse/papyrus/uml/nattable/stereotype/display/manager/axis/StereotypeDisplayPropertiesAxisManager.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display/src/org/eclipse/papyrus/uml/nattable/stereotype/display/manager/axis/StereotypeDisplayPropertiesAxisManager.java
index dbb564918c4..1ba699e11aa 100644
--- a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display/src/org/eclipse/papyrus/uml/nattable/stereotype/display/manager/axis/StereotypeDisplayPropertiesAxisManager.java
+++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display/src/org/eclipse/papyrus/uml/nattable/stereotype/display/manager/axis/StereotypeDisplayPropertiesAxisManager.java
@@ -1,3 +1,17 @@
+/*****************************************************************************
+ * Copyright (c) 2015 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
package org.eclipse.papyrus.uml.nattable.stereotype.display.manager.axis;
import org.eclipse.emf.common.command.Command;
diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/plugin.xml b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/plugin.xml
index e88aa1fa601..7e22b1cbfee 100755
--- a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/plugin.xml
+++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/plugin.xml
@@ -229,6 +229,10 @@
id="org.eclipse.papyrus.uml.nattable.stereotype.operation.axis.manager"
manager="org.eclipse.papyrus.uml.nattable.manager.axis.UMLStereotypeOperationAxisManager">
</axisManager>
+ <axisManager
+ id="org.eclipse.papyrus.uml.nattable.manager.axis.EmptyLineUMLElementTreeAxisManagerForEventList"
+ manager="org.eclipse.papyrus.uml.nattable.manager.axis.EmptyLineUMLElementTreeAxisManagerForEventList">
+ </axisManager>
</extension>
<extension
point="org.eclipse.papyrus.infra.nattable.cellmanager">
diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/manager/axis/EmptyLineUMLElementTreeAxisManagerForEventList.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/manager/axis/EmptyLineUMLElementTreeAxisManagerForEventList.java
new file mode 100755
index 00000000000..5e6d8270d6f
--- /dev/null
+++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/manager/axis/EmptyLineUMLElementTreeAxisManagerForEventList.java
@@ -0,0 +1,99 @@
+/*****************************************************************************
+ * Copyright (c) 2020 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.nattable.manager.axis;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.ITreeItemAxis;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.TreeFillingConfiguration;
+import org.eclipse.papyrus.infra.nattable.utils.FillingConfigurationUtils;
+
+/**
+ * TODO : not yet tested with no {@link TreeFillingConfiguration} for depth==0
+ * Axis Manager with one empty line at each level
+ *
+ * @since 5.4
+ */
+public class EmptyLineUMLElementTreeAxisManagerForEventList extends UMLElementTreeAxisManagerForEventList {
+
+ /**
+ * boolean indicating if we need to create empty row or not under each feature row
+ */
+ private boolean createEmptyRow = false;// false, by default, because in Papyrus we don't get this behavior
+
+ /**
+ *
+ * @param createEmptyLine
+ * if <code>true</code> the axis manager will create an empty line at each level
+ */
+ public void setCreateEmptyRow(final boolean createEmptyRow) {
+ this.createEmptyRow = createEmptyRow;
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.nattable.manager.axis.AbstractTreeAxisManagerForEventList#addObject(org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.ITreeItemAxis, java.lang.Object)
+ *
+ * @param parentAxis
+ * @param objectToAdd
+ * @return
+ */
+ @Override
+ protected ITreeItemAxis addObject(ITreeItemAxis parentAxis, Object objectToAdd) {
+ final ITreeItemAxis createdAxis = super.addObject(parentAxis, objectToAdd);
+ if (this.createEmptyRow) {
+ if (objectToAdd instanceof TreeFillingConfiguration) {
+ super.addObject(createdAxis, null);
+ }
+ }
+ return createdAxis;
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.nattable.manager.axis.AbstractTreeAxisManagerForEventList#fillChildrenForSemanticElement(org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.ITreeItemAxis)
+ *
+ * @param axis
+ */
+ @Override
+ protected void fillChildrenForSemanticElement(ITreeItemAxis axis) {
+ if (this.createEmptyRow && axis != null
+ && axis.getElement() != null) {// to avoid to add empty axis to an empty axis
+ if (axis.getChildren().size() == 0) {
+ int nextDepth = getSemanticDepth(axis) + 1;
+ Object context = axis.getElement();
+ Assert.isTrue(!(context instanceof TreeFillingConfiguration));
+ final List<TreeFillingConfiguration> confs = FillingConfigurationUtils.getTreeFillingConfigurationForDepth(getTable(), representedAxisManager, nextDepth);
+ for (TreeFillingConfiguration current : confs) {
+ // with empty line, we always create a new axis for the TreeFillingConfiguration
+ ITreeItemAxis newAxis = addObject(axis, current);
+
+ final Collection<?> values = getFilteredValueAsCollection(current, context, nextDepth);
+ if (values.size() != 0) {
+ if (nextDepth == 0) {
+ for (Object curr : values) {
+ addObject(newAxis, curr);
+ }
+ }
+ }
+ }
+ }
+ } else {
+ super.fillChildrenForSemanticElement(axis);
+ }
+ }
+}

Back to the top