Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Lorenzo2020-03-23 14:11:20 +0000
committervincent lorenzo2020-03-23 16:58:46 +0000
commita9c362350bc6c9f49dec2fdfc03811ad46f4838f (patch)
tree8fac07f1407d93e65391d715c7f56f3f72e9f49a /plugins
parentee85b234c34d5cfdd55942b751cbe2fb2d609098 (diff)
downloadorg.eclipse.papyrus-a9c362350bc6c9f49dec2fdfc03811ad46f4838f.tar.gz
org.eclipse.papyrus-a9c362350bc6c9f49dec2fdfc03811ad46f4838f.tar.xz
org.eclipse.papyrus-a9c362350bc6c9f49dec2fdfc03811ad46f4838f.zip
Bug 561370: [Table] The TableSelectionProvider must be adapted to support empty rows
Change-Id: Iaf14ea7a63792a0ea9df9bcca71fd1bed745327a Signed-off-by: Vincent Lorenzo <vincent.lorenzo@cea.fr>
Diffstat (limited to 'plugins')
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/provider/TableSelectionProvider.java22
1 files changed, 13 insertions, 9 deletions
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/provider/TableSelectionProvider.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/provider/TableSelectionProvider.java
index dcc4e7f6257..d7250d5939d 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/provider/TableSelectionProvider.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/provider/TableSelectionProvider.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2012, 2017 CEA LIST.
+ * Copyright (c) 2012, 2017, 2020 CEA LIST.
*
*
* All rights reserved. This program and the accompanying materials
@@ -12,7 +12,7 @@
* Contributors:
* Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
* Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 476618
- * Vincent Lorenzo (CEA LIST) - bug 525221
+ * Vincent Lorenzo (CEA LIST) - bug 525221, 561370
*****************************************************************************/
package org.eclipse.papyrus.infra.nattable.provider;
@@ -200,10 +200,10 @@ public class TableSelectionProvider implements ISelectionProvider, IDisposable,
} else {
selection = calculateSelectionRowsAndColumnsWithoutTypeSelectionEvent(wrapper, event);
}
- // If no selection appended, the selection must be the context of the table
- if(selection.isEmpty()){
+ // If no selection appended, the selection must be the context of the table
+ if (selection.isEmpty()) {
newSelection = new TableStructuredSelection(manager.getTable().getContext(), wrapper);
- }else{
+ } else {
newSelection = new TableStructuredSelection(selection.toArray(), wrapper);
}
} else {
@@ -427,14 +427,18 @@ public class TableSelectionProvider implements ISelectionProvider, IDisposable,
final List<Integer> selectedColumnsIndexes = new ArrayList<Integer>();
for (final Entry<Integer, Object> selectedColumn : wrapper.getFullySelectedColumns().entrySet()) {
final Object selectedObject = AxisUtils.getRepresentedElement(selectedColumn.getValue());
- selection.add(selectedObject);
+ if (selectedObject != null) {
+ selection.add(selectedObject);
+ }
selectedColumnsIndexes.add(selectedColumn.getKey());
}
// Fill the selection list with the selected rows
final List<Integer> selectedRowsIndexes = new ArrayList<Integer>();
for (final Entry<Integer, Object> selectedRow : wrapper.getFullySelectedRows().entrySet()) {
final Object selectedObject = AxisUtils.getRepresentedElement(selectedRow.getValue());
- selection.add(selectedObject);
+ if (selectedObject != null) {
+ selection.add(selectedObject);
+ }
selectedRowsIndexes.add(selectedRow.getKey());
}
// Fill the selection list with the selected cells
@@ -455,7 +459,7 @@ public class TableSelectionProvider implements ISelectionProvider, IDisposable,
} else {
selection.add(value);
}
- }else{
+ } else {
// Bug 481817 : When the value is null, we need to have the cell selection, so add the cell as selection instead of value
selection.add(cell);
}
@@ -527,7 +531,7 @@ public class TableSelectionProvider implements ISelectionProvider, IDisposable,
} else {
selection.add(value);
}
- }else{
+ } else {
// Bug 481817 : When the value is null, we need to have the cell selection, so add the cell as selection instead of value
selection.add(cell);
}

Back to the top