use of com.cubrid.cubridmanager.ui.cubrid.database.dialog.LoadDatabaseDialog in project cubrid-manager by CUBRID.
the class LoadDatabaseAction method run.
public void run() {
Object[] obj = this.getSelectedObj();
if (!isSupported(obj[0])) {
setEnabled(false);
return;
}
ISchemaNode node = (ISchemaNode) obj[0];
final CubridDatabase database = node.getDatabase();
final LoadDatabaseDialog dialog = new LoadDatabaseDialog(getShell());
dialog.setDatabase(database);
final Shell shell = getShell();
TaskExecutor taskExcutor = new TaskExecutor() {
public boolean exec(final IProgressMonitor monitor) {
if (monitor.isCanceled()) {
return false;
}
monitor.beginTask(Messages.loadDbUnloadInfoTaskName, IProgressMonitor.UNKNOWN);
for (ITask task : taskList) {
task.execute();
final String msg = task.getErrorMsg();
if (openErrorBox(shell, msg, monitor)) {
return false;
}
if (monitor.isCanceled()) {
return false;
}
if (task instanceof GetDbUnloadInfoTask) {
GetDbUnloadInfoTask getDbUnloadInfoTask = (GetDbUnloadInfoTask) task;
List<DbUnloadInfo> dbUnloadInfoList = getDbUnloadInfoTask.getDbUnloadInfoList();
dialog.setDbUnloadInfoList(dbUnloadInfoList);
}
}
return true;
}
};
ServerInfo serverInfo = database.getServer().getServerInfo();
GetDbUnloadInfoTask task = new GetDbUnloadInfoTask(serverInfo);
taskExcutor.addTask(task);
new ExecTaskWithProgress(taskExcutor).busyCursorWhile();
if (taskExcutor.isSuccess()) {
dialog.open();
}
}
Aggregations