Search in sources :

Example 1 with UpdateStatusTemplateTask

use of com.cubrid.cubridmanager.core.monitoring.task.UpdateStatusTemplateTask in project cubrid-manager by CUBRID.

the class EditStatusMonitorTemplateAction method run.

/**
	 * Override the run method in order to open an instance of status monitor
	 * dialog
	 * 
	 */
public void run() {
    Object[] obj = this.getSelectedObj();
    ICubridNode selection = (ICubridNode) obj[0];
    ServerInfo serverInfo = selection.getServer().getServerInfo();
    boolean execDiagChecked = false;
    final GetCMConfParameterTask task = new GetCMConfParameterTask(serverInfo);
    TaskExecutor taskExec = new CommonTaskExec(null);
    taskExec.addTask(task);
    new ExecTaskWithProgress(taskExec).exec();
    if (!taskExec.isSuccess()) {
        return;
    }
    Map<String, String> confParas = task.getConfParameters();
    if (confParas == null) {
        execDiagChecked = false;
    } else {
        if (confParas.get(ConfConstants.EXECUTE_DIAG) == null) {
            execDiagChecked = false;
        } else {
            execDiagChecked = confParas.get(ConfConstants.EXECUTE_DIAG).equals(OnOffType.ON.getText()) ? true : false;
        }
    }
    DiagStatusMonitorTemplateDialog dialog = new DiagStatusMonitorTemplateDialog(getShell());
    dialog.setOperation(AddEditType.EDIT);
    dialog.setSelection(selection);
    dialog.setExecDiagChecked(execDiagChecked);
    if (dialog.open() == Dialog.OK) {
        StatusTemplateInfo statusTemplateInfo = dialog.getStatusTemplateInfo();
        UpdateStatusTemplateTask updateTask = new UpdateStatusTemplateTask(serverInfo);
        updateTask.setStatusTemplateInfo(statusTemplateInfo);
        updateTask.buildMsg();
        String taskName = Messages.bind(Messages.editTemplateTaskName, statusTemplateInfo.getName());
        TaskExecutor taskExecutor = new CommonTaskExec(taskName);
        taskExecutor.addTask(updateTask);
        new ExecTaskWithProgress(taskExecutor).exec();
        if (taskExecutor.isSuccess()) {
            TreeViewer treeViewer = (TreeViewer) this.getSelectionProvider();
            CommonUITool.refreshNavigatorTree(treeViewer, selection.getParent());
        }
    }
}
Also used : DiagStatusMonitorTemplateDialog(com.cubrid.cubridmanager.ui.monitoring.dialog.DiagStatusMonitorTemplateDialog) CommonTaskExec(com.cubrid.common.ui.spi.progress.CommonTaskExec) ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo) TreeViewer(org.eclipse.jface.viewers.TreeViewer) ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode) TaskExecutor(com.cubrid.common.ui.spi.progress.TaskExecutor) GetCMConfParameterTask(com.cubrid.cubridmanager.core.common.task.GetCMConfParameterTask) StatusTemplateInfo(com.cubrid.cubridmanager.core.monitoring.model.StatusTemplateInfo) ExecTaskWithProgress(com.cubrid.common.ui.spi.progress.ExecTaskWithProgress) UpdateStatusTemplateTask(com.cubrid.cubridmanager.core.monitoring.task.UpdateStatusTemplateTask)

Aggregations

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 TaskExecutor (com.cubrid.common.ui.spi.progress.TaskExecutor)1 ServerInfo (com.cubrid.cubridmanager.core.common.model.ServerInfo)1 GetCMConfParameterTask (com.cubrid.cubridmanager.core.common.task.GetCMConfParameterTask)1 StatusTemplateInfo (com.cubrid.cubridmanager.core.monitoring.model.StatusTemplateInfo)1 UpdateStatusTemplateTask (com.cubrid.cubridmanager.core.monitoring.task.UpdateStatusTemplateTask)1 DiagStatusMonitorTemplateDialog (com.cubrid.cubridmanager.ui.monitoring.dialog.DiagStatusMonitorTemplateDialog)1 TreeViewer (org.eclipse.jface.viewers.TreeViewer)1