Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Lorenzo2020-04-30 08:13:12 +0000
committerVincent Lorenzo2020-04-30 13:28:06 +0000
commita94ea7d6bad71cd1504048d31b9828eda73487b6 (patch)
tree177614bad05c80ae71b3d9bc02885b83cb2573bc /plugins
parent733818a64a99f824e70bd986f841726ba245215f (diff)
downloadorg.eclipse.papyrus-a94ea7d6bad71cd1504048d31b9828eda73487b6.tar.gz
org.eclipse.papyrus-a94ea7d6bad71cd1504048d31b9828eda73487b6.tar.xz
org.eclipse.papyrus-a94ea7d6bad71cd1504048d31b9828eda73487b6.zip
Bug 562619: [Table][TreeTable][Performance] each cell edition is followed by a reconfiguration of cell editors and row filter
Change-Id: I0191a030713a4efdda6cbae3299019d3ea26dadd 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/manager/table/NattableModelManager.java32
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/sort/PapyrusNatTableComparatorChooser.java24
2 files changed, 50 insertions, 6 deletions
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 0bd3d55b1b6..4339aaae6c9 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
@@ -14,7 +14,7 @@
* 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, 515737, 516314
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Bug 559973, 560318
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Bug 559973, 560318, 562619
*****************************************************************************/
package org.eclipse.papyrus.infra.nattable.manager.table;
@@ -430,8 +430,34 @@ public class NattableModelManager extends AbstractNattableWidgetManager implemen
needConfiguration = true;
}
if (needConfiguration) {
- configureCellAxisEditor();
- configureFilters();
+ // we check the events before to launch a reconfiguration, maybe it is just an update
+ // bug 562619
+ boolean isJustUpdate = true;
+ final ListEvent<Object> copiedListChanges = listChanges.copy();
+ while (copiedListChanges.hasNext() && isJustUpdate) {
+ if (copiedListChanges.next()) {
+ int eventType = copiedListChanges.getType();
+ switch (eventType) {
+ case ListEvent.UPDATE:
+ if (copiedListChanges.isReordering()) {
+ // in this case of update we need to reconfigure the editors and the filters
+ isJustUpdate = false;
+ }
+ break;
+ // in fact we get delete event for a cell edition,
+ // because the refresh generate a structural refresh and the comparator registered on the list is updated too
+ // see AbstractTableComparatorChooser.rebuildComparator()
+ case ListEvent.DELETE:
+ case ListEvent.INSERT:
+ default:
+ isJustUpdate = false;
+ }
+ }
+ }
+ if (!isJustUpdate) {
+ configureCellAxisEditor();
+ configureFilters();
+ }
// comment to fix the bug 469739: [Table] Infinite refresh in Tables
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=469739
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/sort/PapyrusNatTableComparatorChooser.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/sort/PapyrusNatTableComparatorChooser.java
index cbfa8da2aca..202b3725e8a 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/sort/PapyrusNatTableComparatorChooser.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/sort/PapyrusNatTableComparatorChooser.java
@@ -1,6 +1,6 @@
/*****************************************************************************
- * Copyright (c) 2015 CEA LIST and others.
- *
+ * Copyright (c) 2015, 2020 CEA LIST and others.
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -10,11 +10,13 @@
*
* Contributors:
* CEA LIST - Initial API and implementation
- *
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Bug 562619
*****************************************************************************/
package org.eclipse.papyrus.infra.nattable.sort;
+import java.util.Comparator;
+
import org.eclipse.papyrus.infra.nattable.sort.copy.NatTableComparatorChooser;
import ca.odell.glazedlists.SortedList;
@@ -36,4 +38,20 @@ public class PapyrusNatTableComparatorChooser extends NatTableComparatorChooser<
super(sortedList, tableFormat);
}
+ /**
+ * @see org.eclipse.papyrus.infra.nattable.glazedlists.copy.AbstractTableComparatorChooser#rebuildComparator()
+ * @since 6.7
+ *
+ */
+ @Override
+ protected void rebuildComparator() {
+ final Comparator<?> newComparator = sortingState.buildComparator();
+ final Comparator<?> previousComparator = sortedList.getComparator();
+ if (newComparator != null || previousComparator != null) {
+ // bug 562619
+ // in other cases, we do nothing to avoid useless notification from the event list
+ super.rebuildComparator();
+ }
+
+ }
}

Back to the top