package net.sourceforge.phpdt.sql.view.bookmark;
-import java.util.Collections;
import java.util.Vector;
+import org.eclipse.core.runtime.CoreException;
+
import net.sourceforge.phpdt.sql.bookmarks.Bookmark;
+import net.sourceforge.phpdt.sql.sql.metadata.ObjectMetaData;
public class BookmarkNode extends Bookmark implements TreeNode {
private Vector children = new Vector();
-
+ public ObjectMetaData getMetaData() {
+ return null; //no metadata implementation for now
+ }
public BookmarkNode() {
}
Object obj = children.elementAt(i);
isValid(obj);
}
- Collections.sort(children);
this.children = children;
}
boolean valid = false;
if (child instanceof TableNode ||
child instanceof ViewNode ||
- child instanceof SequenceNode) {
+ child instanceof SequenceNode ||
+ child instanceof GroupNode) {
valid = true;
}
if (!valid) {
- throw new RuntimeException("Invalid BookmarkNode child: " + child.getClass().getName());
+ throw new RuntimeException("Invalid BookmarkNode child: " + child.getClass().getName()); //$NON-NLS-1$
+ }
+ }
+
+ public void dispose() throws CoreException {
+ if (isConnected()) {
+ disconnect();
+ }
+ }
+
+ /**
+ * Finds a child of the BookmarkNode with the said name
+ * @param name
+ * @return the TreeNode found. null if none
+ */
+ public TreeNode find(String name){
+ for (int i = 0; i < children.size(); i++) {
+ Object obj = children.elementAt(i);
+ if (obj instanceof TreeNode){
+ TreeNode node = (TreeNode) obj;
+ if (name.equals(node.getName())) return node;
+ }
}
+ return null;
}
+
}