Search in sources :

Example 1 with SchemaNode

use of org.talend.sqlbuilder.dbstructure.nodes.SchemaNode in project tdi-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()) {
            //$NON-NLS-1$
            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()) {
                //$NON-NLS-1$
                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(org.talend.sqlbuilder.dbstructure.nodes.SchemaNode) INode(org.talend.sqlbuilder.dbstructure.nodes.INode) CatalogNode(org.talend.sqlbuilder.dbstructure.nodes.CatalogNode)

Aggregations

CatalogNode (org.talend.sqlbuilder.dbstructure.nodes.CatalogNode)1 INode (org.talend.sqlbuilder.dbstructure.nodes.INode)1 SchemaNode (org.talend.sqlbuilder.dbstructure.nodes.SchemaNode)1