From 7010cce1f5f206a9dc74bdffa0ec6267d1be1d04 Mon Sep 17 00:00:00 2001 From: Marko Luukkainen Date: Mon, 28 Feb 2022 18:42:17 +0200 Subject: [PATCH] Sort UpdateNodes gitlab #40 Change-Id: Iddf111947d76982aa009fb724671b027e6d44fdc --- .../interop/update/model/UpdateNode.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/org.simantics.interop.update/src/org/simantics/interop/update/model/UpdateNode.java b/org.simantics.interop.update/src/org/simantics/interop/update/model/UpdateNode.java index f68f887..5bf0cd4 100644 --- a/org.simantics.interop.update/src/org/simantics/interop/update/model/UpdateNode.java +++ b/org.simantics.interop.update/src/org/simantics/interop/update/model/UpdateNode.java @@ -94,12 +94,25 @@ public class UpdateNode { public void sort() { if (children == null) return; - Collections.sort(this.children, new Comparator() { + Comparator comparator = new Comparator() { @Override public int compare(UpdateNode o1, UpdateNode o2) { return o1.getLabel().compareTo(o2.getLabel()); } - }); + }; + Collections.sort(this.children, comparator ); + for (UpdateNode n : this.children) { + n.sort(comparator); + } + } + + public void sort(Comparator comparator ) { + if (children == null) + return; + Collections.sort(this.children, comparator ); + for (UpdateNode n : this.children) { + n.sort(comparator); + } } public ImageDescriptor getImage(ReadGraph graph) throws DatabaseException { -- 2.47.1