Revision: 3981
Author: [email protected]
Date: Tue Nov  9 09:16:55 2010
Log: Preventing a connection leak: multiple connections were being made when trying to open the columns list of a table in the tree.
http://code.google.com/p/power-architect/source/detail?r=3981

Modified:
 /trunk/src/main/java/ca/sqlpower/architect/swingui/dbtree/DBTreeModel.java

=======================================
--- /trunk/src/main/java/ca/sqlpower/architect/swingui/dbtree/DBTreeModel.java Mon Sep 27 08:46:34 2010 +++ /trunk/src/main/java/ca/sqlpower/architect/swingui/dbtree/DBTreeModel.java Tue Nov 9 09:16:55 2010
@@ -645,7 +645,12 @@
if (logger.isDebugEnabled()) logger.debug("DBTreeModel.getIndexOfChild("+parent+","+child+"): returning "+((SQLObject) parent).getChildren(spChild.getClass()).indexOf(child)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$

                if (parent instanceof ArchitectFolder) {
- return ((ArchitectFolder) parent).getChildren(spChild.getClass()).indexOf(child);
+            if (((ArchitectFolder) parent).isPopulated() ||
+                    spChild.getParent().equals(parent)) {
+ return ((ArchitectFolder) parent).getChildren(spChild.getClass()).indexOf(child);
+            } else {
+                return -1;
+            }
         } else if (parent instanceof SQLTable) {
             if (foldersInTables.get((SQLTable) parent) == null) return -1;
             return foldersInTables.get((SQLTable) parent).indexOf(child);

Reply via email to