Search in sources :

Example 1 with DefaultProgressMonitor

use of org.jkiss.dbeaver.model.runtime.DefaultProgressMonitor in project dbeaver by serge-rider.

the class DatabaseConsumerSettings method loadNode.

public void loadNode(IRunnableContext runnableContext) {
    if (containerNode == null && !CommonUtils.isEmpty(containerNodePath)) {
        if (!CommonUtils.isEmpty(containerNodePath)) {
            try {
                runnableContext.run(true, true, new IRunnableWithProgress() {

                    @Override
                    public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
                        try {
                            DBNNode node = DBeaverCore.getInstance().getNavigatorModel().getNodeByPath(new DefaultProgressMonitor(monitor), containerNodePath);
                            if (node instanceof DBNDatabaseNode) {
                                containerNode = (DBNDatabaseNode) node;
                            }
                        } catch (DBException e) {
                            throw new InvocationTargetException(e);
                        }
                    }
                });
                checkContainerConnection(runnableContext);
            } catch (InvocationTargetException e) {
                log.error("Error getting container node", e.getTargetException());
            } catch (InterruptedException e) {
            // ignore
            }
        }
    }
}
Also used : DBException(org.jkiss.dbeaver.DBException) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) DBNNode(org.jkiss.dbeaver.model.navigator.DBNNode) DefaultProgressMonitor(org.jkiss.dbeaver.model.runtime.DefaultProgressMonitor) DBNDatabaseNode(org.jkiss.dbeaver.model.navigator.DBNDatabaseNode) InvocationTargetException(java.lang.reflect.InvocationTargetException) IRunnableWithProgress(org.eclipse.jface.operation.IRunnableWithProgress)

Aggregations

InvocationTargetException (java.lang.reflect.InvocationTargetException)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 IRunnableWithProgress (org.eclipse.jface.operation.IRunnableWithProgress)1 DBException (org.jkiss.dbeaver.DBException)1 DBNDatabaseNode (org.jkiss.dbeaver.model.navigator.DBNDatabaseNode)1 DBNNode (org.jkiss.dbeaver.model.navigator.DBNNode)1 DefaultProgressMonitor (org.jkiss.dbeaver.model.runtime.DefaultProgressMonitor)1