Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThanh Liem PHAN2017-05-31 03:59:14 -0400
committervincent lorenzo2017-11-20 07:31:54 -0500
commit8eca02ee0e11692796d583e3b86df24540f34100 (patch)
treef213e560615a2917b0e5fe8f8f96653224bf914a
parent5afa41f30f3f7a556cb3fdbee14a90733af607a6 (diff)
downloadorg.eclipse.papyrus-8eca02ee0e11692796d583e3b86df24540f34100.tar.gz
org.eclipse.papyrus-8eca02ee0e11692796d583e3b86df24540f34100.tar.xz
org.eclipse.papyrus-8eca02ee0e11692796d583e3b86df24540f34100.zip
Bug 515737: [Table] Papyrus Table must be able to display list in cells
with a new line for each object owned by the list and fake line between values https://bugs.eclipse.org/bugs/show_bug.cgi?id=515737 - Add icon for each element of the list - Create a new custom table cell painter - Add menu context and named style for each multiple values column such as multiple [boolean | integer | real | string | reference | enum] - Handle generic table, generic tree table, class tree table, generic stereotype table - Handle also invert table for the invertable one - Support wraptext + autoResizeCellHeight for multi string cell - Add dev doc and user doc for the new feature - JUnit Test Note that EOperationAxis column is not supported yet. Change-Id: If2da613cf6f7c11c31652f6ac4a719faa36e5733 Signed-off-by: Thanh Liem PHAN <thanhliem.phan@all4tec.net> Signed-off-by: Vincent Lorenzo <vincent.lorenzo@cea.fr>
-rw-r--r--plugins/doc/org.eclipse.papyrus.infra.nattable.doc/src/site/mediawiki/images/DisplayListOnSeparatedRows.pngbin0 -> 31200 bytes
-rw-r--r--plugins/doc/org.eclipse.papyrus.infra.nattable.doc/src/site/mediawiki/tableDevDoc.mediawiki6
-rwxr-xr-xplugins/doc/org.eclipse.papyrus.infra.nattable.doc/src/site/mediawiki/tableUserDoc.mediawiki12
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/celleditor/config/SingleStringCellEditorConfiguration.java8
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/META-INF/MANIFEST.MF1
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/plugin.xml84
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/applynamedstyle/PapyrusApplyNamedStyleBindings.java53
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/applynamedstyle/PapyrusApplyNamedStyleCommand.java69
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/applynamedstyle/PapyrusApplyNamedStyleCommandHandler.java67
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/config/AbstractCellAxisConfiguration.java18
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/command/CommandIds.java11
-rwxr-xr-xplugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/CellEditorAxisConfiguration.java13
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/PapyrusGridLayerConfiguration.java13
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/AbstractTableHandler.java14
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/SetDisplayListOnSeparatedRowsHandler.java59
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/NattableModelManager.java19
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/painter/CellPainterWithUnderlinedError.java39
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/painter/CustomizedCellPainter.java40
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/painter/PapyrusTableCellPainter.java55
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/provider/NattableTopLabelProvider.java624
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/AxisUtils.java296
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/NamedStyleConstants.java18
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/NattableWidgetPropertyTester.java255
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/StyleUtils.java96
-rwxr-xr-xplugins/uml/nattable/org.eclipse.papyrus.uml.nattable/plugin.xml67
-rw-r--r--plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/config/MultiBooleanCellEditorConfiguration.java14
-rw-r--r--plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/config/MultiEEnumCellEditorConfiguration.java14
-rw-r--r--plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/config/MultiIntegerCellEditorConfiguration.java14
-rw-r--r--plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/config/MultiRealCellEditorConfiguration.java14
-rw-r--r--plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/config/MultiStringCellEditorConfiguration.java26
-rw-r--r--plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/config/MultiUMLReferenceCellEditorConfiguration.java9
-rw-r--r--plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/config/MultiUnlimitedNaturalCellEditorConfiguration.java14
-rwxr-xr-xplugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/config/UMLStereotypeMultiDataTypeCellEditorConfiguration.java17
-rw-r--r--plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/config/UMLStereotypeMultiUMLEnumerationCellEditorConfiguration.java14
-rw-r--r--plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/config/utils/CellEditorConfigurationUtils.java94
-rw-r--r--plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/tester/UMLNattableWidgetPropertyTester.java72
-rw-r--r--plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/utils/UMLNattableStereotypeUtils.java215
-rw-r--r--tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/resources/bugs/bug515737/DisplayListOnSeparatedRowsTest.di2
-rw-r--r--tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/resources/bugs/bug515737/DisplayListOnSeparatedRowsTest.notation22
-rw-r--r--tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/resources/bugs/bug515737/DisplayListOnSeparatedRowsTest.uml9
-rw-r--r--tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/bugs/DisplayListOnSeparatedRowsTest.java97
-rw-r--r--tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/tests/AllTests.java6
42 files changed, 1939 insertions, 651 deletions
diff --git a/plugins/doc/org.eclipse.papyrus.infra.nattable.doc/src/site/mediawiki/images/DisplayListOnSeparatedRows.png b/plugins/doc/org.eclipse.papyrus.infra.nattable.doc/src/site/mediawiki/images/DisplayListOnSeparatedRows.png
new file mode 100644
index 00000000000..eded1b9121e
--- /dev/null
+++ b/plugins/doc/org.eclipse.papyrus.infra.nattable.doc/src/site/mediawiki/images/DisplayListOnSeparatedRows.png
Binary files differ
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 5943bb18768..98170ae2f31 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
@@ -1946,7 +1946,11 @@ NamedStyles are properties that the users can add to table configurations to pro
| child of Table
| determines if the cell height will be resized automatically when displaying the table
|-
-|
+| style="font-weight: bold;" | displayListOnSeparatedRows
+| BooleanValueStyle
+| child of Axis
+| determines if the elements list of a fully selected column (or row in an invert table) is displayed on separated rows or single row
+|-
|
|
|
diff --git a/plugins/doc/org.eclipse.papyrus.infra.nattable.doc/src/site/mediawiki/tableUserDoc.mediawiki b/plugins/doc/org.eclipse.papyrus.infra.nattable.doc/src/site/mediawiki/tableUserDoc.mediawiki
index bdf772cc601..ce67331800e 100755
--- a/plugins/doc/org.eclipse.papyrus.infra.nattable.doc/src/site/mediawiki/tableUserDoc.mediawiki
+++ b/plugins/doc/org.eclipse.papyrus.infra.nattable.doc/src/site/mediawiki/tableUserDoc.mediawiki
@@ -218,8 +218,11 @@ Moreover Tree table provides some specific features
[[File:images/ConfigureUnsupportedCellContent.PNG|frame|none|Preference to configure unsupported cell content]]
:Then the content of all cells under unsupported columns will be updated immediately, as showed in the following figure:
[[File:images/UnsupportedCellContentExample.PNG|frame|none|Unsupported cell content example]]
+; Display List on Separated Rows for fully selected columns/rows with multiple values<br>
+[[File:images/DisplayListOnSeparatedRows.png|frame|none|Menu to Show/Hide Display List on Separated Rows]]
+: Select fully a column with multiple values (or a row in an invert table) then right click on the corresponding column header to show the context menu and select Display List On Separated Rows
===The list of available features for tables===
-This table lists all feature available for Tabular editors provided by Papyrus (the 6th of August 2017). This list could be considered as representative of tables capabilities '''assuming 3 points''':
+This table lists all feature available for Tabular editors provided by Papyrus (the 1st of September 2017). This list could be considered as representative of tables capabilities '''assuming 3 points''':
# The table is not inverted
# Elements are on rows
# Features are on columns
@@ -413,6 +416,13 @@ if the user changed the configuration
| Configure unsupported cell content
| colspan="5" style="text-align: center;" | Yes (action provided by Preferences/Papyrus/NatTable/Cell Preferences)
|-
+| Display List on Separated Rows for a fully selected column of multiple values
+| style="text-align: center;" | Yes
+| style="text-align: center;" | Yes
+| style="text-align: center;" | Yes
+| style="text-align: center;" | No
+| style="text-align: center;" | Yes
+|-
|}
== Fill cells ==
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/celleditor/config/SingleStringCellEditorConfiguration.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/celleditor/config/SingleStringCellEditorConfiguration.java
index 3e32fe37737..33a757caf59 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/celleditor/config/SingleStringCellEditorConfiguration.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/celleditor/config/SingleStringCellEditorConfiguration.java
@@ -8,7 +8,7 @@
*
* Contributors:
* CEA LIST - Initial API and implementation
- * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Bug 459220
+ * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Bug 459220, 515737
*****************************************************************************/
package org.eclipse.papyrus.infra.emf.nattable.celleditor.config;
@@ -97,8 +97,10 @@ public class SingleStringCellEditorConfiguration implements ICellAxisConfigurati
*/
@Override
public void configureCellEditor(IConfigRegistry configRegistry, Object axis, String configLabel) {
- configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, getCellPainter(configRegistry, axis, configLabel), DisplayMode.NORMAL, configLabel);
- configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITOR, getCellEditor(configRegistry, axis, configLabel), DisplayMode.EDIT, configLabel);
+ final Object axisElement = AxisUtils.getRepresentedElement(axis);
+
+ configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, getCellPainter(configRegistry, axisElement, configLabel), DisplayMode.NORMAL, configLabel);
+ configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITOR, getCellEditor(configRegistry, axisElement, configLabel), DisplayMode.EDIT, configLabel);
// I believe that we don't need converters because we are working with the standard type --String.
// configRegistry.registerConfigAttribute(CellConfigAttributes.DISPLAY_CONVERTER, null, DisplayMode.EDIT, configLabel);
}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/META-INF/MANIFEST.MF b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/META-INF/MANIFEST.MF
index 2b81d174652..55d051355c0 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/META-INF/MANIFEST.MF
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/META-INF/MANIFEST.MF
@@ -2,6 +2,7 @@ Manifest-Version: 1.0
Export-Package: org.eclipse.papyrus.infra.nattable,
org.eclipse.papyrus.infra.nattable.accumulator,
org.eclipse.papyrus.infra.nattable.advice,
+ org.eclipse.papyrus.infra.nattable.applynamedstyle,
org.eclipse.papyrus.infra.nattable.celleditor,
org.eclipse.papyrus.infra.nattable.celleditor.config,
org.eclipse.papyrus.infra.nattable.command,
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/plugin.xml b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/plugin.xml
index 8bab5deb5fe..c5e20eb408b 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/plugin.xml
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/plugin.xml
@@ -966,7 +966,7 @@
class="org.eclipse.papyrus.infra.nattable.utils.NattableWidgetPropertyTester"
id="org.eclipse.papyrus.infra.nattable.tester"
namespace="org.eclipse.papyrus.infra.nattable.tester"
- properties="isNattableWidget, hasFeatureRowHeaderConfiguration, hasFeatureColumnHeaderConfiguration, hasSlaveRowAxisProvider, hasSlaveColumnAxisProvider, canInvertAxis, isHierarchicTable"
+ properties="isNattableWidget, hasFeatureRowHeaderConfiguration, hasFeatureColumnHeaderConfiguration, hasSlaveRowAxisProvider, hasSlaveColumnAxisProvider, canInvertAxis, isHierarchicTable, isOneMultipleValuesAxisSelected"
type="org.eclipse.jface.viewers.IStructuredSelection">
</propertyTester>
<propertyTester
@@ -1782,6 +1782,26 @@
id="org.eclipse.ui.commands.toggleState">
</state>
</command>
+ <command
+ categoryId="org.eclipse.papyrus.infra.nattable.category"
+ description="Display List On Separated Rows For Columne Header"
+ id="org.eclipse.papyrus.infra.nattable.displaylist.separatedrows.columnheader"
+ name="Display List On Separated Rows">
+ <state
+ class="org.eclipse.ui.handlers.RegistryToggleState"
+ id="org.eclipse.ui.commands.toggleState">
+ </state>
+ </command>
+ <command
+ categoryId="org.eclipse.papyrus.infra.nattable.category"
+ description="Display List On Separated Rows For Row Header"
+ id="org.eclipse.papyrus.infra.nattable.displaylist.separatedrows.rowheader"
+ name="Display List On Separated Rows">
+ <state
+ class="org.eclipse.ui.handlers.RegistryToggleState"
+ id="org.eclipse.ui.commands.toggleState">
+ </state>
+ </command>
</extension>
<extension
point="org.eclipse.ui.menus">
@@ -1799,6 +1819,60 @@
style="toggle">
</command>
</menuContribution>
+ <menuContribution
+ allPopups="true"
+ locationURI="popup:org.eclipse.papyrus.infra.nattable.header.columns.menu?after=general.separator">
+ <command
+ commandId="org.eclipse.papyrus.infra.nattable.displaylist.separatedrows.columnheader"
+ label="Display List On Separated Rows"
+ style="toggle">
+ <visibleWhen
+ checkEnabled="true">
+ <and>
+ <with
+ variable="selection">
+ <test
+ forcePluginActivation="true"
+ property="org.eclipse.papyrus.infra.nattable.tester.isNattableWidget"
+ value="true">
+ </test>
+ <test
+ forcePluginActivation="true"
+ property="org.eclipse.papyrus.infra.nattable.tester.isOneMultipleValuesAxisSelected"
+ value="true">
+ </test>
+ </with>
+ </and>
+ </visibleWhen>
+ </command>
+ </menuContribution>
+ <menuContribution
+ allPopups="true"
+ locationURI="popup:org.eclipse.papyrus.infra.nattable.widget.header.rows.menu?after=general.separator">
+ <command
+ commandId="org.eclipse.papyrus.infra.nattable.displaylist.separatedrows.rowheader"
+ label="Display List On Separated Rows"
+ style="toggle">
+ <visibleWhen
+ checkEnabled="true">
+ <and>
+ <with
+ variable="selection">
+ <test
+ forcePluginActivation="true"
+ property="org.eclipse.papyrus.infra.nattable.tester.isNattableWidget"
+ value="true">
+ </test>
+ <test
+ forcePluginActivation="true"
+ property="org.eclipse.papyrus.infra.nattable.tester.isOneMultipleValuesAxisSelected"
+ value="true">
+ </test>
+ </with>
+ </and>
+ </visibleWhen>
+ </command>
+ </menuContribution>
</extension>
<extension
point="org.eclipse.ui.handlers">
@@ -1830,6 +1904,14 @@
</with>
</activeWhen>
</handler>
+ <handler
+ class="org.eclipse.papyrus.infra.nattable.handler.SetDisplayListOnSeparatedRowsHandler"
+ commandId="org.eclipse.papyrus.infra.nattable.displaylist.separatedrows.columnheader">
+ </handler>
+ <handler
+ class="org.eclipse.papyrus.infra.nattable.handler.SetDisplayListOnSeparatedRowsHandler"
+ commandId="org.eclipse.papyrus.infra.nattable.displaylist.separatedrows.rowheader">
+ </handler>
</extension>
<extension
point="org.eclipse.ui.preferencePages">
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/applynamedstyle/PapyrusApplyNamedStyleBindings.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/applynamedstyle/PapyrusApplyNamedStyleBindings.java
new file mode 100644
index 00000000000..dee1d332cb7
--- /dev/null
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/applynamedstyle/PapyrusApplyNamedStyleBindings.java
@@ -0,0 +1,53 @@
+/*****************************************************************************
+ * Copyright (c) 2017 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thanh Liem PHAN (ALL4TEC) <thanhliem.phan@all4tec.net> - Bug 515737
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.applynamedstyle;
+
+import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
+import org.eclipse.nebula.widgets.nattable.config.IConfiguration;
+import org.eclipse.nebula.widgets.nattable.layer.ILayer;
+import org.eclipse.nebula.widgets.nattable.ui.binding.UiBindingRegistry;
+
+/**
+ * Class to bind default config attributes for applying named style in Papyrus NatTable.
+ *
+ * @since 5.0
+ */
+public class PapyrusApplyNamedStyleBindings implements IConfiguration {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void configureLayer(final ILayer layer) {
+ layer.registerCommandHandler(new PapyrusApplyNamedStyleCommandHandler());
+ }
+
+ /**
+ * @see org.eclipse.nebula.widgets.nattable.config.IConfiguration#configureRegistry(org.eclipse.nebula.widgets.nattable.config.IConfigRegistry)
+ *
+ * @param configRegistry
+ */
+ @Override
+ public void configureRegistry(final IConfigRegistry configRegistry) {
+ // Do nothing
+ }
+
+ /**
+ * @see org.eclipse.nebula.widgets.nattable.config.IConfiguration#configureUiBindings(org.eclipse.nebula.widgets.nattable.ui.binding.UiBindingRegistry)
+ *
+ * @param uiBindingRegistry
+ */
+ @Override
+ public void configureUiBindings(final UiBindingRegistry uiBindingRegistry) {
+ // Do nothing
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/applynamedstyle/PapyrusApplyNamedStyleCommand.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/applynamedstyle/PapyrusApplyNamedStyleCommand.java
new file mode 100644
index 00000000000..3e646a37038
--- /dev/null
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/applynamedstyle/PapyrusApplyNamedStyleCommand.java
@@ -0,0 +1,69 @@
+/*****************************************************************************
+ * 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:
+ * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Bug 515737
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.nattable.applynamedstyle;
+
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.nebula.widgets.nattable.command.AbstractContextFreeCommand;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.StyledElement;
+
+/**
+ * The apply named style command.
+ *
+ * @since 5.0
+ */
+public class PapyrusApplyNamedStyleCommand extends AbstractContextFreeCommand {
+
+ /** The editing domain. */
+ private TransactionalEditingDomain editingDomain;
+
+ /** The element to be applied the named style. */
+ private StyledElement element;
+
+ /** The named style string. */
+ private String namedStyle;
+
+ /**
+ * Constructor.
+ *
+ * @param element
+ * The element to be applied the named style
+ * @param namedStyle
+ * The named style string
+ */
+ public PapyrusApplyNamedStyleCommand(final TransactionalEditingDomain editingDomain, final StyledElement element, final String namedStyle) {
+ this.editingDomain = editingDomain;
+ this.element = element;
+ this.namedStyle = namedStyle;
+ }
+
+ /**
+ * @return The editing domain
+ */
+ public TransactionalEditingDomain getEditingDomain() {
+ return this.editingDomain;
+ }
+
+ /**
+ * @return The element to be applied the named style
+ */
+ public StyledElement getElement() {
+ return this.element;
+ }
+
+ /**
+ * @return The named style string
+ */
+ public String getNamedStyle() {
+ return this.namedStyle;
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/applynamedstyle/PapyrusApplyNamedStyleCommandHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/applynamedstyle/PapyrusApplyNamedStyleCommandHandler.java
new file mode 100644
index 00000000000..802aaab5170
--- /dev/null
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/applynamedstyle/PapyrusApplyNamedStyleCommandHandler.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2017 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thanh Liem PHAN (ALL4TEC) <thanhliem.phan@all4tec.net> - Bug 515737
+ ******************************************************************************/
+package org.eclipse.papyrus.infra.nattable.applynamedstyle;
+
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.nebula.widgets.nattable.command.AbstractLayerCommandHandler;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.BooleanValueStyle;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.NattablestylePackage;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.StyledElement;
+import org.eclipse.papyrus.infra.nattable.utils.StyleUtils;
+
+/**
+ * Class to handle the {@link PapyrusApplyNamedStyleCommand}.
+ * The named style will be applied or unapplied to the selected element in the Papyrus NatTable.
+ *
+ * @since 5.0
+ */
+public class PapyrusApplyNamedStyleCommandHandler extends AbstractLayerCommandHandler<PapyrusApplyNamedStyleCommand> {
+
+ /**
+ * Default constructor.
+ */
+ public PapyrusApplyNamedStyleCommandHandler() {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean doCommand(final PapyrusApplyNamedStyleCommand command) {
+
+ final StyledElement element = command.getElement();
+ final String namedStyle = command.getNamedStyle();
+ final TransactionalEditingDomain editingDomain = command.getEditingDomain();
+
+ // Get the named style from the selected element
+ final BooleanValueStyle booleanValue = (BooleanValueStyle) element.getNamedStyle(NattablestylePackage.eINSTANCE.getBooleanValueStyle(), namedStyle);
+
+ // If the named style value exists, it must be true, just delete it,
+ if (null != booleanValue) {
+ // Remove it from the selected axis
+ StyleUtils.deleteBooleanNamedStyle(editingDomain, element, namedStyle);
+ } else {
+ // Otherwise, currently it is false, initialise the boolean named value in the enable mode
+ StyleUtils.initBooleanNamedStyle(editingDomain, element, namedStyle, true);
+ }
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Class<PapyrusApplyNamedStyleCommand> getCommandClass() {
+ return PapyrusApplyNamedStyleCommand.class;
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/config/AbstractCellAxisConfiguration.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/config/AbstractCellAxisConfiguration.java
index 65fa3d96216..32f76ceaf11 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/config/AbstractCellAxisConfiguration.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/config/AbstractCellAxisConfiguration.java
@@ -1,6 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2015 CEA LIST.
- *
+ * Copyright (c) 2015, 2017 CEA LIST.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -9,7 +8,7 @@
*
* Contributors:
* Camille Letavernier (camille.letavernier@cea.fr) - Initial API and implementation
- *
+ * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Bug 515737
*****************************************************************************/
package org.eclipse.papyrus.infra.nattable.celleditor.config;
@@ -24,6 +23,7 @@ import org.eclipse.nebula.widgets.nattable.painter.cell.ICellPainter;
import org.eclipse.nebula.widgets.nattable.style.DisplayMode;
import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
+import org.eclipse.papyrus.infra.nattable.utils.AxisUtils;
import org.eclipse.papyrus.infra.nattable.utils.NattableConfigAttributes;
import org.eclipse.papyrus.infra.ui.emf.providers.EMFLabelProvider;
@@ -64,12 +64,14 @@ public abstract class AbstractCellAxisConfiguration implements ICellAxisConfigur
final INattableModelManager modelManager = getModelManager(configRegistry);
final Table table = modelManager.getTable();
- final String displayMode = getDisplayMode(table, axis);
+ final Object axisElement = AxisUtils.getRepresentedElement(axis);
+
+ final String displayMode = getDisplayMode(table, axisElement);
- final ICellPainter painter = getCellPainter(table, axis);
- final ICellEditor editor = getICellEditor(table, axis, modelManager.getTableAxisElementProvider());
- final IDisplayConverter converter = getDisplayConvert(table, axis, new EMFLabelProvider());// TODO : label provider
- final IDataValidator validator = getDataValidator(table, axis);
+ final ICellPainter painter = getCellPainter(table, axisElement);
+ final ICellEditor editor = getICellEditor(table, axisElement, modelManager.getTableAxisElementProvider());
+ final IDisplayConverter converter = getDisplayConvert(table, axisElement, new EMFLabelProvider());// TODO : label provider
+ final IDataValidator validator = getDataValidator(table, axisElement);
if (painter != null) {
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, painter, displayMode, configLabel);
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/command/CommandIds.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/command/CommandIds.java
index 5aba41ac9e6..a0ffa49a967 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/command/CommandIds.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/command/CommandIds.java
@@ -90,4 +90,15 @@ public class CommandIds {
*/
public static final String COMMAND_AUTO_RESIZE_CELL_HEIGHT = "org.eclipse.papyrus.infra.nattable.autoresize.cellheight"; //$NON-NLS-1$
+ /**
+ * @since 5.0
+ */
+ public static final String COMMAND_DISPLAY_LIST_ON_SEPARATED_ROWS_COLUMNHEADER = "org.eclipse.papyrus.infra.nattable.displaylist.separatedrows.columnheader"; //$NON-NLS-1$
+
+ /**
+ * @since 5.0
+ */
+ public static final String COMMAND_DISPLAY_LIST_ON_SEPARATED_ROWS_ROWHEADER = "org.eclipse.papyrus.infra.nattable.displaylist.separatedrows.rowheader"; //$NON-NLS-1$
+
+
}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/CellEditorAxisConfiguration.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/CellEditorAxisConfiguration.java
index ff8412ccf73..045f37e63f5 100755
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/CellEditorAxisConfiguration.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/CellEditorAxisConfiguration.java
@@ -1,6 +1,6 @@
/*****************************************************************************
- * Copyright (c) 2015 CEA LIST and others.
- *
+ * Copyright (c) 2015, 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
@@ -8,7 +8,7 @@
*
* Contributors:
* CEA LIST - Initial API and implementation
- *
+ * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Bug 515737
*****************************************************************************/
package org.eclipse.papyrus.infra.nattable.configuration;
@@ -38,7 +38,6 @@ import org.eclipse.papyrus.infra.nattable.layerstack.BodyLayerStack;
import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
import org.eclipse.papyrus.infra.nattable.messages.Messages;
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.nattableconfiguration.CellEditorDeclaration;
import org.eclipse.papyrus.infra.nattable.utils.NattableConfigAttributes;
import org.eclipse.papyrus.infra.nattable.utils.TableHelper;
@@ -59,7 +58,7 @@ public class CellEditorAxisConfiguration extends AbstractRegistryConfiguration {
/**
- *
+ *
* @see org.eclipse.nebula.widgets.nattable.config.IConfiguration#configureRegistry(org.eclipse.nebula.widgets.nattable.config.IConfigRegistry)
*
* @param configRegistry
@@ -109,9 +108,7 @@ public class CellEditorAxisConfiguration extends AbstractRegistryConfiguration {
Assert.isTrue(declareOnColumn != declareOnRow);
for (int i = 0; i < elements.size(); i++) {
Object current = elements.get(i);
- if (current instanceof IAxis) {
- current = ((IAxis) current).getElement();
- }
+
boolean configWithNewRegistry = configureWithNewRegistry(configRegistry, current, i, columnAccumulator, rowAccumulator);
// boolean configWithOldFactory = false;
if (!configWithNewRegistry) {
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/PapyrusGridLayerConfiguration.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/PapyrusGridLayerConfiguration.java
index 8659baa3960..b40b9fe1e08 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/PapyrusGridLayerConfiguration.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/configuration/PapyrusGridLayerConfiguration.java
@@ -8,12 +8,13 @@
*
* Contributors:
* Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Bug 417095
+ * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Bug 417095, 515737
*****************************************************************************/
package org.eclipse.papyrus.infra.nattable.configuration;
import org.eclipse.nebula.widgets.nattable.grid.layer.config.DefaultGridLayerConfiguration;
import org.eclipse.nebula.widgets.nattable.layer.CompositeLayer;
+import org.eclipse.papyrus.infra.nattable.applynamedstyle.PapyrusApplyNamedStyleBindings;
import org.eclipse.papyrus.infra.nattable.export.PapyrusExportBindings;
import org.eclipse.papyrus.infra.nattable.export.file.PapyrusFileExportBindings;
import org.eclipse.papyrus.infra.nattable.export.image.PapyrusImageExportBindings;
@@ -36,6 +37,7 @@ public class PapyrusGridLayerConfiguration extends DefaultGridLayerConfiguration
super(gridLayer);
addFileExportUIBindings();
addImageExportUIBindings();
+ addApplyNamedStyleBindings();
}
/**
@@ -84,4 +86,13 @@ public class PapyrusGridLayerConfiguration extends DefaultGridLayerConfiguration
protected void addImageExportUIBindings() {
addConfiguration(new PapyrusImageExportBindings());
}
+
+ /**
+ * Add the apply named style binding.
+ *
+ * @since 5.0
+ */
+ protected void addApplyNamedStyleBindings() {
+ addConfiguration(new PapyrusApplyNamedStyleBindings());
+ }
}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/AbstractTableHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/AbstractTableHandler.java
index 8851c004904..fb21dd7acaf 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/AbstractTableHandler.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/AbstractTableHandler.java
@@ -113,6 +113,20 @@ public abstract class AbstractTableHandler extends AbstractHandler {
return manager;
}
+ /**
+ * @return
+ * the current NatTable or <code>null</code> if not found
+ * @since 5.0
+ */
+ protected NatTable getCurrentNatTable() {
+ final NatEventData data = getNatEventData();
+ NatTable natTable = null;
+ if (null != data) {
+ natTable = data.getNatTable();
+ }
+
+ return natTable;
+ }
/**
* Returns the EditingDomain associated to the table
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/SetDisplayListOnSeparatedRowsHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/SetDisplayListOnSeparatedRowsHandler.java
new file mode 100644
index 00000000000..0479c644dca
--- /dev/null
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/SetDisplayListOnSeparatedRowsHandler.java
@@ -0,0 +1,59 @@
+/*****************************************************************************
+ * Copyright (c) 2017 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Bug 515737
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.handler;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.nebula.widgets.nattable.NatTable;
+import org.eclipse.papyrus.infra.nattable.applynamedstyle.PapyrusApplyNamedStyleCommand;
+import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.IAxis;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.AbstractAxisProvider;
+import org.eclipse.papyrus.infra.nattable.utils.AxisUtils;
+import org.eclipse.papyrus.infra.nattable.utils.NamedStyleConstants;
+
+/**
+ * Handler to display list on separated rows of the active table.
+ *
+ * @since 5.0
+ */
+public class SetDisplayListOnSeparatedRowsHandler extends AbstractTableHandler {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Object execute(final ExecutionEvent event) throws ExecutionException {
+ final TransactionalEditingDomain editingDomain = getTableEditingDomain();
+ final INattableModelManager manager = getCurrentNattableModelManager();
+ final NatTable natTable = getCurrentNatTable();
+ if (null != editingDomain && null != manager && null != natTable) {
+
+ // Get the selected axis index
+ final int selectedAxisIndex = AxisUtils.getUniqueSelectedAxisIndex(manager);
+
+ // Always get the column axis provider for invert or non-invert table
+ final AbstractAxisProvider axisProvider = manager.getTable().getCurrentColumnAxisProvider();
+
+ // If the axis index is not out of range
+ if (null != axisProvider && 0 <= selectedAxisIndex && selectedAxisIndex < axisProvider.getAxis().size()) {
+ final IAxis selectedAxis = axisProvider.getAxis().get(selectedAxisIndex);
+
+ // Apply the displayListOnSeparatedRows named style on the selected axis
+ natTable.doCommand(new PapyrusApplyNamedStyleCommand(editingDomain, selectedAxis, NamedStyleConstants.DISPLAY_LIST_ON_SEPARATED_ROWS));
+ }
+ }
+
+ return null;
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/NattableModelManager.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/NattableModelManager.java
index 284efb0cf28..cc930653395 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/NattableModelManager.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/NattableModelManager.java
@@ -11,7 +11,7 @@
* Nicolas FAUVERGUE (CEA LIST) nicolas.fauvergue@cea.fr - Bug 476618, 504077, 496905, 508175
* Nicolas Boulay (Esterel Technologies SAS) - Bug 497467
* Sebastien Bordes (Esterel Technologies SAS) - Bug 497738
- * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Bug 459220, 526146
+ * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Bug 459220, 526146, 515737
*****************************************************************************/
package org.eclipse.papyrus.infra.nattable.manager.table;
@@ -715,6 +715,23 @@ public class NattableModelManager extends AbstractNattableWidgetManager implemen
command = commandService.getCommand(CommandIds.COMMAND_AUTO_RESIZE_CELL_HEIGHT);
updateToggleCommandState(command, StyleUtils.getBooleanNamedStyleValue(getTable(), NamedStyleConstants.AUTO_RESIZE_CELL_HEIGHT));
+ // Update the display list on separated rows state
+ // Get the selected axis index
+ final int selectedAxisIndex = AxisUtils.getUniqueSelectedAxisIndex(this);
+ // Always get the column axis provider for invert or non-invert table
+ final AbstractAxisProvider axisProvider = getTable().getCurrentColumnAxisProvider();
+
+ // If the index is in range, get the relevant axis and update its toggle command state
+ if (null != axisProvider && 0 <= selectedAxisIndex && selectedAxisIndex < axisProvider.getAxis().size()) {
+ final IAxis selectedAxis = axisProvider.getAxis().get(selectedAxisIndex);
+ String commandID = CommandIds.COMMAND_DISPLAY_LIST_ON_SEPARATED_ROWS_COLUMNHEADER;
+ if (getTable().isInvertAxis()) {
+ commandID = CommandIds.COMMAND_DISPLAY_LIST_ON_SEPARATED_ROWS_ROWHEADER;
+ }
+ command = commandService.getCommand(commandID);
+ updateToggleCommandState(command, StyleUtils.getBooleanNamedStyleValue(selectedAxis, NamedStyleConstants.DISPLAY_LIST_ON_SEPARATED_ROWS, NamedStyleConstants.ENABLE_DISPLAY_LIST_ON_SEPARATED_ROWS));
+ }
+
} else {
throw new RuntimeException(String.format("The Eclipse service %s has not been found", ICommandService.class)); //$NON-NLS-1$
}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/painter/CellPainterWithUnderlinedError.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/painter/CellPainterWithUnderlinedError.java
index 26294e9d73f..8a64ce1e692 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/painter/CellPainterWithUnderlinedError.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/painter/CellPainterWithUnderlinedError.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
+ * Copyright (c) 2013, 2017 CEA LIST.
*
*
* All rights reserved. This program and the accompanying materials
@@ -10,7 +10,7 @@
* Contributors:
* Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
* Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 486101
- *
+ * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Bug 515737
*****************************************************************************/
package org.eclipse.papyrus.infra.nattable.painter;
@@ -45,18 +45,39 @@ public class CellPainterWithUnderlinedError extends TextPainter {
* Constructor.
*
* @param wrapText
- * split text over multiple lines
- * @param paintBg
- * skips painting the background if is FALSE
+ * split text over multiple lines
+ * @param paintBg
+ * skips painting the background if is FALSE
*/
public CellPainterWithUnderlinedError(final boolean wrapText, final boolean paintBg) {
super(wrapText, paintBg);
}
/**
+ * Constructor.
+ *
+ * @param wrapText
+ * Split text over multiple lines
+ * @param paintBg
+ * Skip painting the background if is FALSE
+ * @param spacing
+ * The space between text and cell border
+ * @param calculateByTextLength
+ * Tell the text painter to calculate the cell border by
+ * containing text length
+ * @param calculateByTextHeight
+ * Tell the text painter to calculate the cell border by
+ * containing text height
+ * @since 5.0
+ */
+ public CellPainterWithUnderlinedError(final boolean wrapText, final boolean paintBg, final int spacing, final boolean calculateByTextLength, final boolean calculateByTextHeight) {
+ super(wrapText, paintBg, spacing, calculateByTextLength, calculateByTextHeight);
+ }
+
+ /**
* Just calculate if the cell is in error before manage the paint cell. This allows to manage a different pain decoration if needed.
* {@inheritDoc}
- *
+ *
* @see org.eclipse.nebula.widgets.nattable.painter.cell.TextPainter#paintCell(org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell, org.eclipse.swt.graphics.GC, org.eclipse.swt.graphics.Rectangle,
* org.eclipse.nebula.widgets.nattable.config.IConfigRegistry)
*/
@@ -71,7 +92,7 @@ public class CellPainterWithUnderlinedError extends TextPainter {
/**
* This allows to manage a different pain decoration (underline red) if the cell has an error.
* {@inheritDoc}
- *
+ *
* @see org.eclipse.nebula.widgets.nattable.painter.cell.AbstractTextPainter#paintDecoration(org.eclipse.nebula.widgets.nattable.style.IStyle, org.eclipse.swt.graphics.GC, int, int, int, int)
*/
@Override
@@ -100,11 +121,11 @@ public class CellPainterWithUnderlinedError extends TextPainter {
/**
* This allows to determinate if the cell has an error.
- *
+ *
* @param cell
* a cell.
* @return
- * <code>true</code> if the cell contents a Problem
+ * <code>true</code> if the cell contents a Problem
*/
protected boolean hasError(final ILayerCell cell) {
Object value = cell.getDataValue();
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/painter/CustomizedCellPainter.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/painter/CustomizedCellPainter.java
index c3f3536360f..8259e324fa7 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/painter/CustomizedCellPainter.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/painter/CustomizedCellPainter.java
@@ -10,7 +10,7 @@
* Contributors:
* Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
* Juan Cadavid (CEA LIST) juan.cadavid@cea.fr - Override of the paintCell() method
- * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Bug 515735
+ * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Bug 515735, 515737
*****************************************************************************/
package org.eclipse.papyrus.infra.nattable.painter;
@@ -50,6 +50,20 @@ public class CustomizedCellPainter extends CellPainterWithUnderlinedError {
}
/**
+ * Constructor.
+ *
+ * @param wrapText
+ * Split text over multiple lines
+ * @param calculateByTextHeight
+ * Tell the text painter to calculate the cell border by
+ * containing text height
+ * @since 5.0
+ */
+ public CustomizedCellPainter(final boolean wrapText, final boolean calculateByTextHeight) {
+ super(wrapText, true, 2, false, calculateByTextHeight);
+ }
+
+ /**
*
* @see org.eclipse.nebula.widgets.nattable.painter.cell.AbstractTextPainter#convertDataType(org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell, org.eclipse.nebula.widgets.nattable.config.IConfigRegistry)
*
@@ -103,7 +117,7 @@ public class CustomizedCellPainter extends CellPainterWithUnderlinedError {
int yStartPos = rectangle.y + CellStyleUtil.getVerticalAlignmentPadding(cellStyle, rectangle, contentHeight);
String[] lines = text.split("\n"); //$NON-NLS-1$
- for (int lineIndex = 0; lineIndex < lines.length; lineIndex ++) {
+ for (int lineIndex = 0; lineIndex < lines.length; lineIndex++) {
Image im = org.eclipse.papyrus.infra.widgets.Activator.getDefault().getImage("org.eclipse.papyrus.infra.nattable", "/icons/arrow_down_end.png"); //$NON-NLS-1$ //$NON-NLS-2$
// If the current text position passes the cell bounds, we should display the down pointing arrow
@@ -118,4 +132,26 @@ public class CustomizedCellPainter extends CellPainterWithUnderlinedError {
}
}
}
+
+ /**
+ * {@inheritDoc}
+ *
+ * Overridden to bypass the bug 516783 in NatTable. Thanks to Dirk Fauth for the temporary solution.
+ */
+ @Override
+ public int getPreferredHeight(final ILayerCell cell, final GC gc, final IConfigRegistry configRegistry) {
+ setupGCFromConfig(gc, CellStyleUtil.getCellStyle(cell, configRegistry));
+
+ int fontHeight = gc.getFontMetrics().getHeight();
+ String text = convertDataType(cell, configRegistry);
+
+ // Draw Text
+ text = getTextToDisplay(cell, gc, cell.getBounds().width, text);
+
+ int numberOfNewLines = getNumberOfNewLines(text);
+
+ // If the content height is bigger than the available row height
+ // we're extending the row height (only if word wrapping is enabled)
+ return (fontHeight * numberOfNewLines) + (this.lineSpacing * (numberOfNewLines - 1)) + (this.spacing * 2);
+ }
}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/painter/PapyrusTableCellPainter.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/painter/PapyrusTableCellPainter.java
new file mode 100644
index 00000000000..0318b7b2dda
--- /dev/null
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/painter/PapyrusTableCellPainter.java
@@ -0,0 +1,55 @@
+/*****************************************************************************
+ * 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:
+ * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Bug 515737
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.nattable.painter;
+
+import org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell;
+import org.eclipse.nebula.widgets.nattable.painter.cell.ICellPainter;
+import org.eclipse.nebula.widgets.nattable.painter.cell.TableCellPainter;
+
+/**
+ * A customized table painter for Papyrus.
+ *
+ * NB: this class is created to bypass the NPE described in bug 517043.
+ * So in case the bug is resolved, this class should not be used anymore
+ * except if some specific behaviors have been overridden.
+ *
+ * @since 5.0
+ */
+public class PapyrusTableCellPainter extends TableCellPainter {
+
+ /**
+ * Constructor.
+ *
+ * @param internalPainter
+ * The ICellPainter that should be used to render the internal sub cells
+ */
+ public PapyrusTableCellPainter(final ICellPainter internalPainter) {
+ super(internalPainter);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * Overridden to avoid the NPE when cell data is <code>null</code> (bug 517043 in NatTable).
+ */
+ @Override
+ protected Object[] getDataAsArray(final ILayerCell cell) {
+ Object cellData = cell.getDataValue();
+
+ if (null == cellData) {
+ return null;
+ }
+
+ return super.getDataAsArray(cell);
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/provider/NattableTopLabelProvider.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/provider/NattableTopLabelProvider.java
index 6ebdf458816..33ce0bd7269 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/provider/NattableTopLabelProvider.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/provider/NattableTopLabelProvider.java
@@ -1,307 +1,317 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.provider;
-
-import java.util.List;
-
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
-import org.eclipse.nebula.widgets.nattable.grid.GridRegion;
-import org.eclipse.nebula.widgets.nattable.layer.LabelStack;
-import org.eclipse.nebula.widgets.nattable.style.DisplayMode;
-import org.eclipse.papyrus.infra.nattable.manager.table.AbstractNattableWidgetManager;
-import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.IAxis;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.TreeFillingConfiguration;
-import org.eclipse.papyrus.infra.nattable.utils.AxisUtils;
-import org.eclipse.papyrus.infra.nattable.utils.Constants;
-import org.eclipse.papyrus.infra.nattable.utils.ILabelProviderCellContextElementWrapper;
-import org.eclipse.papyrus.infra.nattable.utils.NattableConfigAttributes;
-import org.eclipse.papyrus.infra.services.decoration.DecorationService;
-import org.eclipse.papyrus.infra.services.decoration.util.DecorationImageUtils;
-import org.eclipse.papyrus.infra.services.decoration.util.IPapyrusDecoration;
-import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderService;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * The LabelProvider used in the table
- *
- * @author Vincent Lorenzo
- *
- */
-public class NattableTopLabelProvider extends AbstractNattableCellLabelProvider {
-
-
- /**
- *
- * @param cell
- * @param configRegistry
- * @return
- */
- protected String getColumnHeaderLabel(final ILabelProviderCellContextElementWrapper cell, final IConfigRegistry configRegistry) {
- return getLabel(cell, configRegistry, Constants.HEADER_LABEL_PROVIDER_CONTEXT);
- }
-
- /**
- *
- * @param cell
- * @param configRegistry
- * @return
- */
- protected String getRowHeaderLabel(final ILabelProviderCellContextElementWrapper cell, final IConfigRegistry configRegistry) {
- Object representedObjet = cell.getObject();
- if (representedObjet instanceof IAxis && ((IAxis) representedObjet).getElement() instanceof TreeFillingConfiguration) {
- TreeFillingConfiguration conf = (TreeFillingConfiguration) ((IAxis) representedObjet).getElement();
- return getLabel(cell, configRegistry, conf.getLabelProviderContext());
- }
- return getLabel(cell, configRegistry, Constants.HEADER_LABEL_PROVIDER_CONTEXT);
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.provider.AbstractNattableCellLabelProvider#getText(java.lang.Object)
- *
- * @param element
- * @return
- */
- @Override
- public String getText(Object element) {
- final ILabelProviderCellContextElementWrapper contextElement = (ILabelProviderCellContextElementWrapper) element;
- final IConfigRegistry configRegistry = contextElement.getConfigRegistry();
- final LabelStack labels = getLabelStack(contextElement, configRegistry);
- if (labels.hasLabel(GridRegion.FILTER_ROW)) {
- return getBodyLabel(contextElement, configRegistry);
- }
- if (labels.hasLabel(GridRegion.COLUMN_HEADER)) {
- return getColumnHeaderLabel(contextElement, configRegistry);
- } else if (labels.hasLabel(GridRegion.ROW_HEADER)) {
- return getRowHeaderLabel(contextElement, configRegistry);
- } else if (labels.hasLabel(GridRegion.BODY) || labels.hasLabel(GridRegion.FILTER_ROW)) {
- return getBodyLabel(contextElement, configRegistry);
- }
- Object value = contextElement.getObject();
- if (value != null) {
- return value.toString();
- }
- return ""; //$NON-NLS-1$
- }
-
- /**
- *
- * @param cell
- * @param configRegistry
- * @return
- */
- protected LabelStack getLabelStack(final ILabelProviderCellContextElementWrapper contextElement, final IConfigRegistry configRegistry) {
- LabelStack labels = contextElement.getConfigLabels();
- if (labels.getLabels().isEmpty()) {
- // in case of copy, we don't have the label
- final INattableModelManager manager = configRegistry.getConfigAttribute(NattableConfigAttributes.NATTABLE_MODEL_MANAGER_CONFIG_ATTRIBUTE, DisplayMode.NORMAL, NattableConfigAttributes.NATTABLE_MODEL_MANAGER_ID);
- labels = ((AbstractNattableWidgetManager) manager).getGridLayer().getBodyLayer().getConfigLabelsByPosition(contextElement.getColumnPosition(), contextElement.getRowPosition());
- }
- return labels;
- }
-
- /**
- *
- * @param cell
- * @param configRegistry
- * @param labelproviderContext
- * @return
- */
- protected String getLabel(final ILabelProviderCellContextElementWrapper contextElement, final IConfigRegistry configRegistry, final String labelproviderContext) {
- String txt = ""; //$NON-NLS-1$
- // Object value = cell.getDataValue();
- // final ILabelProviderContextElement contextElement = new LabelProviderCellContextElement(cell, configRegistry);
- LabelProviderService serv = configRegistry.getConfigAttribute(NattableConfigAttributes.LABEL_PROVIDER_SERVICE_CONFIG_ATTRIBUTE, DisplayMode.NORMAL, NattableConfigAttributes.LABEL_PROVIDER_SERVICE_ID);
- ILabelProvider labelProvider = serv.getLabelProvider(labelproviderContext, contextElement);
- if (labelProvider != null) {
- txt = labelProvider.getText(contextElement);
- } else {
- labelProvider = serv.getLabelProvider(labelproviderContext, contextElement.getObject());
- if (labelProvider != null) {
- txt = labelProvider.getText(contextElement.getObject());
- } else {
- labelProvider = serv.getLabelProvider(contextElement.getObject());
- if (labelProvider != null) {
- txt = labelProvider.getText(contextElement.getObject());
- } else {
- txt = contextElement.getObject().toString();
- }
- }
- }
- return txt;
- }
-
- /**
- *
- * @param cellWrapperContextElement
- * @param configRegistry
- * @return
- */
- protected String getBodyLabel(final ILabelProviderCellContextElementWrapper cellWrapperContextElement, final IConfigRegistry configRegistry) {// Body or data grid?
- return getLabel(cellWrapperContextElement, configRegistry, Constants.BODY_LABEL_PROVIDER_CONTEXT);
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.provider.AbstractNattableCellLabelProvider#accept(java.lang.Object)
- *
- * @param element
- * @return
- */
- @Override
- public boolean accept(Object element) {
- return element instanceof ILabelProviderCellContextElementWrapper;
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.provider.AbstractNattableCellLabelProvider#getImage(java.lang.Object)
- *
- * @param element
- * @return
- */
- @Override
- public Image getImage(Object element) {
- final ILabelProviderCellContextElementWrapper contextElement = (ILabelProviderCellContextElementWrapper) element;
- Object object = contextElement.getObject();
- String labelProviderContextId = null;
- final IConfigRegistry configRegistry = contextElement.getConfigRegistry();
- if (object instanceof IAxis) {
- if (((IAxis) object).getElement() instanceof TreeFillingConfiguration) {
- TreeFillingConfiguration conf = (TreeFillingConfiguration) ((IAxis) object).getElement();
- labelProviderContextId = conf.getLabelProviderContext();
- return getImage(contextElement, configRegistry, labelProviderContextId);
- }
- if (((IAxis) object).getManager() == null) {
- return null;
- }
- labelProviderContextId = ((IAxis) object).getManager().getLabelProviderContext();
- if (Constants.HEADER_LABEL_PROVIDER_CONTEXT.equals(labelProviderContextId)) {
- return getImageWithDecoration(contextElement, configRegistry, labelProviderContextId);
- }
- return getImage(contextElement, configRegistry, labelProviderContextId);
- }
- final LabelStack labels = getLabelStack(contextElement, configRegistry);
- if (labels.hasLabel(GridRegion.COLUMN_HEADER)) {
- return getColumnHeaderImage(contextElement, configRegistry);
- } else if (labels.hasLabel(GridRegion.ROW_HEADER)) {
- return getRowHeaderImage(contextElement, configRegistry);
- } else if (labels.hasLabel(GridRegion.BODY)) {
- return getBodyLabelImage(contextElement, configRegistry);
- }
-
- return null;
- }
-
- /**
- *
- * @param cell
- * @param configRegistry
- * @return
- */
- private Image getBodyLabelImage(ILabelProviderCellContextElementWrapper cell, IConfigRegistry configRegistry) {
- return null;
- }
-
- /**
- *
- * @param cell
- * the cell
- * @param configRegistry
- * the config registry
- * @return
- * the image to display in the row
- */
- private Image getRowHeaderImage(ILabelProviderCellContextElementWrapper cell, IConfigRegistry configRegistry) {
- Object representedObjet = cell.getObject();
- if (representedObjet instanceof IAxis && ((IAxis) representedObjet).getElement() instanceof TreeFillingConfiguration) {
- TreeFillingConfiguration conf = (TreeFillingConfiguration) ((IAxis) representedObjet).getElement();
- return getImage(cell, configRegistry, conf.getLabelProviderContext());
- }
- return getImageWithDecoration(cell, configRegistry, Constants.HEADER_LABEL_PROVIDER_CONTEXT);
- }
-
- /**
- *
- * @param contextElement
- * the context element for which we want the decoration
- * @param configRegistry
- * the config registry of the table
- * @param labelproviderContext
- * the label provider context
- * @return
- * the image with decorators to display according to the contextElement
- */
- private Image getImageWithDecoration(final ILabelProviderCellContextElementWrapper contextElement, final IConfigRegistry configRegistry, final String labelproviderContext) {
- Image im = getImage(contextElement, configRegistry, labelproviderContext);
- DecorationService decorationService = configRegistry.getConfigAttribute(NattableConfigAttributes.DECORATION_SERVICE_CONFIG_ATTRIBUTE, DisplayMode.NORMAL, NattableConfigAttributes.DECORATION_SERVICE_ID);
- if (decorationService != null) {
- Object representedObject= AxisUtils.getRepresentedElement(contextElement.getObject());
- if(representedObject!=null){
- List<IPapyrusDecoration> decoration = ((DecorationService) decorationService).getDecorations(representedObject, true);
- if (decoration.size() > 0) {
- return DecorationImageUtils.getDecoratedImage(im, decoration, DecorationImageUtils.SIZE_16_16);
- }
- }
- }
- return im;
- }
-
- /**
- *
- * @param cell
- * the cell
- * @param configRegistry
- * the config registry
- * @param labelproviderContext
- * the context to used to find the label provider
- * @return
- */
- private Image getImage(ILabelProviderCellContextElementWrapper contextElement, IConfigRegistry configRegistry, String labelproviderContext) {
- Image image = null;
- LabelProviderService serv = configRegistry.getConfigAttribute(NattableConfigAttributes.LABEL_PROVIDER_SERVICE_CONFIG_ATTRIBUTE, DisplayMode.NORMAL, NattableConfigAttributes.LABEL_PROVIDER_SERVICE_ID);
- ILabelProvider labelProvider = serv.getLabelProvider(labelproviderContext, contextElement);
- if (labelProvider != null) {
- image = labelProvider.getImage(contextElement);
- } else {
- Object value = contextElement.getObject();
- labelProvider = serv.getLabelProvider(labelproviderContext, value);
- if (labelProvider != null) {
- image = labelProvider.getImage(value);
- } else {
- labelProvider = serv.getLabelProvider(value);
- if (labelProvider != null) {
- image = labelProvider.getImage(value);
- }
- }
- }
- return image;
- }
-
- /**
- *
- * @param cell
- * the cell
- * @param configRegistry
- * the config registry
- * @return
- * the image to display for the header
- */
- private Image getColumnHeaderImage(ILabelProviderCellContextElementWrapper cell, IConfigRegistry configRegistry) {
- return getImageWithDecoration(cell, configRegistry, Constants.HEADER_LABEL_PROVIDER_CONTEXT);
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2013, 2017 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Bug 515737
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.provider;
+
+import java.util.List;
+
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
+import org.eclipse.nebula.widgets.nattable.grid.GridRegion;
+import org.eclipse.nebula.widgets.nattable.layer.LabelStack;
+import org.eclipse.nebula.widgets.nattable.style.DisplayMode;
+import org.eclipse.papyrus.infra.nattable.manager.table.AbstractNattableWidgetManager;
+import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.IAxis;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.TreeFillingConfiguration;
+import org.eclipse.papyrus.infra.nattable.utils.AxisUtils;
+import org.eclipse.papyrus.infra.nattable.utils.Constants;
+import org.eclipse.papyrus.infra.nattable.utils.ILabelProviderCellContextElementWrapper;
+import org.eclipse.papyrus.infra.nattable.utils.NattableConfigAttributes;
+import org.eclipse.papyrus.infra.services.decoration.DecorationService;
+import org.eclipse.papyrus.infra.services.decoration.util.DecorationImageUtils;
+import org.eclipse.papyrus.infra.services.decoration.util.IPapyrusDecoration;
+import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderService;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * The LabelProvider used in the table
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public class NattableTopLabelProvider extends AbstractNattableCellLabelProvider {
+
+
+ /**
+ *
+ * @param cell
+ * @param configRegistry
+ * @return
+ */
+ protected String getColumnHeaderLabel(final ILabelProviderCellContextElementWrapper cell, final IConfigRegistry configRegistry) {
+ return getLabel(cell, configRegistry, Constants.HEADER_LABEL_PROVIDER_CONTEXT);
+ }
+
+ /**
+ *
+ * @param cell
+ * @param configRegistry
+ * @return
+ */
+ protected String getRowHeaderLabel(final ILabelProviderCellContextElementWrapper cell, final IConfigRegistry configRegistry) {
+ Object representedObjet = cell.getObject();
+ if (representedObjet instanceof IAxis && ((IAxis) representedObjet).getElement() instanceof TreeFillingConfiguration) {
+ TreeFillingConfiguration conf = (TreeFillingConfiguration) ((IAxis) representedObjet).getElement();
+ return getLabel(cell, configRegistry, conf.getLabelProviderContext());
+ }
+ return getLabel(cell, configRegistry, Constants.HEADER_LABEL_PROVIDER_CONTEXT);
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.provider.AbstractNattableCellLabelProvider#getText(java.lang.Object)
+ *
+ * @param element
+ * @return
+ */
+ @Override
+ public String getText(Object element) {
+ final ILabelProviderCellContextElementWrapper contextElement = (ILabelProviderCellContextElementWrapper) element;
+ final IConfigRegistry configRegistry = contextElement.getConfigRegistry();
+ final LabelStack labels = getLabelStack(contextElement, configRegistry);
+ if (labels.hasLabel(GridRegion.FILTER_ROW)) {
+ return getBodyLabel(contextElement, configRegistry);
+ }
+ if (labels.hasLabel(GridRegion.COLUMN_HEADER)) {
+ return getColumnHeaderLabel(contextElement, configRegistry);
+ } else if (labels.hasLabel(GridRegion.ROW_HEADER)) {
+ return getRowHeaderLabel(contextElement, configRegistry);
+ } else if (labels.hasLabel(GridRegion.BODY) || labels.hasLabel(GridRegion.FILTER_ROW)) {
+ return getBodyLabel(contextElement, configRegistry);
+ }
+ Object value = contextElement.getObject();
+ if (value != null) {
+ return value.toString();
+ }
+ return ""; //$NON-NLS-1$
+ }
+
+ /**
+ *
+ * @param cell
+ * @param configRegistry
+ * @return
+ */
+ protected LabelStack getLabelStack(final ILabelProviderCellContextElementWrapper contextElement, final IConfigRegistry configRegistry) {
+ LabelStack labels = contextElement.getConfigLabels();
+ if (labels.getLabels().isEmpty()) {
+ // in case of copy, we don't have the label
+ final INattableModelManager manager = configRegistry.getConfigAttribute(NattableConfigAttributes.NATTABLE_MODEL_MANAGER_CONFIG_ATTRIBUTE, DisplayMode.NORMAL, NattableConfigAttributes.NATTABLE_MODEL_MANAGER_ID);
+ labels = ((AbstractNattableWidgetManager) manager).getGridLayer().getBodyLayer().getConfigLabelsByPosition(contextElement.getColumnPosition(), contextElement.getRowPosition());
+ }
+ return labels;
+ }
+
+ /**
+ *
+ * @param cell
+ * @param configRegistry
+ * @param labelproviderContext
+ * @return
+ */
+ protected String getLabel(final ILabelProviderCellContextElementWrapper contextElement, final IConfigRegistry configRegistry, final String labelproviderContext) {
+ String txt = ""; //$NON-NLS-1$
+ // Object value = cell.getDataValue();
+ // final ILabelProviderContextElement contextElement = new LabelProviderCellContextElement(cell, configRegistry);
+ LabelProviderService serv = configRegistry.getConfigAttribute(NattableConfigAttributes.LABEL_PROVIDER_SERVICE_CONFIG_ATTRIBUTE, DisplayMode.NORMAL, NattableConfigAttributes.LABEL_PROVIDER_SERVICE_ID);
+ ILabelProvider labelProvider = serv.getLabelProvider(labelproviderContext, contextElement);
+ if (labelProvider != null) {
+ txt = labelProvider.getText(contextElement);
+ } else {
+ labelProvider = serv.getLabelProvider(labelproviderContext, contextElement.getObject());
+ if (labelProvider != null) {
+ txt = labelProvider.getText(contextElement.getObject());
+ } else {
+ labelProvider = serv.getLabelProvider(contextElement.getObject());
+ if (labelProvider != null) {
+ txt = labelProvider.getText(contextElement.getObject());
+ } else {
+ txt = contextElement.getObject().toString();
+ }
+ }
+ }
+ return txt;
+ }
+
+ /**
+ *
+ * @param cellWrapperContextElement
+ * @param configRegistry
+ * @return
+ */
+ protected String getBodyLabel(final ILabelProviderCellContextElementWrapper cellWrapperContextElement, final IConfigRegistry configRegistry) {// Body or data grid?
+ return getLabel(cellWrapperContextElement, configRegistry, Constants.BODY_LABEL_PROVIDER_CONTEXT);
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.provider.AbstractNattableCellLabelProvider#accept(java.lang.Object)
+ *
+ * @param element
+ * @return
+ */
+ @Override
+ public boolean accept(Object element) {
+ return element instanceof ILabelProviderCellContextElementWrapper;
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.provider.AbstractNattableCellLabelProvider#getImage(java.lang.Object)
+ *
+ * @param element
+ * @return
+ */
+ @Override
+ public Image getImage(Object element) {
+ final ILabelProviderCellContextElementWrapper contextElement = (ILabelProviderCellContextElementWrapper) element;
+ Object object = contextElement.getObject();
+ String labelProviderContextId = null;
+ final IConfigRegistry configRegistry = contextElement.getConfigRegistry();
+ if (object instanceof IAxis) {
+ if (((IAxis) object).getElement() instanceof TreeFillingConfiguration) {
+ TreeFillingConfiguration conf = (TreeFillingConfiguration) ((IAxis) object).getElement();
+ labelProviderContextId = conf.getLabelProviderContext();
+ return getImage(contextElement, configRegistry, labelProviderContextId);
+ }
+ if (((IAxis) object).getManager() == null) {
+ return null;
+ }
+ labelProviderContextId = ((IAxis) object).getManager().getLabelProviderContext();
+ if (Constants.HEADER_LABEL_PROVIDER_CONTEXT.equals(labelProviderContextId)) {
+ return getImageWithDecoration(contextElement, configRegistry, labelProviderContextId);
+ }
+ return getImage(contextElement, configRegistry, labelProviderContextId);
+ }
+ final LabelStack labels = getLabelStack(contextElement, configRegistry);
+ if (labels.hasLabel(GridRegion.COLUMN_HEADER)) {
+ return getColumnHeaderImage(contextElement, configRegistry);
+ } else if (labels.hasLabel(GridRegion.ROW_HEADER)) {
+ return getRowHeaderImage(contextElement, configRegistry);
+ } else if (labels.hasLabel(GridRegion.BODY)) {
+ return getBodyLabelImage(contextElement, configRegistry);
+ }
+
+ return null;
+ }
+
+ /**
+ *
+ * @param cell
+ * @param configRegistry
+ * @return
+ */
+ private Image getBodyLabelImage(ILabelProviderCellContextElementWrapper cell, IConfigRegistry configRegistry) {
+ Image image = null;
+ final LabelProviderService labelService = configRegistry.getConfigAttribute(NattableConfigAttributes.LABEL_PROVIDER_SERVICE_CONFIG_ATTRIBUTE, DisplayMode.NORMAL, NattableConfigAttributes.LABEL_PROVIDER_SERVICE_ID);
+
+ final Object value = cell.getObject();
+ if (null != value) {
+ ILabelProvider labelProvider = labelService.getLabelProvider(value);
+ if (null != labelProvider) {
+ image = labelProvider.getImage(value);
+ }
+ }
+
+ return image;
+ }
+
+ /**
+ *
+ * @param cell
+ * the cell
+ * @param configRegistry
+ * the config registry
+ * @return
+ * the image to display in the row
+ */
+ private Image getRowHeaderImage(ILabelProviderCellContextElementWrapper cell, IConfigRegistry configRegistry) {
+ Object representedObjet = cell.getObject();
+ if (representedObjet instanceof IAxis && ((IAxis) representedObjet).getElement() instanceof TreeFillingConfiguration) {
+ TreeFillingConfiguration conf = (TreeFillingConfiguration) ((IAxis) representedObjet).getElement();
+ return getImage(cell, configRegistry, conf.getLabelProviderContext());
+ }
+ return getImageWithDecoration(cell, configRegistry, Constants.HEADER_LABEL_PROVIDER_CONTEXT);
+ }
+
+ /**
+ *
+ * @param contextElement
+ * the context element for which we want the decoration
+ * @param configRegistry
+ * the config registry of the table
+ * @param labelproviderContext
+ * the label provider context
+ * @return
+ * the image with decorators to display according to the contextElement
+ */
+ private Image getImageWithDecoration(final ILabelProviderCellContextElementWrapper contextElement, final IConfigRegistry configRegistry, final String labelproviderContext) {
+ Image im = getImage(contextElement, configRegistry, labelproviderContext);
+ DecorationService decorationService = configRegistry.getConfigAttribute(NattableConfigAttributes.DECORATION_SERVICE_CONFIG_ATTRIBUTE, DisplayMode.NORMAL, NattableConfigAttributes.DECORATION_SERVICE_ID);
+ if (decorationService != null) {
+ Object representedObject = AxisUtils.getRepresentedElement(contextElement.getObject());
+ if (representedObject != null) {
+ List<IPapyrusDecoration> decoration = ((DecorationService) decorationService).getDecorations(representedObject, true);
+ if (decoration.size() > 0) {
+ return DecorationImageUtils.getDecoratedImage(im, decoration, DecorationImageUtils.SIZE_16_16);
+ }
+ }
+ }
+ return im;
+ }
+
+ /**
+ *
+ * @param cell
+ * the cell
+ * @param configRegistry
+ * the config registry
+ * @param labelproviderContext
+ * the context to used to find the label provider
+ * @return
+ */
+ private Image getImage(ILabelProviderCellContextElementWrapper contextElement, IConfigRegistry configRegistry, String labelproviderContext) {
+ Image image = null;
+ LabelProviderService serv = configRegistry.getConfigAttribute(NattableConfigAttributes.LABEL_PROVIDER_SERVICE_CONFIG_ATTRIBUTE, DisplayMode.NORMAL, NattableConfigAttributes.LABEL_PROVIDER_SERVICE_ID);
+ ILabelProvider labelProvider = serv.getLabelProvider(labelproviderContext, contextElement);
+ if (labelProvider != null) {
+ image = labelProvider.getImage(contextElement);
+ } else {
+ Object value = contextElement.getObject();
+ labelProvider = serv.getLabelProvider(labelproviderContext, value);
+ if (labelProvider != null) {
+ image = labelProvider.getImage(value);
+ } else {
+ labelProvider = serv.getLabelProvider(value);
+ if (labelProvider != null) {
+ image = labelProvider.getImage(value);
+ }
+ }
+ }
+ return image;
+ }
+
+ /**
+ *
+ * @param cell
+ * the cell
+ * @param configRegistry
+ * the config registry
+ * @return
+ * the image to display for the header
+ */
+ private Image getColumnHeaderImage(ILabelProviderCellContextElementWrapper cell, IConfigRegistry configRegistry) {
+ return getImageWithDecoration(cell, configRegistry, Constants.HEADER_LABEL_PROVIDER_CONTEXT);
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/AxisUtils.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/AxisUtils.java
index 98550fe6687..29c3c905530 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/AxisUtils.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/AxisUtils.java
@@ -1,127 +1,169 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.utils;
-
-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.nattableaxis.IAxis;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.IdAxis;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.AbstractAxisProvider;
-
-/**
- * Common methods for axis management
- *
- * @author Vincent Lorenzo
- *
- */
-public class AxisUtils {
-
- private AxisUtils() {
- // to prevent instanciation
- }
-
- /**
- * This regex allows to find all word character (letters + numbers)+ the whitespace
- */
- public static final String REGEX = "[^\\w\\s]"; //$NON-NLS-1$
-
- /**
- * This methods avoid to duplicate these some lines
- *
- * @param axisElement
- * an axis element
- * @return
- * if the axis element is a String returns it and if the axis element is an instance of IdAxis, returns the String represented by this
- * axis
- */
- public static final String getPropertyId(final Object axisElement) {
- String id = null;
- if (axisElement instanceof IdAxis) {
- id = ((IdAxis) axisElement).getElement();
- } else if (axisElement instanceof String) {
- id = (String) axisElement;
- }
- return id;
- }
-
- /**
- *
- * @param axisElement
- * an axis element
- * @return
- * if axisElement is an IAxis, we return the element represented by the IAxis using IAxis.getElement() else we return the element itself
- */
- public static final Object getRepresentedElement(final Object axisElement) {
- Object representedElement;
- if (axisElement instanceof IAxis) {
- representedElement = ((IAxis) axisElement).getElement();
- } else {
- representedElement = axisElement;
- }
- return representedElement;
- }
-
- /**
- *
- * @param table
- * a table
- * @return
- * the axismanager used for rows, managing the invert axis
- */
- public static final AbstractAxisProvider getAxisProviderUsedForRows(final Table table) {
- AbstractAxisProvider provider = table.getCurrentRowAxisProvider();
- if (table.isInvertAxis()) {
- provider = table.getCurrentColumnAxisProvider();
- }
- return provider;
- }
-
- /**
- *
- * @param table
- * a table
- * @return
- * the axismanager used for columns, managing the invert axis
- */
- public static final AbstractAxisProvider getAxisProviderUsedForColumns(final Table table) {
- AbstractAxisProvider provider = table.getCurrentColumnAxisProvider();
- if (table.isInvertAxis()) {
- provider = table.getCurrentRowAxisProvider();
- }
- return provider;
- }
-
- /**
- *
- * @param manager
- * a table manager
- * @return
- * the axismanager used for rows, managing the invert axis
- */
- public static final AbstractAxisProvider getAxisProviderUsedForRows(final INattableModelManager manager) {
- return getAxisProviderUsedForRows(manager.getTable());
- }
-
- /**
- *
- * @param manager
- * a table manager
- * @return
- * the axismanager used for columns, managing the invert axis
- */
- public static final AbstractAxisProvider getAxisProviderUsedForColumns(final INattableModelManager manager) {
- return getAxisProviderUsedForColumns(manager.getTable());
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2013, 2017 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Bug 515737
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.utils;
+
+import java.util.Set;
+
+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.nattableaxis.IAxis;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.IdAxis;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.AbstractAxisProvider;
+
+/**
+ * Common methods for axis management
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public class AxisUtils {
+
+ private AxisUtils() {
+ // to prevent instanciation
+ }
+
+ /**
+ * This regex allows to find all word character (letters + numbers)+ the whitespace
+ */
+ public static final String REGEX = "[^\\w\\s]"; //$NON-NLS-1$
+
+ /**
+ * This methods avoid to duplicate these some lines
+ *
+ * @param axisElement
+ * an axis element
+ * @return
+ * if the axis element is a String returns it and if the axis element is an instance of IdAxis, returns the String represented by this
+ * axis
+ */
+ public static final String getPropertyId(final Object axisElement) {
+ String id = null;
+ if (axisElement instanceof IdAxis) {
+ id = ((IdAxis) axisElement).getElement();
+ } else if (axisElement instanceof String) {
+ id = (String) axisElement;
+ }
+ return id;
+ }
+
+ /**
+ *
+ * @param axisElement
+ * an axis element
+ * @return
+ * if axisElement is an IAxis, we return the element represented by the IAxis using IAxis.getElement() else we return the element itself
+ */
+ public static final Object getRepresentedElement(final Object axisElement) {
+ Object representedElement;
+ if (axisElement instanceof IAxis) {
+ representedElement = ((IAxis) axisElement).getElement();
+ } else {
+ representedElement = axisElement;
+ }
+ return representedElement;
+ }
+
+ /**
+ *
+ * @param table
+ * a table
+ * @return
+ * the axismanager used for rows, managing the invert axis
+ */
+ public static final AbstractAxisProvider getAxisProviderUsedForRows(final Table table) {
+ AbstractAxisProvider provider = table.getCurrentRowAxisProvider();
+ if (table.isInvertAxis()) {
+ provider = table.getCurrentColumnAxisProvider();
+ }
+ return provider;
+ }
+
+ /**
+ *
+ * @param table
+ * a table
+ * @return
+ * the axismanager used for columns, managing the invert axis
+ */
+ public static final AbstractAxisProvider getAxisProviderUsedForColumns(final Table table) {
+ AbstractAxisProvider provider = table.getCurrentColumnAxisProvider();
+ if (table.isInvertAxis()) {
+ provider = table.getCurrentRowAxisProvider();
+ }
+ return provider;
+ }
+
+ /**
+ *
+ * @param manager
+ * a table manager
+ * @return
+ * the axismanager used for rows, managing the invert axis
+ */
+ public static final AbstractAxisProvider getAxisProviderUsedForRows(final INattableModelManager manager) {
+ return getAxisProviderUsedForRows(manager.getTable());
+ }
+
+ /**
+ *
+ * @param manager
+ * a table manager
+ * @return
+ * the axismanager used for columns, managing the invert axis
+ */
+ public static final AbstractAxisProvider getAxisProviderUsedForColumns(final INattableModelManager manager) {
+ return getAxisProviderUsedForColumns(manager.getTable());
+ }
+
+ /**
+ * Return the index of the unique selected axis (column or row).
+ * If not only 1 axis is selected, return -1.
+ *
+ * @param nattableManager
+ * The nattable manager
+ * @return The index of the unique selected axis or -1 otherwise
+ * @since 5.0
+ */
+ public static int getUniqueSelectedAxisIndex(final INattableModelManager nattableManager) {
+
+ int axisIndex = -1;
+
+ if (null != nattableManager) {
+ final TableSelectionWrapper tableSelectionWrapper = nattableManager.getAdapter(TableSelectionWrapper.class);
+ if (null != tableSelectionWrapper && null != nattableManager.getTable()) {
+ final Table table = nattableManager.getTable();
+
+ int numSelectedAxis = 0;
+ Set<Integer> keySet = null;
+
+ // If the table is already inverted, handle with the number of fully selected rows
+ // otherwise, handle with the number of fully selected columns
+ if (table.isInvertAxis()) {
+ numSelectedAxis = tableSelectionWrapper.getFullySelectedRows().size();
+ keySet = tableSelectionWrapper.getFullySelectedRows().keySet();
+ } else {
+ numSelectedAxis = tableSelectionWrapper.getFullySelectedColumns().size();
+ keySet = tableSelectionWrapper.getFullySelectedColumns().keySet();
+ }
+
+ // Just continue to check the upper bound if there is only one selected axis
+ if (1 == numSelectedAxis) {
+ // Get the axis index from the key set
+ axisIndex = (Integer) keySet.toArray()[0];
+ }
+ }
+ }
+
+ return axisIndex;
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/NamedStyleConstants.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/NamedStyleConstants.java
index 0a7dae1227a..e21cf3abe80 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/NamedStyleConstants.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/NamedStyleConstants.java
@@ -9,7 +9,7 @@
* Contributors:
* Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr - Initial API and implementation
* Nicolas FAUVERGUE(ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 504077
- * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Bug 459220
+ * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Bug 459220, 515737
*****************************************************************************/
package org.eclipse.papyrus.infra.nattable.utils;
@@ -141,13 +141,29 @@ public class NamedStyleConstants {
/**
* A {@link BooleanValueStyle} used to enable wrap text in the NatTable.
+ *
* @since 3.0
*/
public static final String WRAP_TEXT = "wrapText"; //$NON-NLS-1$
/**
* A {@link BooleanValueStyle} used to enable auto-resize cell height in the NatTable.
+ *
* @since 3.0
*/
public static final String AUTO_RESIZE_CELL_HEIGHT = "autoResizeCellHeight"; //$NON-NLS-1$
+
+ /**
+ * A {@link BooleanValueStyle} used to display list on separated rows in the NatTable.
+ *
+ * @since 4.0
+ */
+ public static final String DISPLAY_LIST_ON_SEPARATED_ROWS = "displayListOnSeparatedRows"; //$NON-NLS-1$
+
+ /**
+ * A default value used to enable the display list on separated rows function in the NatTable.
+ * It is disable by default.
+ * @since 5.0
+ */
+ public static final boolean ENABLE_DISPLAY_LIST_ON_SEPARATED_ROWS = false;
}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/NattableWidgetPropertyTester.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/NattableWidgetPropertyTester.java
index f86fb0c6139..0b41def9f22 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/NattableWidgetPropertyTester.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/NattableWidgetPropertyTester.java
@@ -1,101 +1,154 @@
-/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.utils;
-
-import org.eclipse.core.expressions.PropertyTester;
-import org.eclipse.nebula.widgets.nattable.NatTable;
-import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.ISlaveAxisProvider;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.DisplayStyle;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-
-
-public class NattableWidgetPropertyTester extends PropertyTester {
-
- public static final String IS_NATTABLE_WIDGET = "isNattableWidget"; //$NON-NLS-1$
-
- private static final String HAS_FEATURE_ROW_HEADER_CONFIGURATION = "hasFeatureRowHeaderConfiguration"; //$NON-NLS-1$
-
- private static final String HAS_FEATURE_COLUMN_HEADER_CONFIGURATION = "hasFeatureColumnHeaderConfiguration"; //$NON-NLS-1$
-
- private static final String HAS_SLAVE_ROWS_AXIS_PROVIDER = "hasSlaveRowAxisProvider"; //$NON-NLS-1$
-
- private static final String HAS_SLAVE_COLUMNS_AXIS_PROVIDER = "hasSlaveColumnAxisProvider"; //$NON-NLS-1$
-
- private static final String CAN_INVERT_AXIS = "canInvertAxis";//$NON-NLS-1$
-
- private static final String IS_HIERARCHIC_TABLE = "isHierarchicTable"; //$NON-NLS-1$
-
- @Override
- public boolean test(final Object receiver, final String property, final Object[] args, final Object expectedValue) {
- final INattableModelManager manager = getNattableModelManager();
- if (IS_NATTABLE_WIDGET.equals(property) && expectedValue instanceof Boolean) {
- return expectedValue.equals(null != manager) && ((!(Boolean)expectedValue) || manager.getAdapter(NatTable.class).isFocusControl());
- }
- if (manager != null && expectedValue instanceof Boolean) {
- if (HAS_FEATURE_ROW_HEADER_CONFIGURATION.equals(property)) {
- LabelConfigurationManagementUtils.getRowFeatureLabelConfigurationInTable(manager.getTable());
- return expectedValue.equals(LabelConfigurationManagementUtils.hasRowFeatureLabelConfiguration(manager.getTable()));
- } else if (HAS_FEATURE_COLUMN_HEADER_CONFIGURATION.equals(property)) {
- return expectedValue.equals(LabelConfigurationManagementUtils.hasColumnFeatureLabelConfiguration(manager.getTable()));
- } else if (HAS_SLAVE_COLUMNS_AXIS_PROVIDER.equals(property)) {
- return expectedValue.equals(AxisUtils.getAxisProviderUsedForColumns(manager) instanceof ISlaveAxisProvider);
- } else if (HAS_SLAVE_ROWS_AXIS_PROVIDER.equals(property)) {
- return expectedValue.equals(AxisUtils.getAxisProviderUsedForRows(manager) instanceof ISlaveAxisProvider);
- } else if (CAN_INVERT_AXIS.equals(property)) {
- return expectedValue.equals(manager.canInvertAxis());
- } else if (IS_HIERARCHIC_TABLE.equals(property)) {
- return expectedValue.equals(isHierarchicTable(manager));
- }
- }
- return false;
- }
-
- /**
- * @param table
- * @return
- */
- public static final boolean isHierarchicTable(final INattableModelManager tableManager) {
- final DisplayStyle style = TableHelper.getTableDisplayStyle(tableManager);
- return (DisplayStyle.HIERARCHIC_SINGLE_TREE_COLUMN.equals(style) || DisplayStyle.HIERARCHIC_MULTI_TREE_COLUMN.equals(style));
- }
-
- /**
- *
- * @return
- * the current nattable model manager or <code>null</code> if not found
- */
- protected INattableModelManager getNattableModelManager() {
- final IWorkbench workbench = PlatformUI.getWorkbench();
- IWorkbenchPart current = null;
- if (workbench != null) {
- final IWorkbenchWindow activeWorkbench = workbench.getActiveWorkbenchWindow();
- if (activeWorkbench != null) {
- final IWorkbenchPage activePage = activeWorkbench.getActivePage();
- if (activePage != null) {
- current = activePage.getActivePart();
- }
- }
- }
-
- if (current != null) {
- return (INattableModelManager) current.getAdapter(INattableModelManager.class);
- }
- return null;
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2012, 2017 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Bug 515737
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.utils;
+
+import org.eclipse.core.expressions.PropertyTester;
+import org.eclipse.emf.ecore.ETypedElement;
+import org.eclipse.nebula.widgets.nattable.NatTable;
+import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.EOperationAxis;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.IAxis;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.AbstractAxisProvider;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.ISlaveAxisProvider;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.DisplayStyle;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+
+
+public class NattableWidgetPropertyTester extends PropertyTester {
+
+ public static final String IS_NATTABLE_WIDGET = "isNattableWidget"; //$NON-NLS-1$
+
+ /**
+ * The unbounded multiplicity number.
+ *
+ * @since 4.0
+ */
+ protected static final int UNBOUNDED_MULTIPLICITY = -1;
+
+ /**
+ * The string to test if one axis with multiple values is selected.
+ *
+ * @since 4.0
+ */
+ protected static final String IS_ONE_MULTIPLE_VALUES_AXIS_SELECTED = "isOneMultipleValuesAxisSelected"; //$NON-NLS-1$
+
+ private static final String HAS_FEATURE_ROW_HEADER_CONFIGURATION = "hasFeatureRowHeaderConfiguration"; //$NON-NLS-1$
+
+ private static final String HAS_FEATURE_COLUMN_HEADER_CONFIGURATION = "hasFeatureColumnHeaderConfiguration"; //$NON-NLS-1$
+
+ private static final String HAS_SLAVE_ROWS_AXIS_PROVIDER = "hasSlaveRowAxisProvider"; //$NON-NLS-1$
+
+ private static final String HAS_SLAVE_COLUMNS_AXIS_PROVIDER = "hasSlaveColumnAxisProvider"; //$NON-NLS-1$
+
+ private static final String CAN_INVERT_AXIS = "canInvertAxis";//$NON-NLS-1$
+
+ private static final String IS_HIERARCHIC_TABLE = "isHierarchicTable"; //$NON-NLS-1$
+
+ @Override
+ public boolean test(final Object receiver, final String property, final Object[] args, final Object expectedValue) {
+ final INattableModelManager manager = getNattableModelManager();
+
+ if (IS_NATTABLE_WIDGET.equals(property) && expectedValue instanceof Boolean) {
+ return expectedValue.equals(null != manager) && ((!(Boolean) expectedValue) || manager.getAdapter(NatTable.class).isFocusControl());
+ }
+ if (manager != null && expectedValue instanceof Boolean) {
+ if (HAS_FEATURE_ROW_HEADER_CONFIGURATION.equals(property)) {
+ LabelConfigurationManagementUtils.getRowFeatureLabelConfigurationInTable(manager.getTable());
+ return expectedValue.equals(LabelConfigurationManagementUtils.hasRowFeatureLabelConfiguration(manager.getTable()));
+ } else if (HAS_FEATURE_COLUMN_HEADER_CONFIGURATION.equals(property)) {
+ return expectedValue.equals(LabelConfigurationManagementUtils.hasColumnFeatureLabelConfiguration(manager.getTable()));
+ } else if (HAS_SLAVE_COLUMNS_AXIS_PROVIDER.equals(property)) {
+ return expectedValue.equals(AxisUtils.getAxisProviderUsedForColumns(manager) instanceof ISlaveAxisProvider);
+ } else if (HAS_SLAVE_ROWS_AXIS_PROVIDER.equals(property)) {
+ return expectedValue.equals(AxisUtils.getAxisProviderUsedForRows(manager) instanceof ISlaveAxisProvider);
+ } else if (CAN_INVERT_AXIS.equals(property)) {
+ return expectedValue.equals(manager.canInvertAxis());
+ } else if (IS_HIERARCHIC_TABLE.equals(property)) {
+ return expectedValue.equals(isHierarchicTable(manager));
+ } else if (IS_ONE_MULTIPLE_VALUES_AXIS_SELECTED.equals(property)) {
+
+ // Get the selected axis index
+ final int axisIndex = AxisUtils.getUniqueSelectedAxisIndex(manager);
+
+ // Always get the column axis provider for invert or non-invert table
+ final AbstractAxisProvider axisProvider = manager.getTable().getCurrentColumnAxisProvider();
+
+ // If the index is in range
+ if (null != axisProvider && null != axisProvider.getAxis() && 0 <= axisIndex && axisIndex < axisProvider.getAxis().size()) {
+ final IAxis selectedAxis = axisProvider.getAxis().get(axisIndex);
+
+ // EOperationAxis is not supported in this moment as there is no cell editor configuration for operation axis
+ if (!(selectedAxis instanceof EOperationAxis)) {
+ // Get the selected axis element
+ final Object axisElement = selectedAxis.getElement();
+
+ // Check its upper bound if typed element can be casted from the axis element
+ if (axisElement instanceof ETypedElement) {
+ final ETypedElement typedElement = (ETypedElement) axisElement;
+ return expectedValue.equals(isMultipleValues(typedElement.getUpperBound()));
+ }
+ }
+ }
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * @param table
+ * @return
+ */
+ public static final boolean isHierarchicTable(final INattableModelManager tableManager) {
+ final DisplayStyle style = TableHelper.getTableDisplayStyle(tableManager);
+ return (DisplayStyle.HIERARCHIC_SINGLE_TREE_COLUMN.equals(style) || DisplayStyle.HIERARCHIC_MULTI_TREE_COLUMN.equals(style));
+ }
+
+ /**
+ *
+ * @return
+ * the current nattable model manager or <code>null</code> if not found
+ */
+ protected INattableModelManager getNattableModelManager() {
+ final IWorkbench workbench = PlatformUI.getWorkbench();
+ IWorkbenchPart current = null;
+ if (workbench != null) {
+ final IWorkbenchWindow activeWorkbench = workbench.getActiveWorkbenchWindow();
+ if (activeWorkbench != null) {
+ final IWorkbenchPage activePage = activeWorkbench.getActivePage();
+ if (activePage != null) {
+ current = activePage.getActivePart();
+ }
+ }
+ }
+
+ if (current != null) {
+ return current.getAdapter(INattableModelManager.class);
+ }
+ return null;
+ }
+
+ /**
+ * @param upperBound
+ * The upper bound to be checked
+ * @return <code>true</code> if upper bound > 1 or unbounded, <code>false</code> otherwise
+ * @since 4.0
+ */
+ protected boolean isMultipleValues(final int upperBound) {
+ return (upperBound > 1) || (UNBOUNDED_MULTIPLICITY == upperBound);
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/StyleUtils.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/StyleUtils.java
index 98cba00084f..ebbcb219d43 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/StyleUtils.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/StyleUtils.java
@@ -8,7 +8,7 @@
*
* Contributors:
* CEA LIST - Initial API and implementation
- * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Bug 459220
+ * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Bug 459220, 515737
*****************************************************************************/
package org.eclipse.papyrus.infra.nattable.utils;
@@ -145,6 +145,32 @@ public class StyleUtils {
}
/**
+ * Get the value of a boolean named style in a given styled element.
+ *
+ * @param styledElement
+ * The given styled element
+ * @param namedStyleString
+ * The named style string
+ * @param defaultValue
+ * The default value if the boolean value style does not exist
+ * @return The boolean value of the named style
+ * @since 4.0
+ */
+ public static boolean getBooleanNamedStyleValue(final StyledElement styledElement, final String namedStyleString, final boolean defaultValue) {
+
+ if (null != styledElement && null != namedStyleString) {
+ // Get the relevant boolean named style
+ final BooleanValueStyle booleanNamedStyle = (BooleanValueStyle) styledElement.getNamedStyle(NattablestylePackage.eINSTANCE.getBooleanValueStyle(), namedStyleString);
+
+ if (null != booleanNamedStyle) {
+ return booleanNamedStyle.isBooleanValue();
+ }
+ }
+
+ return defaultValue;
+ }
+
+ /**
* Get the value of a boolean named style in a given table.
*
* @param table
@@ -173,22 +199,22 @@ public class StyleUtils {
}
/**
- * Set the value of a boolean named style in a given table.
+ * Set the value of a boolean named style in a given styled element.
*
* @param editingDomain
* The editing domain
- * @param table
- * The given papyrus table
+ * @param styledElement
+ * The given styled element
* @param namedStyleString
* The named style string
* @param value
* The boolean value to be set
- * @since 3.0
+ * @since 4.0
*/
- public static void setBooleanNamedStyle(final TransactionalEditingDomain editingDomain, final Table table, final String namedStyleString, final boolean value) {
- if (null != editingDomain && null != table && null != namedStyleString) {
- // Get the relevant boolean named style from the table
- BooleanValueStyle booleanNamedStyle = (BooleanValueStyle) table.getNamedStyle(NattablestylePackage.eINSTANCE.getBooleanValueStyle(), namedStyleString);
+ public static void setBooleanNamedStyle(final TransactionalEditingDomain editingDomain, final StyledElement styledElement, final String namedStyleString, final boolean value) {
+ if (null != editingDomain && null != styledElement && null != namedStyleString) {
+ // Get the relevant boolean named style from the style element
+ BooleanValueStyle booleanNamedStyle = (BooleanValueStyle) styledElement.getNamedStyle(NattablestylePackage.eINSTANCE.getBooleanValueStyle(), namedStyleString);
if (null != booleanNamedStyle) {
IElementEditService editService = ElementEditServiceUtils.getCommandProvider(booleanNamedStyle);
@@ -208,18 +234,18 @@ public class StyleUtils {
*
* @param editingDomain
* The editing domain
- * @param table
- * The given papyrus table
+ * @param styledElement
+ * The given styled element
* @param namedStyleString
* The named style string
* @param defaultValue
* The default value to be set
- * @since 3.0
+ * @since 4.0
*/
- public static void initBooleanNamedStyle(final TransactionalEditingDomain editingDomain, final Table table, final String namedStyleString, final boolean defaultValue) {
- if (null != editingDomain && null != table && null != namedStyleString) {
+ public static void initBooleanNamedStyle(final TransactionalEditingDomain editingDomain, final StyledElement styledElement, final String namedStyleString, final boolean defaultValue) {
+ if (null != editingDomain && null != styledElement && null != namedStyleString) {
// Get the relevant named style
- BooleanValueStyle namedStyle = (BooleanValueStyle) table.getNamedStyle(NattablestylePackage.eINSTANCE.getBooleanValueStyle(), namedStyleString);
+ BooleanValueStyle namedStyle = (BooleanValueStyle) styledElement.getNamedStyle(NattablestylePackage.eINSTANCE.getBooleanValueStyle(), namedStyleString);
// If it does not exist, initialize it, otherwise do nothing
if (null == namedStyle) {
@@ -228,11 +254,45 @@ public class StyleUtils {
namedStyle.setBooleanValue(defaultValue);
// Add the new boolean style
- List<Style> styleList = new ArrayList<Style>(table.getStyles());
+ List<Style> styleList = new ArrayList<Style>(styledElement.getStyles());
styleList.add(namedStyle);
- IElementEditService editService = ElementEditServiceUtils.getCommandProvider(table);
- SetRequest request = new SetRequest(editingDomain, table, NattablestylePackage.eINSTANCE.getStyledElement_Styles(), styleList);
+ IElementEditService editService = ElementEditServiceUtils.getCommandProvider(styledElement);
+ SetRequest request = new SetRequest(editingDomain, styledElement, NattablestylePackage.eINSTANCE.getStyledElement_Styles(), styleList);
+ if (editService.canEdit(request)) {
+ Command command = GMFtoEMFCommandWrapper.wrap(editService.getEditCommand(request));
+ editingDomain.getCommandStack().execute(command);
+ }
+ }
+ }
+ }
+
+ /**
+ * Delete the given named style if it is already created.
+ * If the named style does not exist, do nothing.
+ *
+ * @param editingDomain
+ * The editing domain
+ * @param styledElement
+ * The given styled element to be deleted
+ * @param namedStyleString
+ * The named style string
+ * @since 4.0
+ */
+ public static void deleteBooleanNamedStyle(final TransactionalEditingDomain editingDomain, final StyledElement styledElement, final String namedStyleString) {
+ if (null != editingDomain && null != styledElement && null != namedStyleString) {
+ // Get the relevant named style
+ BooleanValueStyle namedStyle = (BooleanValueStyle) styledElement.getNamedStyle(NattablestylePackage.eINSTANCE.getBooleanValueStyle(), namedStyleString);
+
+ // If it does exist, remove it, otherwise do nothing
+ if (null != namedStyle) {
+
+ // Delete the boolean style
+ List<Style> styleList = new ArrayList<Style>(styledElement.getStyles());
+ styleList.remove(namedStyle);
+
+ IElementEditService editService = ElementEditServiceUtils.getCommandProvider(styledElement);
+ SetRequest request = new SetRequest(editingDomain, styledElement, NattablestylePackage.eINSTANCE.getStyledElement_Styles(), styleList);
if (editService.canEdit(request)) {
Command command = GMFtoEMFCommandWrapper.wrap(editService.getEditCommand(request));
editingDomain.getCommandStack().execute(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 940a0a964ae..cc7d56127f3 100755
--- a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/plugin.xml
+++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/plugin.xml
@@ -283,4 +283,71 @@
type="PapyrusUMLGenericTreeTable">
</configuration>
</extension>
+ <extension
+ point="org.eclipse.ui.menus">
+ <menuContribution
+ allPopups="true"
+ locationURI="popup:org.eclipse.papyrus.infra.nattable.header.columns.menu?after=general.separator">
+ <command
+ commandId="org.eclipse.papyrus.infra.nattable.displaylist.separatedrows.columnheader"
+ label="Display List On Separated Rows"
+ style="toggle">
+ <visibleWhen
+ checkEnabled="true">
+ <and>
+ <with
+ variable="selection">
+ <test
+ forcePluginActivation="true"
+ property="org.eclipse.papyrus.infra.nattable.tester.isNattableWidget"
+ value="true">
+ </test>
+ <test
+ forcePluginActivation="true"
+ property="org.eclipse.papyrus.uml.nattable.tester.isOneMultipleValuesAxisSelected"
+ value="true">
+ </test>
+ </with>
+ </and>
+ </visibleWhen>
+ </command>
+ </menuContribution>
+ <menuContribution
+ allPopups="true"
+ locationURI="popup:org.eclipse.papyrus.infra.nattable.widget.header.rows.menu?after=general.separator">
+ <command
+ commandId="org.eclipse.papyrus.infra.nattable.displaylist.separatedrows.rowheader"
+ label="Display List On Separated Rows"
+ style="toggle">
+ <visibleWhen
+ checkEnabled="true">
+ <and>
+ <with
+ variable="selection">
+ <test
+ forcePluginActivation="true"
+ property="org.eclipse.papyrus.infra.nattable.tester.isNattableWidget"
+ value="true">
+ </test>
+ <test
+ forcePluginActivation="true"
+ property="org.eclipse.papyrus.uml.nattable.tester.isOneMultipleValuesAxisSelected"
+ value="true">
+ </test>
+ </with>
+ </and>
+ </visibleWhen>
+ </command>
+ </menuContribution>
+ </extension>
+ <extension
+ point="org.eclipse.core.expressions.propertyTesters">
+ <propertyTester
+ class="org.eclipse.papyrus.uml.nattable.tester.UMLNattableWidgetPropertyTester"
+ id="org.eclipse.papyrus.uml.nattable.tester"
+ namespace="org.eclipse.papyrus.uml.nattable.tester"
+ properties="isOneMultipleValuesAxisSelected"
+ type="org.eclipse.jface.viewers.IStructuredSelection">
+ </propertyTester>
+ </extension>
</plugin>
diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/config/MultiBooleanCellEditorConfiguration.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/config/MultiBooleanCellEditorConfiguration.java
index c1e66486707..9c79eb45955 100644
--- a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/config/MultiBooleanCellEditorConfiguration.java
+++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/config/MultiBooleanCellEditorConfiguration.java
@@ -1,6 +1,6 @@
/*****************************************************************************
- * Copyright (c) 2015 CEA LIST and others.
- *
+ * Copyright (c) 2015, 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
@@ -8,7 +8,7 @@
*
* Contributors:
* Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
- *
+ * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Bug 515737
*****************************************************************************/
package org.eclipse.papyrus.uml.nattable.config;
@@ -16,10 +16,8 @@ package org.eclipse.papyrus.uml.nattable.config;
import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.EDataType;
import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.nebula.widgets.nattable.config.CellConfigAttributes;
import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes;
-import org.eclipse.nebula.widgets.nattable.painter.cell.TextPainter;
import org.eclipse.nebula.widgets.nattable.style.DisplayMode;
import org.eclipse.papyrus.infra.emf.utils.EMFContants;
import org.eclipse.papyrus.infra.nattable.celleditor.config.ICellAxisConfiguration;
@@ -28,6 +26,7 @@ import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
import org.eclipse.papyrus.infra.nattable.utils.AxisUtils;
import org.eclipse.papyrus.infra.nattable.utils.NattableConfigAttributes;
import org.eclipse.papyrus.infra.tools.util.TypesConstants;
+import org.eclipse.papyrus.uml.nattable.config.utils.CellEditorConfigurationUtils;
import org.eclipse.papyrus.uml.nattable.editor.MultiBooleanCellEditor;
/**
@@ -90,9 +89,10 @@ public class MultiBooleanCellEditorConfiguration implements ICellAxisConfigurati
*/
@Override
public void configureCellEditor(final IConfigRegistry configRegistry, final Object axis, final String configLabel) {
- configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, new TextPainter(), DisplayMode.NORMAL, configLabel);
+ final Object axisElement = AxisUtils.getRepresentedElement(axis);
+ CellEditorConfigurationUtils.configureCellPainter(configRegistry, axis, configLabel);
final INattableModelManager modelManager = configRegistry.getConfigAttribute(NattableConfigAttributes.NATTABLE_MODEL_MANAGER_CONFIG_ATTRIBUTE, DisplayMode.NORMAL, NattableConfigAttributes.NATTABLE_MODEL_MANAGER_ID);
- configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITOR, new MultiBooleanCellEditor(axis, modelManager.getTableAxisElementProvider()), DisplayMode.EDIT, configLabel);
+ configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITOR, new MultiBooleanCellEditor(axisElement, modelManager.getTableAxisElementProvider()), DisplayMode.EDIT, configLabel);
}
}
diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/config/MultiEEnumCellEditorConfiguration.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/config/MultiEEnumCellEditorConfiguration.java
index 7f0b323dd0d..37591061efe 100644
--- a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/config/MultiEEnumCellEditorConfiguration.java
+++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/config/MultiEEnumCellEditorConfiguration.java
@@ -1,6 +1,6 @@
/*****************************************************************************
- * Copyright (c) 2015 CEA LIST and others.
- *
+ * Copyright (c) 2015, 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
@@ -8,7 +8,7 @@
*
* Contributors:
* Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
- *
+ * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Bug 515737
*****************************************************************************/
package org.eclipse.papyrus.uml.nattable.config;
@@ -16,16 +16,15 @@ package org.eclipse.papyrus.uml.nattable.config;
import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.EEnum;
import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.nebula.widgets.nattable.config.CellConfigAttributes;
import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes;
-import org.eclipse.nebula.widgets.nattable.painter.cell.TextPainter;
import org.eclipse.nebula.widgets.nattable.style.DisplayMode;
import org.eclipse.papyrus.infra.nattable.celleditor.config.ICellAxisConfiguration;
import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
import org.eclipse.papyrus.infra.nattable.utils.AxisUtils;
import org.eclipse.papyrus.infra.nattable.utils.NattableConfigAttributes;
+import org.eclipse.papyrus.uml.nattable.config.utils.CellEditorConfigurationUtils;
import org.eclipse.papyrus.uml.nattable.editor.MultiEnumCellEditor;
/**
@@ -85,9 +84,10 @@ public class MultiEEnumCellEditorConfiguration implements ICellAxisConfiguration
*/
@Override
public void configureCellEditor(final IConfigRegistry configRegistry, final Object axis, final String configLabel) {
- configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, new TextPainter(), DisplayMode.NORMAL, configLabel);
+ final Object axisElement = AxisUtils.getRepresentedElement(axis);
+ CellEditorConfigurationUtils.configureCellPainter(configRegistry, axis, configLabel);
final INattableModelManager modelManager = configRegistry.getConfigAttribute(NattableConfigAttributes.NATTABLE_MODEL_MANAGER_CONFIG_ATTRIBUTE, DisplayMode.NORMAL, NattableConfigAttributes.NATTABLE_MODEL_MANAGER_ID);
- configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITOR, new MultiEnumCellEditor(axis, modelManager.getTableAxisElementProvider()), DisplayMode.EDIT, configLabel);
+ configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITOR, new MultiEnumCellEditor(axisElement, modelManager.getTableAxisElementProvider()), DisplayMode.EDIT, configLabel);
}
}
diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/config/MultiIntegerCellEditorConfiguration.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/config/MultiIntegerCellEditorConfiguration.java
index 752f1b31739..8578ff3a9d7 100644
--- a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/config/MultiIntegerCellEditorConfiguration.java
+++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/config/MultiIntegerCellEditorConfiguration.java
@@ -1,6 +1,6 @@
/*****************************************************************************
- * Copyright (c) 2015 CEA LIST and others.
- *
+ * Copyright (c) 2015, 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
@@ -8,7 +8,7 @@
*
* Contributors:
* Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
- *
+ * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Bug 515737
*****************************************************************************/
package org.eclipse.papyrus.uml.nattable.config;
@@ -16,10 +16,8 @@ package org.eclipse.papyrus.uml.nattable.config;
import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.EDataType;
import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.nebula.widgets.nattable.config.CellConfigAttributes;
import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes;
-import org.eclipse.nebula.widgets.nattable.painter.cell.TextPainter;
import org.eclipse.nebula.widgets.nattable.style.DisplayMode;
import org.eclipse.papyrus.infra.emf.utils.EMFContants;
import org.eclipse.papyrus.infra.nattable.celleditor.config.ICellAxisConfiguration;
@@ -28,6 +26,7 @@ import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
import org.eclipse.papyrus.infra.nattable.utils.AxisUtils;
import org.eclipse.papyrus.infra.nattable.utils.NattableConfigAttributes;
import org.eclipse.papyrus.infra.tools.util.TypesConstants;
+import org.eclipse.papyrus.uml.nattable.config.utils.CellEditorConfigurationUtils;
import org.eclipse.papyrus.uml.nattable.editor.MultiIntegerCellEditor;
/**
@@ -90,9 +89,10 @@ public class MultiIntegerCellEditorConfiguration implements ICellAxisConfigurati
*/
@Override
public void configureCellEditor(final IConfigRegistry configRegistry, final Object axis, final String configLabel) {
- configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, new TextPainter(), DisplayMode.NORMAL, configLabel);
+ final Object axisElement = AxisUtils.getRepresentedElement(axis);
+ CellEditorConfigurationUtils.configureCellPainter(configRegistry, axis, configLabel);
final INattableModelManager modelManager = configRegistry.getConfigAttribute(NattableConfigAttributes.NATTABLE_MODEL_MANAGER_CONFIG_ATTRIBUTE, DisplayMode.NORMAL, NattableConfigAttributes.NATTABLE_MODEL_MANAGER_ID);
- configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITOR, new MultiIntegerCellEditor(axis, modelManager.getTableAxisElementProvider()), DisplayMode.EDIT, configLabel);
+ configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITOR, new MultiIntegerCellEditor(axisElement, modelManager.getTableAxisElementProvider()), DisplayMode.EDIT, configLabel);
}
}
diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/config/MultiRealCellEditorConfiguration.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/config/MultiRealCellEditorConfiguration.java
index 5758c4587fd..6f69f9eca60 100644
--- a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/config/MultiRealCellEditorConfiguration.java
+++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/config/MultiRealCellEditorConfiguration.java
@@ -1,6 +1,6 @@
/*****************************************************************************
- * Copyright (c) 2015 CEA LIST and others.
- *
+ * Copyright (c) 2015, 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
@@ -8,23 +8,22 @@
*
* Contributors:
* Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
- *
+ * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Bug 515737
*****************************************************************************/
package org.eclipse.papyrus.uml.nattable.config;
import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.nebula.widgets.nattable.config.CellConfigAttributes;
import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes;
-import org.eclipse.nebula.widgets.nattable.painter.cell.TextPainter;
import org.eclipse.nebula.widgets.nattable.style.DisplayMode;
import org.eclipse.papyrus.infra.nattable.celleditor.config.ICellAxisConfiguration;
import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
import org.eclipse.papyrus.infra.nattable.utils.AxisUtils;
import org.eclipse.papyrus.infra.nattable.utils.NattableConfigAttributes;
+import org.eclipse.papyrus.uml.nattable.config.utils.CellEditorConfigurationUtils;
import org.eclipse.papyrus.uml.nattable.editor.MultiRealCellEditor;
import org.eclipse.uml2.types.TypesPackage;
@@ -85,9 +84,10 @@ public class MultiRealCellEditorConfiguration implements ICellAxisConfiguration
*/
@Override
public void configureCellEditor(final IConfigRegistry configRegistry, final Object axis, final String configLabel) {
- configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, new TextPainter(), DisplayMode.NORMAL, configLabel);
+ final Object axisElement = AxisUtils.getRepresentedElement(axis);
+ CellEditorConfigurationUtils.configureCellPainter(configRegistry, axis, configLabel);
final INattableModelManager modelManager = configRegistry.getConfigAttribute(NattableConfigAttributes.NATTABLE_MODEL_MANAGER_CONFIG_ATTRIBUTE, DisplayMode.NORMAL, NattableConfigAttributes.NATTABLE_MODEL_MANAGER_ID);
- configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITOR, new MultiRealCellEditor(axis, modelManager.getTableAxisElementProvider()), DisplayMode.EDIT, configLabel);
+ configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITOR, new MultiRealCellEditor(axisElement, modelManager.getTableAxisElementProvider()), DisplayMode.EDIT, configLabel);
}
}
diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/config/MultiStringCellEditorConfiguration.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/config/MultiStringCellEditorConfiguration.java
index d175d5318b1..ce4c6c18d0d 100644
--- a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/config/MultiStringCellEditorConfiguration.java
+++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/config/MultiStringCellEditorConfiguration.java
@@ -1,6 +1,6 @@
/*****************************************************************************
- * Copyright (c) 2015 CEA LIST and others.
- *
+ * Copyright (c) 2015, 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
@@ -8,7 +8,7 @@
*
* Contributors:
* Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
- *
+ * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Bug 515737
*****************************************************************************/
package org.eclipse.papyrus.uml.nattable.config;
@@ -16,18 +16,19 @@ package org.eclipse.papyrus.uml.nattable.config;
import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.EDataType;
import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.nebula.widgets.nattable.config.CellConfigAttributes;
import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes;
-import org.eclipse.nebula.widgets.nattable.painter.cell.TextPainter;
import org.eclipse.nebula.widgets.nattable.style.DisplayMode;
import org.eclipse.papyrus.infra.emf.utils.EMFContants;
import org.eclipse.papyrus.infra.nattable.celleditor.config.ICellAxisConfiguration;
import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
import org.eclipse.papyrus.infra.nattable.utils.AxisUtils;
+import org.eclipse.papyrus.infra.nattable.utils.NamedStyleConstants;
import org.eclipse.papyrus.infra.nattable.utils.NattableConfigAttributes;
+import org.eclipse.papyrus.infra.nattable.utils.StyleUtils;
import org.eclipse.papyrus.infra.tools.util.TypesConstants;
+import org.eclipse.papyrus.uml.nattable.config.utils.CellEditorConfigurationUtils;
import org.eclipse.papyrus.uml.nattable.editor.MultiStringCellEditor;
/**
@@ -90,9 +91,20 @@ public class MultiStringCellEditorConfiguration implements ICellAxisConfiguratio
*/
@Override
public void configureCellEditor(final IConfigRegistry configRegistry, final Object axis, final String configLabel) {
- configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, new TextPainter(), DisplayMode.NORMAL, configLabel);
+ final INattableModelManager nattableManager = configRegistry.getConfigAttribute(
+ NattableConfigAttributes.NATTABLE_MODEL_MANAGER_CONFIG_ATTRIBUTE,
+ DisplayMode.NORMAL,
+ NattableConfigAttributes.NATTABLE_MODEL_MANAGER_ID);
+
+ final Table table = nattableManager.getTable();
+
+ final boolean wrapTextFlag = StyleUtils.getBooleanNamedStyleValue(table, NamedStyleConstants.WRAP_TEXT);
+ final boolean autoResizeCellHeightFlag = StyleUtils.getBooleanNamedStyleValue(table, NamedStyleConstants.AUTO_RESIZE_CELL_HEIGHT);
+
+ final Object axisElement = AxisUtils.getRepresentedElement(axis);
+ CellEditorConfigurationUtils.configureCellPainter(configRegistry, axis, configLabel, wrapTextFlag, autoResizeCellHeightFlag);
final INattableModelManager modelManager = configRegistry.getConfigAttribute(NattableConfigAttributes.NATTABLE_MODEL_MANAGER_CONFIG_ATTRIBUTE, DisplayMode.NORMAL, NattableConfigAttributes.NATTABLE_MODEL_MANAGER_ID);
- configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITOR, new MultiStringCellEditor(axis, modelManager.getTableAxisElementProvider()), DisplayMode.EDIT, configLabel);
+ configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITOR, new MultiStringCellEditor(axisElement, modelManager.getTableAxisElementProvider()), DisplayMode.EDIT, configLabel);
}
}
diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/config/MultiUMLReferenceCellEditorConfiguration.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/config/MultiUMLReferenceCellEditorConfiguration.java
index 69060fe1919..b2e4a365eab 100644
--- a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/config/MultiUMLReferenceCellEditorConfiguration.java
+++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/config/MultiUMLReferenceCellEditorConfiguration.java
@@ -8,7 +8,7 @@
*
* Contributors:
* Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
- * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Bug 517374
+ * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Bug 517374, 515737
*****************************************************************************/
package org.eclipse.papyrus.uml.nattable.config;
@@ -18,7 +18,6 @@ import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.nebula.widgets.nattable.config.CellConfigAttributes;
import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes;
-import org.eclipse.nebula.widgets.nattable.painter.cell.TextPainter;
import org.eclipse.nebula.widgets.nattable.style.DisplayMode;
import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
import org.eclipse.papyrus.infra.nattable.celleditor.config.ICellAxisConfiguration;
@@ -26,6 +25,7 @@ import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
import org.eclipse.papyrus.infra.nattable.utils.AxisUtils;
import org.eclipse.papyrus.infra.nattable.utils.NattableConfigAttributes;
+import org.eclipse.papyrus.uml.nattable.config.utils.CellEditorConfigurationUtils;
import org.eclipse.papyrus.uml.nattable.converter.MultiUMLReferenceDisplayConverter;
import org.eclipse.papyrus.uml.nattable.editor.MultiReferenceCellEditor;
import org.eclipse.uml2.uml.UMLPackage;
@@ -86,10 +86,11 @@ public class MultiUMLReferenceCellEditorConfiguration implements ICellAxisConfig
*/
@Override
public void configureCellEditor(final IConfigRegistry configRegistry, final Object axis, final String configLabel) {
- configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, new TextPainter(), DisplayMode.NORMAL, configLabel);
+ final Object axisElement = AxisUtils.getRepresentedElement(axis);
+ CellEditorConfigurationUtils.configureCellPainter(configRegistry, axis, configLabel);
final INattableModelManager modelManager = configRegistry.getConfigAttribute(NattableConfigAttributes.NATTABLE_MODEL_MANAGER_CONFIG_ATTRIBUTE, DisplayMode.NORMAL, NattableConfigAttributes.NATTABLE_MODEL_MANAGER_ID);
- configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITOR, new MultiReferenceCellEditor(axis, modelManager.getTableAxisElementProvider()), DisplayMode.EDIT, configLabel);
+ configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITOR, new MultiReferenceCellEditor(axisElement, modelManager.getTableAxisElementProvider()), DisplayMode.EDIT, configLabel);
configRegistry.registerConfigAttribute(CellConfigAttributes.DISPLAY_CONVERTER, new MultiUMLReferenceDisplayConverter(), DisplayMode.EDIT, configLabel);
}
diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/config/MultiUnlimitedNaturalCellEditorConfiguration.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/config/MultiUnlimitedNaturalCellEditorConfiguration.java
index 2206cb0cf48..ed2dc6d3184 100644
--- a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/config/MultiUnlimitedNaturalCellEditorConfiguration.java
+++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/config/MultiUnlimitedNaturalCellEditorConfiguration.java
@@ -1,6 +1,6 @@
/*****************************************************************************
- * Copyright (c) 2015 CEA LIST and others.
- *
+ * Copyright (c) 2015, 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
@@ -8,23 +8,22 @@
*
* Contributors:
* Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
- *
+ * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Bug 515737
*****************************************************************************/
package org.eclipse.papyrus.uml.nattable.config;
import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.nebula.widgets.nattable.config.CellConfigAttributes;
import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes;
-import org.eclipse.nebula.widgets.nattable.painter.cell.TextPainter;
import org.eclipse.nebula.widgets.nattable.style.DisplayMode;
import org.eclipse.papyrus.infra.nattable.celleditor.config.ICellAxisConfiguration;
import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
import org.eclipse.papyrus.infra.nattable.utils.AxisUtils;
import org.eclipse.papyrus.infra.nattable.utils.NattableConfigAttributes;
+import org.eclipse.papyrus.uml.nattable.config.utils.CellEditorConfigurationUtils;
import org.eclipse.papyrus.uml.nattable.editor.MultiUnlimitedNaturalCellEditor;
import org.eclipse.uml2.types.TypesPackage;
@@ -85,9 +84,10 @@ public class MultiUnlimitedNaturalCellEditorConfiguration implements ICellAxisCo
*/
@Override
public void configureCellEditor(final IConfigRegistry configRegistry, final Object axis, final String configLabel) {
- configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, new TextPainter(), DisplayMode.NORMAL, configLabel);
+ final Object axisElement = AxisUtils.getRepresentedElement(axis);
+ CellEditorConfigurationUtils.configureCellPainter(configRegistry, axis, configLabel);
final INattableModelManager modelManager = configRegistry.getConfigAttribute(NattableConfigAttributes.NATTABLE_MODEL_MANAGER_CONFIG_ATTRIBUTE, DisplayMode.NORMAL, NattableConfigAttributes.NATTABLE_MODEL_MANAGER_ID);
- configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITOR, new MultiUnlimitedNaturalCellEditor(axis, modelManager.getTableAxisElementProvider()), DisplayMode.EDIT, configLabel);
+ configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITOR, new MultiUnlimitedNaturalCellEditor(axisElement, modelManager.getTableAxisElementProvider()), DisplayMode.EDIT, configLabel);
}
}
diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/config/UMLStereotypeMultiDataTypeCellEditorConfiguration.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/config/UMLStereotypeMultiDataTypeCellEditorConfiguration.java
index e463cf7b705..2f7fd2bb7b8 100755
--- a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/config/UMLStereotypeMultiDataTypeCellEditorConfiguration.java
+++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/config/UMLStereotypeMultiDataTypeCellEditorConfiguration.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2016 CEA LIST.
+ * Copyright (c) 2016, 2017 CEA LIST.
*
*
* All rights reserved. This program and the accompanying materials
@@ -10,21 +10,20 @@
* Contributors:
* Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
* Nicolas FAUVERGUE (CEA LIST) nicolas.fauvergue@cea.fr - Bug 502533
- *
+ * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Bug 515737
*****************************************************************************/
package org.eclipse.papyrus.uml.nattable.config;
-import org.eclipse.nebula.widgets.nattable.config.CellConfigAttributes;
import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes;
-import org.eclipse.nebula.widgets.nattable.painter.cell.TextPainter;
import org.eclipse.nebula.widgets.nattable.style.DisplayMode;
import org.eclipse.papyrus.infra.nattable.celleditor.config.ICellAxisConfiguration;
import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
import org.eclipse.papyrus.infra.nattable.utils.AxisUtils;
import org.eclipse.papyrus.infra.nattable.utils.NattableConfigAttributes;
+import org.eclipse.papyrus.uml.nattable.config.utils.CellEditorConfigurationUtils;
import org.eclipse.papyrus.uml.nattable.editor.DatatypeDialogCellEditor;
import org.eclipse.papyrus.uml.nattable.utils.UMLTableUtils;
import org.eclipse.uml2.uml.DataType;
@@ -34,8 +33,8 @@ import org.eclipse.uml2.uml.Property;
import org.eclipse.uml2.uml.Type;
/**
- * The cell editor for UML Single Datatype declared in the profile.
- *
+ * The cell editor for UML Multi Datatype declared in the profile.
+
* @since 3.0
*/
public class UMLStereotypeMultiDataTypeCellEditorConfiguration implements ICellAxisConfiguration {
@@ -60,6 +59,7 @@ public class UMLStereotypeMultiDataTypeCellEditorConfiguration implements ICellA
*
* @see org.eclipse.papyrus.infra.nattable.configuration.IPapyrusNatTableConfiguration#getConfigurationDescription()
*/
+ @Override
public String getConfigurationDescription() {
return "This configuration provides a dialog to edit a multi UML datatype"; //$NON-NLS-1$
}
@@ -92,9 +92,10 @@ public class UMLStereotypeMultiDataTypeCellEditorConfiguration implements ICellA
*/
@Override
public void configureCellEditor(final IConfigRegistry configRegistry, final Object axis, final String configLabel) {
- configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, new TextPainter(), DisplayMode.NORMAL, configLabel);
+ final Object axisElement = AxisUtils.getRepresentedElement(axis);
+ CellEditorConfigurationUtils.configureCellPainter(configRegistry, axis, configLabel);
final INattableModelManager modelManager = configRegistry.getConfigAttribute(NattableConfigAttributes.NATTABLE_MODEL_MANAGER_CONFIG_ATTRIBUTE, DisplayMode.NORMAL, NattableConfigAttributes.NATTABLE_MODEL_MANAGER_ID);
- configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITOR, new DatatypeDialogCellEditor(axis, modelManager.getTableAxisElementProvider()), DisplayMode.EDIT, configLabel);
+ configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITOR, new DatatypeDialogCellEditor(axisElement, modelManager.getTableAxisElementProvider()), DisplayMode.EDIT, configLabel);
}
}
diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/config/UMLStereotypeMultiUMLEnumerationCellEditorConfiguration.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/config/UMLStereotypeMultiUMLEnumerationCellEditorConfiguration.java
index 7c5e40a92cb..c9c1d3b6a2f 100644
--- a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/config/UMLStereotypeMultiUMLEnumerationCellEditorConfiguration.java
+++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/config/UMLStereotypeMultiUMLEnumerationCellEditorConfiguration.java
@@ -1,6 +1,6 @@
/*****************************************************************************
- * Copyright (c) 2015 CEA LIST and others.
- *
+ * Copyright (c) 2015, 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
@@ -8,21 +8,20 @@
*
* Contributors:
* Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
- *
+ * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Bug 515737
*****************************************************************************/
package org.eclipse.papyrus.uml.nattable.config;
-import org.eclipse.nebula.widgets.nattable.config.CellConfigAttributes;
import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes;
-import org.eclipse.nebula.widgets.nattable.painter.cell.TextPainter;
import org.eclipse.nebula.widgets.nattable.style.DisplayMode;
import org.eclipse.papyrus.infra.nattable.celleditor.config.ICellAxisConfiguration;
import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
import org.eclipse.papyrus.infra.nattable.utils.AxisUtils;
import org.eclipse.papyrus.infra.nattable.utils.NattableConfigAttributes;
+import org.eclipse.papyrus.uml.nattable.config.utils.CellEditorConfigurationUtils;
import org.eclipse.papyrus.uml.nattable.editor.MultiEnumCellEditor;
import org.eclipse.papyrus.uml.nattable.utils.UMLTableUtils;
import org.eclipse.uml2.uml.Enumeration;
@@ -86,9 +85,10 @@ public class UMLStereotypeMultiUMLEnumerationCellEditorConfiguration implements
*/
@Override
public void configureCellEditor(final IConfigRegistry configRegistry, final Object axis, final String configLabel) {
- configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, new TextPainter(), DisplayMode.NORMAL, configLabel);
+ final Object axisElement = AxisUtils.getRepresentedElement(axis);
+ CellEditorConfigurationUtils.configureCellPainter(configRegistry, axis, configLabel);
final INattableModelManager modelManager = configRegistry.getConfigAttribute(NattableConfigAttributes.NATTABLE_MODEL_MANAGER_CONFIG_ATTRIBUTE, DisplayMode.NORMAL, NattableConfigAttributes.NATTABLE_MODEL_MANAGER_ID);
- configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITOR, new MultiEnumCellEditor(axis, modelManager.getTableAxisElementProvider()), DisplayMode.EDIT, configLabel);
+ configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITOR, new MultiEnumCellEditor(axisElement, modelManager.getTableAxisElementProvider()), DisplayMode.EDIT, configLabel);
}
}
diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/config/utils/CellEditorConfigurationUtils.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/config/utils/CellEditorConfigurationUtils.java
new file mode 100644
index 00000000000..c13d3d066f6
--- /dev/null
+++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/config/utils/CellEditorConfigurationUtils.java
@@ -0,0 +1,94 @@
+/*****************************************************************************
+ * Copyright (c) 2017 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Bug 515737
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.nattable.config.utils;
+
+import org.eclipse.nebula.widgets.nattable.config.CellConfigAttributes;
+import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
+import org.eclipse.nebula.widgets.nattable.painter.cell.decorator.CellPainterDecorator;
+import org.eclipse.nebula.widgets.nattable.style.DisplayMode;
+import org.eclipse.nebula.widgets.nattable.ui.util.CellEdgeEnum;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.IAxis;
+import org.eclipse.papyrus.infra.nattable.painter.CustomImagePainter;
+import org.eclipse.papyrus.infra.nattable.painter.CustomizedCellPainter;
+import org.eclipse.papyrus.infra.nattable.painter.PapyrusTableCellPainter;
+import org.eclipse.papyrus.infra.nattable.utils.NamedStyleConstants;
+import org.eclipse.papyrus.infra.nattable.utils.StyleUtils;
+
+/**
+ * Common methods for cell editor configuration.
+ *
+ * @since 4.0
+ */
+public class CellEditorConfigurationUtils {
+
+ /**
+ * Private constructor to prevent instantiation.
+ */
+ private CellEditorConfigurationUtils() {
+ }
+
+ /**
+ * Configure the cell painter based on the named style displayListOnSeparatedRows of the input axis.
+ * If the named style is <code>true</code>, use table cell painter to display list elements in separated rows.
+ * Otherwise, use the default cell painter to display list elements in one single row.
+ *
+ * @param configRegistry
+ * The config registry
+ * @param axis
+ * The input axis
+ * @param configLabel
+ * The config label
+ */
+ public static void configureCellPainter(final IConfigRegistry configRegistry, final Object axis, final String configLabel) {
+
+ // wrapText and autoResizeCellHeight are disabled by default
+ configureCellPainter(configRegistry, axis, configLabel, false, false);
+ }
+
+ /**
+ * Configure the cell painter based on the named style displayListOnSeparatedRows of the input axis.
+ * If the named style is <code>true</code>, use table cell painter to display list elements in separated rows.
+ * Otherwise, use the default cell painter to display list elements in one single row.
+ *
+ * @param configRegistry
+ * The config registry
+ * @param axis
+ * The input axis
+ * @param configLabel
+ * The config label
+ * @param wrapText
+ * Split text over multiple lines
+ * @param autoResizeCellHeight
+ * Tell the text painter to calculate the cell border by
+ * containing text height
+ */
+ public static void configureCellPainter(final IConfigRegistry configRegistry, final Object axis, final String configLabel, final boolean wrapText, final boolean autoResizeCellHeight) {
+
+ if (null != configRegistry && axis instanceof IAxis) {
+ final boolean displayListOnRowsFlag = StyleUtils.getBooleanNamedStyleValue((IAxis) axis, NamedStyleConstants.DISPLAY_LIST_ON_SEPARATED_ROWS, NamedStyleConstants.ENABLE_DISPLAY_LIST_ON_SEPARATED_ROWS);
+
+ if (displayListOnRowsFlag) {
+ PapyrusTableCellPainter tableCellPainter = new PapyrusTableCellPainter(new CellPainterDecorator(new CustomizedCellPainter(wrapText, autoResizeCellHeight), CellEdgeEnum.LEFT, new CustomImagePainter()));
+ if (autoResizeCellHeight) {
+ // Call the method setFixedSubCellHeight to trigger the method CustomizedCellPainter.getPreferredHeight
+ // Workaround for the bug 516783 in NatTable, thanks to Dirk Fauth for the temporary solution
+ tableCellPainter.setFixedSubCellHeight(-1);
+ }
+ configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, tableCellPainter, DisplayMode.NORMAL, configLabel);
+ } else {
+ configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, new CustomizedCellPainter(wrapText, autoResizeCellHeight), DisplayMode.NORMAL, configLabel);
+ }
+ } else {
+ configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, new CustomizedCellPainter(wrapText, autoResizeCellHeight), DisplayMode.NORMAL, configLabel);
+ }
+ }
+}
diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/tester/UMLNattableWidgetPropertyTester.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/tester/UMLNattableWidgetPropertyTester.java
new file mode 100644
index 00000000000..df26ef42c8e
--- /dev/null
+++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/tester/UMLNattableWidgetPropertyTester.java
@@ -0,0 +1,72 @@
+/*****************************************************************************
+ * 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:
+ * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Bug 515737
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.nattable.tester;
+
+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.nattableaxis.FeatureIdAxis;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.IAxis;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.AbstractAxisProvider;
+import org.eclipse.papyrus.infra.nattable.utils.AxisUtils;
+import org.eclipse.papyrus.infra.nattable.utils.NattableWidgetPropertyTester;
+import org.eclipse.papyrus.uml.nattable.utils.UMLNattableStereotypeUtils;
+import org.eclipse.uml2.uml.Property;
+
+/**
+ * Property testers for UML NatTable widgets.
+ * Check if an axis corresponding to a stereotype property is multiple values or not.
+ *
+ * @since 4.0
+ */
+public class UMLNattableWidgetPropertyTester extends NattableWidgetPropertyTester {
+
+ @Override
+ public boolean test(final Object receiver, final String property, final Object[] args, final Object expectedValue) {
+ final INattableModelManager manager = getNattableModelManager();
+
+ if (null != manager && expectedValue instanceof Boolean && IS_ONE_MULTIPLE_VALUES_AXIS_SELECTED.equals(property)) {
+
+ // Get the selected axis index
+ final int axisIndex = AxisUtils.getUniqueSelectedAxisIndex(manager);
+
+ // Always get the column axis provider for invert or non-invert table
+ final AbstractAxisProvider axisProvider = manager.getTable().getCurrentColumnAxisProvider();
+
+ // If the index is in range
+ if (null != axisProvider && null != axisProvider.getAxis() && 0 <= axisIndex && axisIndex < axisProvider.getAxis().size()) {
+ final IAxis selectedAxis = axisProvider.getAxis().get(axisIndex);
+ // Get the selected axis element
+ final Object axisElement = selectedAxis.getElement();
+
+ // Check if the selected axis defined by properties of a stereotype
+ // we need to find the corresponding property defined in stereotype
+ if (selectedAxis instanceof FeatureIdAxis) {
+
+ final FeatureIdAxis selectedFeatureAxis = (FeatureIdAxis) selectedAxis;
+
+ final String propertyStereotypeID = axisElement.toString();
+
+ // Get the corresponding property defined in the stereotype and check its upper bound
+ if (propertyStereotypeID.startsWith(UMLNattableStereotypeUtils.PROPERTY_OF_STEREOTYPE_PREFIX) && null != selectedFeatureAxis.eContainer() && selectedFeatureAxis.eContainer().eContainer() instanceof Table) {
+ final Table table = (Table) selectedFeatureAxis.eContainer().eContainer();
+ final Property propertyStereotype = UMLNattableStereotypeUtils.getRealStereotypeProperty(table.getOwner(), propertyStereotypeID);
+ if (null != propertyStereotype) {
+ return expectedValue.equals(isMultipleValues(propertyStereotype.getUpper()));
+ }
+ }
+ }
+ }
+ }
+
+ return false;
+ }
+}
diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/utils/UMLNattableStereotypeUtils.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/utils/UMLNattableStereotypeUtils.java
new file mode 100644
index 00000000000..ef3144f3034
--- /dev/null
+++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/utils/UMLNattableStereotypeUtils.java
@@ -0,0 +1,215 @@
+/*****************************************************************************
+ * Copyright (c) 2017 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Bug 515737
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.nattable.utils;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.papyrus.infra.nattable.utils.Constants;
+import org.eclipse.papyrus.uml.nattable.paste.StereotypeApplicationStructure;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.NamedElement;
+import org.eclipse.uml2.uml.Namespace;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.Profile;
+import org.eclipse.uml2.uml.Property;
+import org.eclipse.uml2.uml.Stereotype;
+
+/**
+ * This class provides useful methods to manage stereotypes in the table.
+ * Methods in this class are duplicated from those in oep.uml.tools.utils.StereotypeUtil.
+ *
+ * @since 4.0
+ */
+public class UMLNattableStereotypeUtils {
+
+ public static final String PROPERTY_OF_STEREOTYPE_PREFIX = "property_of_stereotype:/"; //$NON-NLS-1$
+
+ /**
+ * Private constructor to prevent instantiation.
+ */
+ private UMLNattableStereotypeUtils() {
+ }
+
+ /**
+ * @param eobject
+ * an element of the model (currently, if it is not an UML::Element, we can't find the property)
+ * @param id
+ * the id used to identify the property of the stereotype
+ *
+ * @return
+ * the UML::Property or <code>null</code> if we can't resolve it (the required profile is not applied)
+ */
+ public static Property getRealStereotypeProperty(final EObject eobject, final String id) {
+ return getRealStereotypeProperty(eobject, id, null);
+ }
+
+ /**
+ * @param packages
+ * a list of package
+ * @param propertyQN
+ * the qualified name of the wanted property
+ * @return
+ * the property or <code>null</code> if not found
+ */
+ protected static Property getProperty(Collection<Package> packages, String propertyQN) {
+ final String propertyName = getNameFromQualifiedName(propertyQN);
+ final String stereotypeQN = getParentQualifiedName(propertyQN);
+ final String stereotypeName = getNameFromQualifiedName(stereotypeQN);
+ final String profileQN = getParentQualifiedName(stereotypeQN);
+ for (Package package1 : packages) {
+ for (Profile prof : package1.getAppliedProfiles()) {
+ if (prof.getQualifiedName().equals(profileQN)) {
+ NamedElement ste = prof.getMember(stereotypeName);
+ if (ste instanceof Stereotype) {
+ NamedElement prop = ((Stereotype) ste).getMember(propertyName);
+ if (prop instanceof Property && prop.getQualifiedName().equals(propertyQN)) {
+ return (Property) prop;
+ }
+ }
+ }
+ Property p = getProperty(package1.getNestedPackages(), propertyQN);
+ if (null != p) {
+ return p;
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @param eobject
+ * an element of the model (currently, if it is not an UML::Element, we can't find the property)
+ * @param id
+ * the id used to identify the property of the stereotype
+ * @param sharedMap
+ * a map owning interesting information, like {@link StereotypeApplicationStructure} which can be used to find stereotype, stereotype
+ * application and so on
+ * @return
+ * the UML::Property or <code>null</code> if we can't resolve it (the required profile is not applied)
+ */
+ public static Property getRealStereotypeProperty(final EObject eobject, final String id, final Map<?, ?> sharedMap) {
+ Property result = null;
+
+ Assert.isTrue(id.startsWith(PROPERTY_OF_STEREOTYPE_PREFIX));
+ if (eobject instanceof Element) {
+ final Element element = (Element) eobject;
+ final String propertyQN = id.replace(UMLNattableStereotypeUtils.PROPERTY_OF_STEREOTYPE_PREFIX, ""); //$NON-NLS-1$
+
+ Package nearestPackage = null;
+ if (null != sharedMap) {
+ final Element context = (Element) sharedMap.get(Constants.PASTED_ELEMENT_CONTAINER_KEY);
+ nearestPackage = context.getNearestPackage();
+ } else {
+ nearestPackage = element.getNearestPackage();
+ }
+
+ if (null != nearestPackage) {
+ // Search the properties by their qualified name instead of search by its stereotypes first
+ // This allows to manage the inherit properties and the stereotypes in packages
+ final Iterator<Profile> appliedProfilesIterator = nearestPackage.getAllAppliedProfiles().iterator();
+ while (appliedProfilesIterator.hasNext() && null == result) {
+ final Profile appliedProfile = appliedProfilesIterator.next();
+
+ // Loop on all stereotypes (check in sub packages)
+ final Iterator<Stereotype> stereotypesIterator = getAllStereotypes(appliedProfile).iterator();
+ while (stereotypesIterator.hasNext() && null == result) {
+ final Stereotype ownedStereotype = stereotypesIterator.next();
+ final Iterator<Property> propertiesIterator = ownedStereotype.getAllAttributes().iterator();
+ while (propertiesIterator.hasNext() && null == result) {
+ final Property property = propertiesIterator.next();
+ if (property.getQualifiedName().equals(propertyQN)) {
+ result = property;
+ }
+ }
+ }
+ }
+
+ // If the property is still not found , the profile could be applied on a sub-package of the nearest package
+ // The table can show element which are not children of its context, so the profile could not be available in its context
+ if (null == result) {
+ result = getProperty(element.getNearestPackage().getNestedPackages(), propertyQN);
+ }
+ }
+ }
+ return result;
+ }
+
+ /**
+ * This allows to get all stereotypes of a profile (check in sub packages).
+ *
+ * @param profile
+ * the profile
+ * @return The list of stereotypes corresponding to the profile
+ */
+ public static List<Stereotype> getAllStereotypes(final Profile profile) {
+ final List<Stereotype> stereotypes = new ArrayList<>(profile.getOwnedStereotypes());
+ stereotypes.addAll(getStereotypeInMembers(profile.getOwnedMembers()));
+ return stereotypes;
+ }
+
+ /**
+ * @param members
+ * The owned members of an element
+ * @return The list of all stereotypes in sub packages
+ */
+ protected static List<Stereotype> getStereotypeInMembers(final List<NamedElement> members) {
+ final List<Stereotype> stereotypes = new ArrayList<>();
+
+ // Loop on members
+ final Iterator<NamedElement> membersIterator = members.iterator();
+ while (membersIterator.hasNext()) {
+ NamedElement member = membersIterator.next();
+
+ // Get stereotypes in packages
+ if (member instanceof Package) {
+ stereotypes.addAll(((Package) member).getOwnedStereotypes());
+ }
+
+ // Loop recursively in members
+ if (member instanceof Namespace) {
+ stereotypes.addAll(getStereotypeInMembers(((Namespace) member).getOwnedMembers()));
+ }
+ }
+
+ return stereotypes;
+ }
+
+ /**
+ * Return the name of an element, given its qualified name.
+ *
+ * @param qualifiedName
+ * the qualified name of the element
+ * @return the name of the element, must not be <code>null</code>
+ */
+ public static String getNameFromQualifiedName(String qualifiedName) {
+ String name = qualifiedName.substring(qualifiedName.lastIndexOf(NamedElement.SEPARATOR) + NamedElement.SEPARATOR.length());
+ return (null != name) ? name : ""; //$NON-NLS-1$
+ }
+
+ /**
+ * @param childQualifiedName
+ * the qualifiedName of an element
+ * @return
+ * the qualified name of its parent
+ */
+ public static String getParentQualifiedName(final String childQualifiedName) {
+ final String childName = getNameFromQualifiedName(childQualifiedName);
+ final String parentQualifiedName = childQualifiedName.substring(0, childQualifiedName.length() - (NamedElement.SEPARATOR.length() + childName.length()));
+ return (null != parentQualifiedName) ? parentQualifiedName : ""; //$NON-NLS-1$
+ }
+}
diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/resources/bugs/bug515737/DisplayListOnSeparatedRowsTest.di b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/resources/bugs/bug515737/DisplayListOnSeparatedRowsTest.di
new file mode 100644
index 00000000000..8c549eecdc6
--- /dev/null
+++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/resources/bugs/bug515737/DisplayListOnSeparatedRowsTest.di
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<architecture:ArchitectureDescription xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:architecture="http://www.eclipse.org/papyrus/infra/core/architecture" contextId="org.eclipse.papyrus.infra.services.edit.TypeContext"/>
diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/resources/bugs/bug515737/DisplayListOnSeparatedRowsTest.notation b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/resources/bugs/bug515737/DisplayListOnSeparatedRowsTest.notation
new file mode 100644
index 00000000000..696068b74ed
--- /dev/null
+++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/resources/bugs/bug515737/DisplayListOnSeparatedRowsTest.notation
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nattable:Table xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:nattable="http://www.eclipse.org/papyrus/nattable/model" xmlns:nattableaxis="http://www.eclipse.org/papyrus/nattable/model/table/nattableaxis" xmlns:nattableaxisconfiguration="http://www.eclipse.org/papyrus/nattable/model/table/nattableaxisconfiguration" xmlns:nattableaxisprovider="http://www.eclipse.org/papyrus/nattable/model/table/nattableaxisprovider" xmlns:nattableconfiguration="http://www.eclipse.org/papyrus/nattable/model/nattableconfiguration" xmlns:nattablestyle="http://www.eclipse.org/papyrus/nattable/model/table/nattablestyle" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xsi:schemaLocation="http://www.eclipse.org/papyrus/nattable/model/table/nattableaxis http://www.eclipse.org/papyrus/nattable/model#//nattableaxis http://www.eclipse.org/papyrus/nattable/model/table/nattableaxisconfiguration http://www.eclipse.org/papyrus/nattable/model#//nattableaxisconfiguration http://www.eclipse.org/papyrus/nattable/model/table/nattableaxisprovider http://www.eclipse.org/papyrus/nattable/model#//nattableaxisprovider http://www.eclipse.org/papyrus/nattable/model/nattableconfiguration http://www.eclipse.org/papyrus/nattable/model#//nattableconfiguration http://www.eclipse.org/papyrus/nattable/model/table/nattablestyle http://www.eclipse.org/papyrus/nattable/model#//nattablestyle" xmi:id="_ezWSMFwQEeegfoHbWKP4NQ" name="ClassTreeTable" currentRowAxisProvider="_ezWSM1wQEeegfoHbWKP4NQ" currentColumnAxisProvider="_ezWSMVwQEeegfoHbWKP4NQ" tableKindId="org.eclipse.papyrus.uml.table.classTree">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_ezXgUFwQEeegfoHbWKP4NQ" source="http://www.eclipse.org/papyrus/infra/nattable/version">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_ezXgUVwQEeegfoHbWKP4NQ" key="version" value="1.3.0"/>
+ </eAnnotations>
+ <styles xmi:type="nattablestyle:IntValueStyle" xmi:id="_wlkN8F_yEeemsJkJCA3h9A" name="rowHeaderWidth" intValue="346"/>
+ <context xmi:type="uml:Model" href="DisplayListOnSeparatedRowsTest.uml#_9_lWoFwOEeegfoHbWKP4NQ"/>
+ <owner xmi:type="uml:Model" href="DisplayListOnSeparatedRowsTest.uml#_9_lWoFwOEeegfoHbWKP4NQ"/>
+ <tableConfiguration xmi:type="nattableconfiguration:TableConfiguration" href="platform:/plugin/org.eclipse.papyrus.uml.nattable.clazz.config/configs/class_synchronized_tree.nattableconfiguration#/"/>
+ <columnAxisProvidersHistory xmi:type="nattableaxisprovider:SlaveObjectAxisProvider" xmi:id="_ezWSMVwQEeegfoHbWKP4NQ" description="This axis provider provides available columns according to the rows of the table (features of the object displayed on the other axis)" name="UML Feature axis provider">
+ <axis xmi:type="nattableaxis:EStructuralFeatureAxis" xmi:id="_ezWSMlwQEeegfoHbWKP4NQ">
+ <manager xmi:type="nattableaxisconfiguration:AxisManagerRepresentation" href="platform:/plugin/org.eclipse.papyrus.uml.nattable.clazz.config/configs/class_synchronized_tree.nattableconfiguration#//@columnHeaderAxisConfiguration/@axisManagers.0"/>
+ <element xmi:type="ecore:EAttribute" href="http://www.eclipse.org/uml2/5.0.0/UML#//NamedElement/name"/>
+ </axis>
+ <axis xmi:type="nattableaxis:EStructuralFeatureAxis" xmi:id="_jUOcYFwQEeegfoHbWKP4NQ">
+ <styles xmi:type="nattablestyle:IntValueStyle" xmi:id="_NtPzMFzcEee9cu7y32dR5g" name="axisWidth" intValue="252"/>
+ <manager xmi:type="nattableaxisconfiguration:AxisManagerRepresentation" href="platform:/plugin/org.eclipse.papyrus.uml.nattable.clazz.config/configs/class_synchronized_tree.nattableconfiguration#//@columnHeaderAxisConfiguration/@axisManagers.0"/>
+ <element xmi:type="ecore:EReference" href="http://www.eclipse.org/uml2/5.0.0/UML#//Element/ownedElement"/>
+ </axis>
+ </columnAxisProvidersHistory>
+ <rowAxisProvidersHistory xmi:type="nattableaxisprovider:MasterObjectAxisProvider" xmi:id="_ezWSM1wQEeegfoHbWKP4NQ" description="This axis provider manages the rows, according to the wanted hierarchy" name="HierarchicalRowaAxisManager" disconnectSlave="true"/>
+</nattable:Table>
diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/resources/bugs/bug515737/DisplayListOnSeparatedRowsTest.uml b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/resources/bugs/bug515737/DisplayListOnSeparatedRowsTest.uml
new file mode 100644
index 00000000000..273976f7d54
--- /dev/null
+++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/resources/bugs/bug515737/DisplayListOnSeparatedRowsTest.uml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<uml:Model xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_9_lWoFwOEeegfoHbWKP4NQ" name="RootModel">
+ <packagedElement xmi:type="uml:Class" xmi:id="_GReUUFwPEeegfoHbWKP4NQ" name="Class1">
+ <ownedAttribute xmi:type="uml:Property" xmi:id="_Hv7PUFwPEeegfoHbWKP4NQ" name="Attribute1" visibility="public"/>
+ <ownedAttribute xmi:type="uml:Property" xmi:id="_jzwtgFwPEeegfoHbWKP4NQ" name="Attribute2" visibility="public"/>
+ <ownedAttribute xmi:type="uml:Port" xmi:id="_k6d24FwPEeegfoHbWKP4NQ" name="Port1" visibility="public" aggregation="composite"/>
+ <ownedAttribute xmi:type="uml:Port" xmi:id="_aRXUwFwQEeegfoHbWKP4NQ" name="Port2" visibility="public" aggregation="composite"/>
+ </packagedElement>
+</uml:Model>
diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/bugs/DisplayListOnSeparatedRowsTest.java b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/bugs/DisplayListOnSeparatedRowsTest.java
new file mode 100644
index 00000000000..9b59dc3fcf9
--- /dev/null
+++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/bugs/DisplayListOnSeparatedRowsTest.java
@@ -0,0 +1,97 @@
+/*****************************************************************************
+ * 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:
+ * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Bug 515737
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.nattable.clazz.config.tests.bugs;
+
+import org.eclipse.nebula.widgets.nattable.grid.layer.GridLayer;
+import org.eclipse.papyrus.infra.nattable.applynamedstyle.PapyrusApplyNamedStyleCommand;
+import org.eclipse.papyrus.infra.nattable.applynamedstyle.PapyrusApplyNamedStyleCommandHandler;
+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.nattablestyle.BooleanValueStyle;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.NattablestylePackage;
+import org.eclipse.papyrus.infra.nattable.utils.NamedStyleConstants;
+import org.eclipse.papyrus.junit.utils.rules.ActiveTable;
+import org.eclipse.papyrus.junit.utils.rules.PluginResource;
+import org.eclipse.papyrus.uml.nattable.clazz.config.tests.tests.AbstractTableTest;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * Test the execution of handler for the {@link PapyrusApplyNamedStyleCommand} command with the displayListOnSeparatedRows named style.
+ */
+@PluginResource("resources/bugs/bug515737/DisplayListOnSeparatedRowsTest.di")
+public class DisplayListOnSeparatedRowsTest extends AbstractTableTest {
+
+ /** The column axis to apply the named style. */
+ protected IAxis columnAxis = null;
+
+ /**
+ * Default constructor.
+ */
+ public DisplayListOnSeparatedRowsTest() {
+ super();
+ }
+
+ /**
+ * This allows to test the application of named style.
+ *
+ * @throws Exception
+ * The caught exception
+ */
+ @Test
+ @ActiveTable("ClassTreeTable")
+ public void testDisplayListOnSeparatedRowsNamedStyle() throws Exception {
+ startTest();
+
+ // Unregister and register the handler for the PapyrusApplyNamedStyleCommand
+ final GridLayer gridLayer = this.manager.getGridLayer();
+ gridLayer.unregisterCommandHandler(PapyrusApplyNamedStyleCommand.class);
+ gridLayer.registerCommandHandler(new PapyrusApplyNamedStyleCommandHandler());
+
+ selectColumn(1);
+
+ // Get the displayListOnSeparatedRows named style for the selected column axis
+ BooleanValueStyle namedStyle = (BooleanValueStyle) this.columnAxis.getNamedStyle(NattablestylePackage.eINSTANCE.getBooleanValueStyle(), NamedStyleConstants.DISPLAY_LIST_ON_SEPARATED_ROWS);
+ // The named style must not exist by default
+ Assert.assertNull(namedStyle);
+
+ // Do the command to apply the named style displayListOnSeparatedRows
+ natTable.doCommand(new PapyrusApplyNamedStyleCommand(getTableEditingDomain(), this.columnAxis, NamedStyleConstants.DISPLAY_LIST_ON_SEPARATED_ROWS));
+ namedStyle = (BooleanValueStyle) this.columnAxis.getNamedStyle(NattablestylePackage.eINSTANCE.getBooleanValueStyle(), NamedStyleConstants.DISPLAY_LIST_ON_SEPARATED_ROWS);
+ // The named style must not be null
+ Assert.assertNotNull(namedStyle);
+ // And its value must be true
+ Assert.assertTrue(namedStyle.isBooleanValue());
+
+ // Redo the command
+ natTable.doCommand(new PapyrusApplyNamedStyleCommand(getTableEditingDomain(), this.columnAxis, NamedStyleConstants.DISPLAY_LIST_ON_SEPARATED_ROWS));
+ namedStyle = (BooleanValueStyle) this.columnAxis.getNamedStyle(NattablestylePackage.eINSTANCE.getBooleanValueStyle(), NamedStyleConstants.DISPLAY_LIST_ON_SEPARATED_ROWS);
+ // Now the named style must be deleted successfully
+ Assert.assertNull(namedStyle);
+ }
+
+ /**
+ * Select a column to apply named style.
+ */
+ protected void selectColumn(final int columnOrder) {
+ this.columnAxis = manager.getTable().getCurrentColumnAxisProvider().getAxis().get(columnOrder);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void checkFillingConfigurationAndHiddenCategoryForTestConsistency(Table table, String simpleClassName) {
+ // Do nothing about the name of the class and the model
+ }
+}
diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/tests/AllTests.java b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/tests/AllTests.java
index c766f533e71..3e97d61a58b 100644
--- a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/tests/AllTests.java
+++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config.tests/src/org/eclipse/papyrus/uml/nattable/clazz/config/tests/tests/AllTests.java
@@ -9,7 +9,7 @@
* Contributors:
* Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
* Quentin Le Menez (CEA LIST) quentin.lemenez@cea.fr
- * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Bug 515806, 519383
+ * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Bug 515806, 519383, 515737
*****************************************************************************/
package org.eclipse.papyrus.uml.nattable.clazz.config.tests.tests;
@@ -20,6 +20,7 @@ import org.eclipse.papyrus.uml.nattable.clazz.config.tests.bugs.ChangeCategoryNo
import org.eclipse.papyrus.uml.nattable.clazz.config.tests.bugs.DeleteRequirementsWithNestedClassifier;
import org.eclipse.papyrus.uml.nattable.clazz.config.tests.bugs.DeleteRowElementTest;
import org.eclipse.papyrus.uml.nattable.clazz.config.tests.bugs.DestroyColumnTest;
+import org.eclipse.papyrus.uml.nattable.clazz.config.tests.bugs.DisplayListOnSeparatedRowsTest;
import org.eclipse.papyrus.uml.nattable.clazz.config.tests.bugs.EditInvalidPastedText_V1_V3_V1;
import org.eclipse.papyrus.uml.nattable.clazz.config.tests.bugs.MoveElementsTreeTableTest;
import org.eclipse.papyrus.uml.nattable.clazz.config.tests.bugs.NoDepth0TreeFillingConfigurationTest;
@@ -219,6 +220,9 @@ import org.junit.runners.Suite.SuiteClasses;
// Delete row elements
DeleteRowElementTest.class,
+ // Bug 515737: Papyrus Table must be able to display list in cells with a new line for each object owned by the list and fake line between values
+ DisplayListOnSeparatedRowsTest.class,
+
// Destroy column
DestroyColumnTest.class,

Back to the top