[Squirrel-sql-commits] sql12/app/src/net/sourceforge/squirrel_sql/client/session/mainpanel/objecttr
A Java SQL client for any JDBC compliant database
Brought to you by:
colbell,
gerdwagner
From: Rob M. <man...@us...> - 2006-10-04 01:48:27
|
Update of /cvsroot/squirrel-sql/sql12/app/src/net/sourceforge/squirrel_sql/client/session/mainpanel/objecttree In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv19882/app/src/net/sourceforge/squirrel_sql/client/session/mainpanel/objecttree Modified Files: ObjectTreePanel.java Log Message: 1563610: Enhanced the catalog selection so that changing the catalog updates the schema info and expands the TABLES node in the tree for the selected catalog. Index: ObjectTreePanel.java =================================================================== RCS file: /cvsroot/squirrel-sql/sql12/app/src/net/sourceforge/squirrel_sql/client/session/mainpanel/objecttree/ObjectTreePanel.java,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** ObjectTreePanel.java 3 May 2006 10:49:38 -0000 1.32 --- ObjectTreePanel.java 30 Sep 2006 13:55:32 -0000 1.33 *************** *** 350,353 **** --- 350,366 ---- } + /** + * Expands the specified tree node. + * + * @param node the tree node to expand + */ + public void expandNode(ObjectTreeNode node) { + IDatabaseObjectInfo info = node.getDatabaseObjectInfo(); + TreePath path = getTreePath(info.getCatalogName(), + info.getSchemaName(), + info.getSimpleName()); + _tree.fireTreeExpanded(path); + } + private void _addDetailTab(final DatabaseObjectType dboType, final IObjectTab tab) *************** *** 667,677 **** return false; } - ObjectTreeModel otm = (ObjectTreeModel) _tree.getModel(); - TreePath treePath = otm.getPathToDbInfo(catalog, schema, object, (ObjectTreeNode) otm.getRoot(), false); - if(null == treePath) - { - treePath = otm.getPathToDbInfo(catalog, schema, object, (ObjectTreeNode) otm.getRoot(), true); - } if(null != treePath) { --- 680,685 ---- return false; } + TreePath treePath = getTreePath(catalog, schema, object); if(null != treePath) { *************** *** 687,690 **** --- 695,728 ---- /** + * Get the TreePath to the node with the specified catalog, schema and + * object name. + * + * @param catalog the catalog that the node is located in - can be null + * @param schema the schema that the node is located in - can be null + * @param object display name of the node + * + * @return the TreePath to the node with the specified criteria, or the root + * node if a node with matching characteristics isn't found. + */ + private TreePath getTreePath(String catalog, String schema, String object) { + ObjectTreeModel otm = (ObjectTreeModel) _tree.getModel(); + TreePath treePath = + otm.getPathToDbInfo(catalog, + schema, + object, + (ObjectTreeNode) otm.getRoot(), + false); + if(null == treePath) + { + treePath = otm.getPathToDbInfo(catalog, + schema, + object, + (ObjectTreeNode) otm.getRoot(), + true); + } + return treePath; + } + + /** * Add a known database object type to the object tree. * |