Author: thomasobrien95
Date: Tue Feb 10 09:50:31 2009
New Revision: 2940

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

Log:
The OpenProjectAction will now refresh the tree when a project is opened.

Modified: trunk/src/ca/sqlpower/architect/swingui/action/OpenProjectAction.java
==============================================================================
--- trunk/src/ca/sqlpower/architect/swingui/action/OpenProjectAction.java (original) +++ trunk/src/ca/sqlpower/architect/swingui/action/OpenProjectAction.java Tue Feb 10 09:50:31 2009
@@ -40,6 +40,7 @@
 import ca.sqlpower.architect.swingui.ArchitectSwingSession;
 import ca.sqlpower.architect.swingui.ArchitectSwingSessionContext;
 import ca.sqlpower.architect.swingui.RecentMenu;
+import ca.sqlpower.architect.swingui.dbtree.DBTreeModel;
 import ca.sqlpower.sqlobject.SQLObjectException;
 import ca.sqlpower.swingui.SPSUtils;
 import ca.sqlpower.swingui.SPSwingWorker;
@@ -194,6 +195,7 @@
             } else {
                 recent.putRecentFileName(file.getAbsolutePath());
                 session.initGUI(openingSession);
+ ((DBTreeModel) session.getSourceDatabases().getModel()).refreshTreeStructure();
             }

             try {

Modified: trunk/src/ca/sqlpower/architect/swingui/dbtree/DBTreeModel.java
==============================================================================
--- trunk/src/ca/sqlpower/architect/swingui/dbtree/DBTreeModel.java (original) +++ trunk/src/ca/sqlpower/architect/swingui/dbtree/DBTreeModel.java Tue Feb 10 09:50:31 2009
@@ -190,6 +190,18 @@
                        notifier.run();
                
        }
+       
+       /**
+ * This method will update the view of the tree by firing a structure change + * on the root. This is necessary to update the tree after loading the project
+        * on a separate thread.
+        *
+ * NOTE: This method fires a TreeStructureChanged event which is not undoable
+        * and can be a heavy operation!
+        */
+       public void refreshTreeStructure() {
+ fireTreeStructureChanged(new TreeModelEvent(root, new Object[]{root}));
+       }

        /**
         * Returns the path from the conceptual, hidden root node (of type

Reply via email to