Search in sources :

Example 1 with CatalogNode

use of net.sourceforge.sqlexplorer.dbstructure.nodes.CatalogNode in project tdq-studio-se by Talend.

the class Dictionary method load.

/**
 * Perform full load of dictionary for dbNode
 *
 * @param dbNode DatabaseNode of which to load dictionary information
 * @param monitor ProgressMonitor displayed whilst loading
 * @throws InterruptedException If user cancelled loading
 */
public void load(DatabaseNode dbNode, IProgressMonitor monitor) throws InterruptedException {
    try {
        // check for cancellation by user
        if (monitor.isCanceled()) {
            throw new InterruptedException(Messages.getString("Progress.Dictionary.Cancelled"));
        }
        INode[] children = dbNode.getChildNodes();
        if (children == null) {
            return;
        }
        // start task with a 1000 work units for every root node
        monitor.beginTask(dbNode.getSession().toString(), children.length * ROOT_WORK_UNIT);
        for (int i = 0; i < children.length; i++) {
            // check for cancellation by user
            if (monitor.isCanceled()) {
                throw new InterruptedException(Messages.getString("Progress.Dictionary.Cancelled"));
            }
            INode node = (INode) children[i];
            if (node instanceof SchemaNode || node instanceof CatalogNode) {
                loadSchemaCatalog(node, monitor);
            }
        }
        // store dictionary immediately so that
        // we can resuse it if a second session is opened
        store();
    } finally {
        monitor.done();
    }
}
Also used : SchemaNode(net.sourceforge.sqlexplorer.dbstructure.nodes.SchemaNode) INode(net.sourceforge.sqlexplorer.dbstructure.nodes.INode) CatalogNode(net.sourceforge.sqlexplorer.dbstructure.nodes.CatalogNode)

Aggregations

CatalogNode (net.sourceforge.sqlexplorer.dbstructure.nodes.CatalogNode)1 INode (net.sourceforge.sqlexplorer.dbstructure.nodes.INode)1 SchemaNode (net.sourceforge.sqlexplorer.dbstructure.nodes.SchemaNode)1