Search in sources :

Example 76 with CommonTaskExec

use of com.cubrid.common.ui.spi.progress.CommonTaskExec in project cubrid-manager by CUBRID.

the class StopShardEnvAction method run.

/**
	 * Override the run method in order to complete stopping broker environment
	 */
public void run() {
    final Object[] obj = this.getSelectedObj();
    CubridShardFolder selection = (CubridShardFolder) obj[0];
    if (null == selection) {
        return;
    }
    if (!CommonUITool.openConfirmBox(CONFIRM_CONTENT)) {
        return;
    }
    ServerInfo serverInfo = selection.getServer().getServerInfo();
    StopShardTask task = new StopShardTask(serverInfo, null);
    TaskExecutor taskExecutor = new CommonTaskExec(Messages.stopShardEnvActionName);
    taskExecutor.addTask(task);
    new ExecTaskWithProgress(taskExecutor).exec();
    if (!taskExecutor.isSuccess()) {
        return;
    }
    if (!task.isSuccess()) {
        String msg = Messages.bind(Messages.errCanNotStopShardBroker, task.getErrorMsg());
        CommonUITool.openErrorBox(msg);
        return;
    }
    selection.setRunning(false);
    TreeViewer treeViewer = (TreeViewer) this.getSelectionProvider();
    CommonUITool.refreshNavigatorTree(treeViewer, selection);
    ActionManager.getInstance().fireSelectionChanged(getSelection());
}
Also used : CommonTaskExec(com.cubrid.common.ui.spi.progress.CommonTaskExec) 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) CubridShardFolder(com.cubrid.cubridmanager.ui.spi.model.CubridShardFolder) StopShardTask(com.cubrid.cubridmanager.core.shard.task.StopShardTask)

Example 77 with CommonTaskExec

use of com.cubrid.common.ui.spi.progress.CommonTaskExec in project cubrid-manager by CUBRID.

the class AddShardWizard method performFinish.

/**
	 * Called when user clicks Finish
	 * 
	 * @return boolean
	 */
public boolean performFinish() {
    ShardsTaskFactory taskFactory = new ShardsTaskFactory(this.server.getServerInfo(), this.shards);
    taskFactory.addUpdateFile(this.shard, null);
    CommonTaskExec taskExec = new CommonTaskExec(Messages.msgUploading);
    taskExec.setTask(taskFactory.generateTasks());
    new ExecTaskWithProgress(taskExec).exec();
    if (taskExec.isSuccess()) {
        close();
        return true;
    } else {
        CommonUITool.openErrorBox(Messages.errAddShardBroker);
        return false;
    }
}
Also used : CommonTaskExec(com.cubrid.common.ui.spi.progress.CommonTaskExec) ShardsTaskFactory(com.cubrid.cubridmanager.core.shard.task.ShardsTaskFactory) ExecTaskWithProgress(com.cubrid.common.ui.spi.progress.ExecTaskWithProgress)

Example 78 with CommonTaskExec

use of com.cubrid.common.ui.spi.progress.CommonTaskExec 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)

Example 79 with CommonTaskExec

use of com.cubrid.common.ui.spi.progress.CommonTaskExec in project cubrid-manager by CUBRID.

the class BrokerStatusView method initValue.

/**
	 * Initializes the parameters of this view
	 */
