Add predefined Velocity and CSS templates if wiki builder is assigned to a project
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.quantum.sql / src / com / quantum / view / bookmark / BookmarkNode.java
index c74c555..852745c 100644 (file)
@@ -8,7 +8,6 @@ import java.util.Iterator;
 import java.util.Map;
 
 import com.quantum.model.Bookmark;
-import com.quantum.model.ConnectionException;
 import com.quantum.model.NotConnectedException;
 import com.quantum.model.Schema;
 
@@ -24,7 +23,7 @@ public class BookmarkNode extends TreeNode implements PropertyChangeListener {
         this.bookmark.addPropertyChangeListener(this);
     }
 
-       public Object[] getChildren() {
+       public Object[] getChildren() throws NotConnectedException, SQLException {
                if (bookmark.isConnected() && this.children.isEmpty()) {
             initializeChildren();
                }
@@ -35,7 +34,7 @@ public class BookmarkNode extends TreeNode implements PropertyChangeListener {
         }
        }
 
-    protected void initializeChildren() {
+    protected void initializeChildren() throws NotConnectedException, SQLException {
         boolean changed = false;
         Map temp = new HashMap();
         for (Iterator i = this.children.iterator(); i.hasNext(); ) {
@@ -74,7 +73,7 @@ public class BookmarkNode extends TreeNode implements PropertyChangeListener {
             changed = true;
         }
         
-        if (changed) {
+        if (temp.size() > 0 || changed ) {
             firePropertyChange("children", null, null);
         }
     }
@@ -97,7 +96,7 @@ public class BookmarkNode extends TreeNode implements PropertyChangeListener {
             if (this.bookmark.isConnected()) {
                 this.bookmark.disconnect();
             }
-        } catch (ConnectionException e) {
+        } catch (SQLException e) {
         }
        }
 
@@ -129,7 +128,13 @@ public class BookmarkNode extends TreeNode implements PropertyChangeListener {
             }
             firePropertyChange("connected", event.getOldValue(), event.getNewValue());
         } else if ("schemas".equals(event.getPropertyName())) {
-            initializeChildren();
+               try {
+                       initializeChildren();
+               } catch (NotConnectedException e) {
+                       this.children.clear();
+               } catch (SQLException e) {
+                       this.children.clear();
+               }
             firePropertyChange("children", event.getOldValue(), event.getNewValue());
         } else if ("name".equals(event.getPropertyName())) {
             firePropertyChange("name", event.getOldValue(), event.getNewValue());