]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.browsing.ui.nattable/src/org/simantics/browsing/ui/nattable/TreeNode.java
Performance optimizations for NatTableGraphExplorer
[simantics/platform.git] / bundles / org.simantics.browsing.ui.nattable / src / org / simantics / browsing / ui / nattable / TreeNode.java
index 4f9273d9120cfd48547986b1fcb630120fe98582..529d02f4916c3745ae9e6a56de4b51c296d0f425 100644 (file)
@@ -295,6 +295,25 @@ public class TreeNode implements IAdaptable {
                manager = null; 
        }
        
+       /**
+        * Fast dispose is used to wipe the whole tree.
+        * 
+        * ContextToNodeMap is cleared with one command, so we do not need to remove nodes one by one from the map.
+        */
+       public void fastDispose() {
+               if (DEBUG)      System.out.println("dispose " + this);
+               parent = null;
+               for (TreeNode n : children) {
+                       n.fastDispose();
+               }
+               clearCache();
+               children.clear();
+               context = null;
+               explorerContext = null;
+               manager.dispose();
+               manager = null; 
+       }
+       
        private void clearCache() {
                if (explorerContext != null) {
                        GECache2 cache = explorerContext.cache;