public TreePath getPathToDbInfo(String catalog, String schema, FilterMatcher objectMatcher, ObjectTreeNode startNode, boolean useExpanders)
{
if(dbObjectInfoEquals(catalog, schema, objectMatcher, startNode.getDatabaseObjectInfo()))
{
return new TreePath(startNode.getPath());
}
else
{
if(useExpanders && 0 == startNode.getChildCount())
{
INodeExpander[] expanders = getExpanders(startNode.getDatabaseObjectType());
for (int i = 0; i < expanders.length; i++)
{
try
{
List<ObjectTreeNode> children =
expanders[i].createChildren(startNode.getSession(), startNode);
for (int j = 0; j < children.size(); j++)
{
ObjectTreeNode newChild = children.get(j);
if(0 == getExpanders(newChild.getDatabaseObjectType()).length)
{
newChild.setAllowsChildren(false);
}
else
{
newChild.setAllowsChildren(true);
}
startNode.add(newChild);
}
}
catch (Exception e)
{
String msg =
"Error loading object type " + startNode.getDatabaseObjectType() +
". Error: " + e.toString() + ". See SQuirreL Logs for stackttrace.";
startNode.getSession().showErrorMessage(msg);
logger.error(msg, e);
}
}
}
for(int i=0; i < startNode.getChildCount(); ++i)
{
TreePath ret = getPathToDbInfo(catalog, schema, objectMatcher, (ObjectTreeNode) startNode.getChildAt(i), useExpanders);
if(null != ret)
{
return ret;
}
}