use of com.cubrid.cubridmanager.core.cubrid.database.task.GetDbSizeTask in project cubrid-manager by CUBRID.
the class CopyDatabaseAction method run.
public void run() {
Object[] obj = this.getSelectedObj();
if (!isSupported(obj[0])) {
setEnabled(false);
return;
}
ISchemaNode schemaNode = (ISchemaNode) obj[0];
final CubridDatabase database = schemaNode.getDatabase();
if (database == null) {
CommonUITool.openErrorBox(getShell(), Messages.msgSelectDB);
return;
}
GetDbSizeTask dbSizeTask = new GetDbSizeTask(database.getServer().getServerInfo());
dbSizeTask.setDbName(database.getName());
final CommonQueryTask<DbSpaceInfoList> dbSpaceInfotask = new CommonQueryTask<DbSpaceInfoList>(database.getServer().getServerInfo(), CommonSendMsg.getCommonDatabaseSendMsg(), new DbSpaceInfoList());
dbSpaceInfotask.setDbName(database.getName());
ISelectionProvider provider = getSelectionProvider();
final TreeViewer viewer = (TreeViewer) provider;
final CopyDatabaseDialog dlg = new CopyDatabaseDialog(getShell(), viewer);
dlg.execTask(-1, new SocketTask[] { dbSizeTask, dbSpaceInfotask }, true, getShell());
if (dbSpaceInfotask.getErrorMsg() != null || dbSizeTask.isCancel() || dbSizeTask.getErrorMsg() != null || dbSpaceInfotask.isCancel()) {
return;
}
dlg.setDbSize(dbSizeTask.getDbSize());
dlg.setDbSpaceInfo(dbSpaceInfotask.getResultModel());
dlg.setDatabase(database);
dlg.open();
}
Aggregations