Search in sources :

Example 1 with GetDbSizeTask

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();
}
Also used : CopyDatabaseDialog(com.cubrid.cubridmanager.ui.cubrid.database.dialog.CopyDatabaseDialog) GetDbSizeTask(com.cubrid.cubridmanager.core.cubrid.database.task.GetDbSizeTask) ISelectionProvider(org.eclipse.jface.viewers.ISelectionProvider) ISchemaNode(com.cubrid.common.ui.spi.model.ISchemaNode) TreeViewer(org.eclipse.jface.viewers.TreeViewer) DbSpaceInfoList(com.cubrid.cubridmanager.core.cubrid.dbspace.model.DbSpaceInfoList) CommonQueryTask(com.cubrid.cubridmanager.core.common.task.CommonQueryTask) CubridDatabase(com.cubrid.common.ui.spi.model.CubridDatabase)

Aggregations

CubridDatabase (com.cubrid.common.ui.spi.model.CubridDatabase)1 ISchemaNode (com.cubrid.common.ui.spi.model.ISchemaNode)1 CommonQueryTask (com.cubrid.cubridmanager.core.common.task.CommonQueryTask)1 GetDbSizeTask (com.cubrid.cubridmanager.core.cubrid.database.task.GetDbSizeTask)1 DbSpaceInfoList (com.cubrid.cubridmanager.core.cubrid.dbspace.model.DbSpaceInfoList)1 CopyDatabaseDialog (com.cubrid.cubridmanager.ui.cubrid.database.dialog.CopyDatabaseDialog)1 ISelectionProvider (org.eclipse.jface.viewers.ISelectionProvider)1 TreeViewer (org.eclipse.jface.viewers.TreeViewer)1