Search in sources :

Example 1 with DelBackupPlanTask

use of com.cubrid.cubridmanager.core.cubrid.jobauto.task.DelBackupPlanTask in project cubrid-manager by CUBRID.

the class SetupEnvTestCase method deleteBackupPlan.

public boolean deleteBackupPlan(String backupPlanId) {
    DelBackupPlanTask task = new DelBackupPlanTask(serverInfo);
    task.setDbname(testDbName);
    task.setBackupid(backupPlanId);
    task.execute();
    return task.isSuccess();
}
Also used : DelBackupPlanTask(com.cubrid.cubridmanager.core.cubrid.jobauto.task.DelBackupPlanTask)

Example 2 with DelBackupPlanTask

use of com.cubrid.cubridmanager.core.cubrid.jobauto.task.DelBackupPlanTask in project cubrid-manager by CUBRID.

the class DeleteBackupPlanAction method run.

/**
	 * Deletes the selected backup plan
	 * 
	 */
public void run(ISchemaNode[] nodeArray) {
    List<String> nodeNames = new ArrayList<String>();
    for (Object obj : nodeArray) {
        ICubridNode selection = (ICubridNode) obj;
        nodeNames.add(selection.getLabel());
    }
    if (!CommonUITool.openConfirmBox(Messages.bind(Messages.delBackupPlanConfirmContent, nodeNames))) {
        return;
    }
    String taskName = Messages.bind(Messages.delBackupPlanTaskName, nodeNames);
    CommonTaskExec taskExecutor = new CommonTaskExec(taskName);
    for (Object obj : nodeArray) {
        CubridDatabase database = null;
        if (obj instanceof DefaultSchemaNode) {
            database = ((DefaultSchemaNode) obj).getDatabase();
        }
        if (database == null) {
            CommonUITool.openErrorBox(Messages.msgSelectDB);
            return;
        }
        ServerInfo serverInfo = database.getServer().getServerInfo();
        DelBackupPlanTask delBackupPlanTask = new DelBackupPlanTask(serverInfo);
        delBackupPlanTask.setDbname(database.getName());
        String backupid = ((DefaultSchemaNode) obj).getLabel();
        delBackupPlanTask.setBackupid(backupid);
        taskExecutor.addTask(delBackupPlanTask);
    }
    new ExecTaskWithProgress(taskExecutor).exec();
    if (!taskExecutor.isSuccess()) {
        return;
    }
    for (Object obj : nodeArray) {
        TreeViewer treeViewer = (TreeViewer) this.getSelectionProvider();
        DefaultSchemaNode delNode = ((DefaultSchemaNode) obj);
        ICubridNode parentNode = delNode.getParent();
        parentNode.removeChild(delNode);
        treeViewer.remove(delNode);
    }
}
Also used : CommonTaskExec(com.cubrid.common.ui.spi.progress.CommonTaskExec) ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo) TreeViewer(org.eclipse.jface.viewers.TreeViewer) ArrayList(java.util.ArrayList) ExecTaskWithProgress(com.cubrid.common.ui.spi.progress.ExecTaskWithProgress) ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode) CubridDatabase(com.cubrid.common.ui.spi.model.CubridDatabase) DefaultSchemaNode(com.cubrid.common.ui.spi.model.DefaultSchemaNode) DelBackupPlanTask(com.cubrid.cubridmanager.core.cubrid.jobauto.task.DelBackupPlanTask)

Aggregations

DelBackupPlanTask (com.cubrid.cubridmanager.core.cubrid.jobauto.task.DelBackupPlanTask)2 CubridDatabase (com.cubrid.common.ui.spi.model.CubridDatabase)1 DefaultSchemaNode (com.cubrid.common.ui.spi.model.DefaultSchemaNode)1 ICubridNode (com.cubrid.common.ui.spi.model.ICubridNode)1 CommonTaskExec (com.cubrid.common.ui.spi.progress.CommonTaskExec)1 ExecTaskWithProgress (com.cubrid.common.ui.spi.progress.ExecTaskWithProgress)1 ServerInfo (com.cubrid.cubridmanager.core.common.model.ServerInfo)1 ArrayList (java.util.ArrayList)1 TreeViewer (org.eclipse.jface.viewers.TreeViewer)1