]> gerrit.simantics Code Review - simantics/interop.git/blobdiff - org.simantics.interop.update/src/org/simantics/interop/update/model/UpdateNode.java
Sort UpdateNodes
[simantics/interop.git] / org.simantics.interop.update / src / org / simantics / interop / update / model / UpdateNode.java
index f68f887dca33c98e925862c203dab27926ae5480..5bf0cd4ec8e298d963a0267bd434888032da78e0 100644 (file)
@@ -94,12 +94,25 @@ public class UpdateNode {
        public void sort() {
                if (children == null)
                        return;
-               Collections.sort(this.children, new Comparator<UpdateNode>() {
+               Comparator<UpdateNode> comparator = new Comparator<UpdateNode>() {
                        @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<UpdateNode> 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 {