Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas FAUVERGUE2016-09-16 13:46:04 +0000
committerGerrit Code Review @ Eclipse.org2016-09-23 08:42:50 +0000
commitad115490043a3867ab70a2bc9485bf8739cf292d (patch)
treec3d238d3b0bc865961d559fc4a5fa5296c0c17f0 /plugins/infra/nattable
parentcff3399555d29120bf9e2cfa60c988c2111ab745 (diff)
downloadorg.eclipse.papyrus-ad115490043a3867ab70a2bc9485bf8739cf292d.tar.gz
org.eclipse.papyrus-ad115490043a3867ab70a2bc9485bf8739cf292d.tar.xz
org.eclipse.papyrus-ad115490043a3867ab70a2bc9485bf8739cf292d.zip
Bug 501332: Sorting mixed-category tree table lead to Eclipse crash
https://bugs.eclipse.org/bugs/show_bug.cgi?id=501332 Problem when sorting 2 elements which not have a common parent (possible for different tree filling parent). Change-Id: I2d2b9c34d6fc2d3b7ea4fb52b4d7bff3a59a1eea Signed-off-by: Nicolas FAUVERGUE <nicolas.fauvergue@all4tec.net>
Diffstat (limited to 'plugins/infra/nattable')
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/axis/ITreeItemAxisComparator.java25
1 files changed, 17 insertions, 8 deletions
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/axis/ITreeItemAxisComparator.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/axis/ITreeItemAxisComparator.java
index 4a0a26d276c..83c26e3ac9f 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/axis/ITreeItemAxisComparator.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/axis/ITreeItemAxisComparator.java
@@ -19,7 +19,6 @@ import java.util.Comparator;
import java.util.List;
import org.eclipse.core.runtime.Assert;
-import org.eclipse.papyrus.infra.nattable.Activator;
import org.eclipse.papyrus.infra.nattable.manager.cell.CellManagerFactory;
import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.IAxis;
@@ -96,17 +95,27 @@ public class ITreeItemAxisComparator implements Comparator<ITreeItemAxis> {
}
}
- if (firstCommon == null) {
- Activator.log.warn("No common ITreeItemAxis found"); //$NON-NLS-1$
- throw new UnsupportedOperationException("Not yet implemented, please submit us a bug, with your example"); //$NON-NLS-1$
- } else if (path1.get(path1.size() - 1) == firstCommon) {
- // Activator.log.warn("no really common");
- return 0;
- } else {
+ // If there is no common ancestor (when different tree filling) or not really common, don't compare them
+ if (null != firstCommon && null != path1 && !path1.isEmpty() && !firstCommon.equals(path1.get(path1.size() - 1))) {
int index1 = path1.indexOf(firstCommon);
int index2 = path2.indexOf(firstCommon);
return compare(path1.get(index1++), path2.get(index2++));
}
+
+ // Bug 501332 : This was replaced by the previous block
+ //if (firstCommon == null) {
+ // Activator.log.warn("No common ITreeItemAxis found"); //$NON-NLS-1$
+ // throw new UnsupportedOperationException("Not yet implemented, please submit us a bug, with your example"); //$NON-NLS-1$
+ //} else if (path1.get(path1.size() - 1) == firstCommon) {
+ // // Activator.log.warn("no really common");
+ // return 0;
+ //} else {
+ // int index1 = path1.indexOf(firstCommon);
+ // int index2 = path2.indexOf(firstCommon);
+ // return compare(path1.get(index1++), path2.get(index2++));
+ //}
+
+ return 0;
}
/**

Back to the top