public void initValue() {
    if (null == getCubridNode() || !CubridNodeType.BROKER.equals(getCubridNode().getType())) {
        return;
    }
    brokerNode = (CubridBroker) getCubridNode();
    nodeName = brokerNode.getLabel().trim();
    serverName = brokerNode.getServer().getLabel();
    port = brokerNode.getServer().getMonPort();
    ServerInfo serverInfo = brokerNode.getServer().getServerInfo();
    //get basic info
    BrokerInfos brokerInfos = new BrokerInfos();
    //brokerInfos.setBname(nodeName);
    final GetBrokerStatusInfosTask<BrokerInfos> basicTask = new GetBrokerStatusInfosTask<BrokerInfos>(serverInfo, CommonSendMsg.getGetBrokerStatusItems(), brokerInfos);
    basicTask.setBrokerName(nodeName);
    //get status
    BrokerStatusInfos brokerStatusInfos = new BrokerStatusInfos();
    final GetBrokerStatusInfosTask<BrokerStatusInfos> statisTask = new GetBrokerStatusInfosTask<BrokerStatusInfos>(serverInfo, CommonSendMsg.getGetBrokerStatusItems(), brokerStatusInfos);
    statisTask.setBrokerName(nodeName);
    TaskExecutor taskExecutor = new CommonTaskExec(Messages.showBrokerStatusTaskName);
    taskExecutor.addTask(basicTask);
    taskExecutor.addTask(statisTask);
    new ExecTaskWithProgress(taskExecutor).exec();
    if (!taskExecutor.isSuccess()) {
        return;
    }
    brokerInfos = basicTask.getResultModel();
    if (null != brokerInfos) {
        BrokerInfoList list = brokerInfos.getBorkerInfoList();
        if (list != null && list.getBrokerInfoList() != null) {
            basicInfoLst = list.getBrokerInfoList();
        }
    }
    brokerStatusInfos = statisTask.getResultModel();
    if (brokerStatusInfos != null) {
        asinfoLst = brokerStatusInfos.getAsinfo();
        jobinfoLst = brokerStatusInfos.getJobinfo();
    }
}
Also used : CommonTaskExec(com.cubrid.common.ui.spi.progress.CommonTaskExec) TaskExecutor(com.cubrid.common.ui.spi.progress.TaskExecutor) ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo) ApplyServerInfo(com.cubrid.cubridmanager.core.broker.model.ApplyServerInfo) BrokerInfos(com.cubrid.cubridmanager.core.broker.model.BrokerInfos) GetBrokerStatusInfosTask(com.cubrid.cubridmanager.core.broker.task.GetBrokerStatusInfosTask) ExecTaskWithProgress(com.cubrid.common.ui.spi.progress.ExecTaskWithProgress) BrokerInfoList(com.cubrid.cubridmanager.core.broker.model.BrokerInfoList) BrokerStatusInfos(com.cubrid.cubridmanager.core.broker.model.BrokerStatusInfos)

Example 80 with CommonTaskExec

use of com.cubrid.common.ui.spi.progress.CommonTaskExec in project cubrid-manager by CUBRID.

the class DatabaseConfigPropertyPage method perform.

/**
	 * Perform the task and set cubrid.conf file parameter
	 *
	 * @param confParaMap the conf parameters map
	 */
private void perform(Map<String, Map<String, String>> confParaMap) {
    SetCubridConfParameterTask task = new SetCubridConfParameterTask(node.getServer().getServerInfo());
    task.setConfParameters(confParaMap);
    CommonTaskExec taskExcutor = new CommonTaskExec(Messages.setCubridParameterTaskName);
    taskExcutor.addTask(task);
    new ExecTaskWithProgress(taskExcutor).exec(true, true);
    if (taskExcutor.isSuccess()) {
        CommonUITool.openInformationBox(Messages.titleSuccess, Messages.msgChangeServerParaSuccess);
    }
}
Also used : CommonTaskExec(com.cubrid.common.ui.spi.progress.CommonTaskExec) SetCubridConfParameterTask(com.cubrid.cubridmanager.core.common.task.SetCubridConfParameterTask) ExecTaskWithProgress(com.cubrid.common.ui.spi.progress.ExecTaskWithProgress)

Aggregations

CommonTaskExec (com.cubrid.common.ui.spi.progress.CommonTaskExec)106 ExecTaskWithProgress (com.cubrid.common.ui.spi.progress.ExecTaskWithProgress)106 TaskExecutor (com.cubrid.common.ui.spi.progress.TaskExecutor)81 TreeViewer (org.eclipse.jface.viewers.TreeViewer)31 ServerInfo (com.cubrid.cubridmanager.core.common.model.ServerInfo)24 ArrayList (java.util.ArrayList)24 ICubridNode (com.cubrid.common.ui.spi.model.ICubridNode)23 CubridDatabase (com.cubrid.common.ui.spi.model.CubridDatabase)18 DatabaseInfo (com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo)14 ISchemaNode (com.cubrid.common.ui.spi.model.ISchemaNode)13 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)13 DefaultCubridNode (com.cubrid.common.ui.spi.model.DefaultCubridNode)12 LogInfo (com.cubrid.cubridmanager.core.logs.model.LogInfo)11 IEditorPart (org.eclipse.ui.IEditorPart)11 DefaultSchemaNode (com.cubrid.common.ui.spi.model.DefaultSchemaNode)9 HashMap (java.util.HashMap)9 AbstractUITask (com.cubrid.common.core.task.AbstractUITask)8 Map (java.util.Map)8 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)8 ISelectionProvider (org.eclipse.jface.viewers.ISelectionProvider)8