Search in sources :

Example 1 with StopBrokerTask

use of com.cubrid.cubridmanager.core.broker.task.StopBrokerTask in project cubrid-manager by CUBRID.

the class RestartBrokerAction method run.

public void run() {
    final Object[] obj = this.getSelectedObj();
    DefaultCubridNode selection = (DefaultCubridNode) obj[0];
    if (selection == null || selection.getServer() == null) {
        return;
    }
    ServerInfo serverInfo = selection.getServer().getServerInfo();
    if (serverInfo == null) {
        return;
    }
    //stop first
    StopBrokerTask stopTask = new StopBrokerTask(serverInfo);
    stopTask.setBrokerName(selection.getLabel());
    //then start again
    StartBrokerTask startTask = new StartBrokerTask(serverInfo);
    startTask.setBrokerName(selection.getLabel());
    final String taskName = Messages.bind(Messages.restartBrokerTaskName, selection.getLabel());
    TaskExecutor taskExecutor = new CommonTaskExec(taskName);
    taskExecutor.addTask(stopTask);
    taskExecutor.addTask(startTask);
    new ExecTaskWithProgress(taskExecutor).exec();
    if (!taskExecutor.isSuccess()) {
        return;
    }
    TreeViewer treeViewer = (TreeViewer) this.getSelectionProvider();
    CommonUITool.refreshNavigatorTree(treeViewer, selection.getParent());
    ActionManager.getInstance().fireSelectionChanged(getSelection());
}
Also used : CommonTaskExec(com.cubrid.common.ui.spi.progress.CommonTaskExec) DefaultCubridNode(com.cubrid.common.ui.spi.model.DefaultCubridNode) StartBrokerTask(com.cubrid.cubridmanager.core.broker.task.StartBrokerTask) TaskExecutor(com.cubrid.common.ui.spi.progress.TaskExecutor) ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo) TreeViewer(org.eclipse.jface.viewers.TreeViewer) ExecTaskWithProgress(com.cubrid.common.ui.spi.progress.ExecTaskWithProgress) StopBrokerTask(com.cubrid.cubridmanager.core.broker.task.StopBrokerTask)

Example 2 with StopBrokerTask

use of com.cubrid.cubridmanager.core.broker.task.StopBrokerTask in project cubrid-manager by CUBRID.

the class StopBrokerAction method run.

/**
	 * Override the run method in order to complete stopping broker environment
	 */
public void run() {
    if (!CommonUITool.openConfirmBox(CONFIRM_CONTENT)) {
        return;
    }
    final Object[] obj = this.getSelectedObj();
    DefaultCubridNode selection = (DefaultCubridNode) obj[0];
    ServerInfo serverInfo = selection.getServer().getServerInfo();
    StopBrokerTask task = new StopBrokerTask(serverInfo);
    task.setBrokerName(selection.getLabel());
    final String taskName = Messages.bind(Messages.stopBrokerTaskName, selection.getLabel());
    TaskExecutor taskExecutor = new CommonTaskExec(taskName);
    taskExecutor.addTask(task);
    new ExecTaskWithProgress(taskExecutor).exec();
    if (!taskExecutor.isSuccess()) {
        return;
    }
    TreeViewer treeViewer = (TreeViewer) this.getSelectionProvider();
    CommonUITool.refreshNavigatorTree(treeViewer, selection.getParent());
    ActionManager.getInstance().fireSelectionChanged(getSelection());
}
Also used : CommonTaskExec(com.cubrid.common.ui.spi.progress.CommonTaskExec) DefaultCubridNode(com.cubrid.common.ui.spi.model.DefaultCubridNode) TaskExecutor(com.cubrid.common.ui.spi.progress.TaskExecutor) ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo) TreeViewer(org.eclipse.jface.viewers.TreeViewer) ExecTaskWithProgress(com.cubrid.common.ui.spi.progress.ExecTaskWithProgress) StopBrokerTask(com.cubrid.cubridmanager.core.broker.task.StopBrokerTask)

Aggregations

DefaultCubridNode (com.cubrid.common.ui.spi.model.DefaultCubridNode)2 CommonTaskExec (com.cubrid.common.ui.spi.progress.CommonTaskExec)2 ExecTaskWithProgress (com.cubrid.common.ui.spi.progress.ExecTaskWithProgress)2 TaskExecutor (com.cubrid.common.ui.spi.progress.TaskExecutor)2 StopBrokerTask (com.cubrid.cubridmanager.core.broker.task.StopBrokerTask)2 ServerInfo (com.cubrid.cubridmanager.core.common.model.ServerInfo)2 TreeViewer (org.eclipse.jface.viewers.TreeViewer)2 StartBrokerTask (com.cubrid.cubridmanager.core.broker.task.StartBrokerTask)1