use of com.cubrid.cubridmanager.ui.cubrid.database.dialog.RestoreDatabaseDialog in project cubrid-manager by CUBRID.
the class RestoreDatabaseAction 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 RestoreDatabaseDialog dialog = new RestoreDatabaseDialog(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.loadDbBackupInfoTaskName, 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 GetBackupListTask) {
GetBackupListTask getDbBackupListTask = (GetBackupListTask) task;
dialog.setBackupList(getDbBackupListTask.getDbBackupList());
}
}
return true;
}
};
GetBackupListTask getDbBackupListTask = new GetBackupListTask(database.getServer().getServerInfo());
getDbBackupListTask.setDbName(database.getLabel());
taskExcutor.addTask(getDbBackupListTask);
new ExecTaskWithProgress(taskExcutor).busyCursorWhile();
if (taskExcutor.isSuccess()) {
dialog.open();
}
}
Aggregations