Search in sources :

Example 31 with ExecTaskWithProgress

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

the class StopBrokerEnvAction 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();
    CubridBrokerFolder selection = (CubridBrokerFolder) obj[0];
    if (null == selection) {
        return;
    }
    ServerInfo serverInfo = selection.getServer().getServerInfo();
    StopBrokerEnvTask task = new StopBrokerEnvTask(serverInfo);
    TaskExecutor taskExecutor = new CommonTaskExec(Messages.stopBrokerEnvTaskName);
    taskExecutor.addTask(task);
    new ExecTaskWithProgress(taskExecutor).exec();
    if (!taskExecutor.isSuccess()) {
        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) StopBrokerEnvTask(com.cubrid.cubridmanager.core.broker.task.StopBrokerEnvTask) 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) CubridBrokerFolder(com.cubrid.cubridmanager.ui.spi.model.CubridBrokerFolder)

Example 32 with ExecTaskWithProgress

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

the class QueryLogDialog method loadData.

/**
	 * load the data
	 *
	 * @return boolean
	 */
public boolean loadData() {
    CommonQueryTask<QueryLogList> task = new CommonQueryTask<QueryLogList>(server.getServerInfo(), CommonSendMsg.getCommonSimpleSendMsg(), new QueryLogList());
    TaskExecutor taskExecutor = new CommonTaskExec(Messages.loadQueryLogTaskName);
    taskExecutor.addTask(task);
    new ExecTaskWithProgress(taskExecutor).exec();
    if (!taskExecutor.isSuccess()) {
        return false;
    }
    queryLogList = task.getResultModel();
    return true;
}
Also used : CommonTaskExec(com.cubrid.common.ui.spi.progress.CommonTaskExec) TaskExecutor(com.cubrid.common.ui.spi.progress.TaskExecutor) QueryLogList(com.cubrid.cubridmanager.core.cubrid.jobauto.model.QueryLogList) ExecTaskWithProgress(com.cubrid.common.ui.spi.progress.ExecTaskWithProgress) CommonQueryTask(com.cubrid.cubridmanager.core.common.task.CommonQueryTask)

Example 33 with ExecTaskWithProgress

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

the class SettingCubridHAConfPage method loadServerData.

private void loadServerData(HAServer haServer) {
    CommonTaskExec taskExcutor = new CommonTaskExec(com.cubrid.cubridmanager.ui.host.Messages.getCubridConfTaskRunning);
    GetHAConfParameterTask getCubridConfParameterTask = new GetHAConfParameterTask(haServer.getServer().getServerInfo());
    taskExcutor.addTask(getCubridConfParameterTask);
    new ExecTaskWithProgress(taskExcutor).busyCursorWhile();
    if (taskExcutor.isSuccess()) {
        Map<String, Map<String, String>> haConfigMap = getCubridConfParameterTask.getConfParameters();
        haServer.setOrigincCubridHAParameters(haConfigMap);
        haServer.setCubridHAParameters(getConfigHAWizard().cloneParameters(haConfigMap));
        appendDefaultHAConfig(haServer.getCubridHAParameters());
    } else {
        CommonUITool.openErrorBox(Messages.errLoadCubridHAConf);
    }
}
Also used : CommonTaskExec(com.cubrid.common.ui.spi.progress.CommonTaskExec) ExecTaskWithProgress(com.cubrid.common.ui.spi.progress.ExecTaskWithProgress) GetHAConfParameterTask(com.cubrid.cubridmanager.core.common.task.GetHAConfParameterTask) HashMap(java.util.HashMap) Map(java.util.Map)

Example 34 with ExecTaskWithProgress

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

the class EditBackupPlanDialog method okPressed.

/**
	 * When press ok button,call it
	 */
public void okPressed() {
    // Gets the data of dialog
    int intLever = leverCombo.getSelectionIndex();
    if (intLever == 1 && !CommonUITool.openConfirmBox(Messages.msgLevelOneWarning)) {
        return;
    }
    if (intLever == 2 && !CommonUITool.openConfirmBox(Messages.msgLevelTwoWarning)) {
        return;
    }
    String newBackupid = idText.getText().trim();
    String newPath = pathText.getText().trim();
    String newPeriodType = periodGroup.getTextOfTypeCombo();
    String newPeriodDate = periodGroup.getDetailValue();
    String newTime = periodGroup.getTime();
    String newLever = Integer.toString(intLever);
    OnOffType newArchivedel = deleteButton.getSelection() ? OnOffType.ON : OnOffType.OFF;
    OnOffType newUpdatestatus = updateButton.getSelection() ? OnOffType.ON : OnOffType.OFF;
    String bkNum = null;
    OnOffType newStroreold = null;
    if (isBkNumSupports) {
        newStroreold = OnOffType.OFF;
        bkNum = String.valueOf(numKeepBackups.getSelection());
        if (StringUtil.isEmpty(bkNum)) {
            bkNum = "0";
        }
    } else {
        newStroreold = storeButton.getSelection() ? OnOffType.ON : OnOffType.OFF;
        bkNum = "0";
    }
    OnOffType newOnoff = onlineButton.getSelection() ? OnOffType.ON : OnOffType.OFF;
    YesNoType newZip = useCompressButton.getSelection() ? YesNoType.Y : YesNoType.N;
    YesNoType newCheck = checkingButton.getSelection() ? YesNoType.Y : YesNoType.N;
    String newMt = Integer.valueOf(numThreadspinner.getSelection()).toString();
    // Sets the object of backupPlanInfo
    backupPlanInfo.setBackupid(newBackupid);
    backupPlanInfo.setPath(newPath);
    backupPlanInfo.setPeriod_type(newPeriodType);
    backupPlanInfo.setPeriod_date(newPeriodDate);
    backupPlanInfo.setTime(newTime);
    backupPlanInfo.setLevel(newLever);
    backupPlanInfo.setArchivedel(newArchivedel.getText());
    backupPlanInfo.setUpdatestatus(newUpdatestatus.getText());
    backupPlanInfo.setStoreold(newStroreold.getText());
    backupPlanInfo.setOnoff(newOnoff.getText());
    backupPlanInfo.setZip(newZip.getText());
    backupPlanInfo.setCheck(newCheck.getText());
    backupPlanInfo.setMt(newMt);
    backupPlanInfo.setBknum(bkNum);
    // Executes the task
    ServerInfo serverInfo = database.getServer().getServerInfo();
    BackupPlanTask backupPlanTask = new BackupPlanTask(opBackupInfo, serverInfo);
    backupPlanTask.setDbname(database.getName());
    backupPlanTask.setBackupid(newBackupid);
    backupPlanTask.setPath(newPath);
    backupPlanTask.setPeriodType(newPeriodType);
    backupPlanTask.setPeriodDate(newPeriodDate);
    backupPlanTask.setTime(newTime);
    backupPlanTask.setLevel(newLever);
    backupPlanTask.setArchivedel(newArchivedel);
    backupPlanTask.setUpdatestatus(newUpdatestatus);
    backupPlanTask.setStoreold(newStroreold);
    backupPlanTask.setOnoff(newOnoff);
    backupPlanTask.setZip(newZip);
    backupPlanTask.setCheck(newCheck);
    backupPlanTask.setMt(newMt);
    backupPlanTask.setBknum(bkNum);
    String taskName = Messages.bind(Messages.editBackupPlanTaskName, newBackupid);
    TaskExecutor taskExecutor = new CommonTaskExec(taskName);
    taskExecutor.addTask(backupPlanTask);
    new ExecTaskWithProgress(taskExecutor).exec();
    if (taskExecutor.isSuccess()) {
        super.okPressed();
    }
}
Also used : CommonTaskExec(com.cubrid.common.ui.spi.progress.CommonTaskExec) TaskExecutor(com.cubrid.common.ui.spi.progress.TaskExecutor) OnOffType(com.cubrid.cubridmanager.core.common.model.OnOffType) ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo) ExecTaskWithProgress(com.cubrid.common.ui.spi.progress.ExecTaskWithProgress) BackupPlanTask(com.cubrid.cubridmanager.core.cubrid.jobauto.task.BackupPlanTask) YesNoType(com.cubrid.cubridmanager.core.utils.ModelUtil.YesNoType)

Example 35 with ExecTaskWithProgress

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

the class AnalyzeSqlLogAction method run.

/**
	 * Open dialog
	 */
public void run() {
    Object[] obj = this.getSelectedObj();
    DefaultCubridNode node = null;
    LogInfo logInfo = null;
    node = (DefaultCubridNode) obj[0];
    logInfo = (LogInfo) node.getAdapter(LogInfo.class);
    SqlLogFileListDialog cASLogTopConfigDialog = new SqlLogFileListDialog(getShell());
    List<String> targetStringList = new ArrayList<String>();
    if (logInfo == null) {
        for (int j = 0, m = node.getChildren().size(); j < m; j++) {
            targetStringList.add(((LogInfo) node.getChildren().get(j).getAdapter(LogInfo.class)).getPath());
        }
    } else {
        targetStringList.add(logInfo.getPath());
    }
    cASLogTopConfigDialog.create();
    cASLogTopConfigDialog.setInfo(targetStringList);
    int returnCode = cASLogTopConfigDialog.open();
    if (returnCode == SqlLogFileListDialog.OK) {
        String optionT;
        final GetAnalyzeCasLogTask task = new GetAnalyzeCasLogTask(node.getServer().getServerInfo());
        if (cASLogTopConfigDialog.isOption()) {
            optionT = "yes";
        } else {
            optionT = "no";
        }
        List<String> selectedStringList = cASLogTopConfigDialog.getSelectedStringList();
        String[] path = new String[selectedStringList.size()];
        selectedStringList.toArray(path);
        task.setLogFiles(path);
        task.setOptionT(optionT);
        TaskExecutor taskExcutor = new CommonTaskExec(Messages.loadLogTaskName);
        taskExcutor.addTask(task);
        new ExecTaskWithProgress(taskExcutor).exec();
        if (!taskExcutor.isSuccess()) {
            return;
        }
        AnalyzeCasLogResultList analyzeCasLogResultList = (AnalyzeCasLogResultList) task.getAnalyzeCasLogResultList();
        SqlLogAnalyzeResultDialog activityCASLogPathDialog = new SqlLogAnalyzeResultDialog(getShell());
        activityCASLogPathDialog.setOption(cASLogTopConfigDialog.isOption());
        activityCASLogPathDialog.setNode(node);
        activityCASLogPathDialog.setResultFile(analyzeCasLogResultList.getResultfile());
        activityCASLogPathDialog.setAnalyzeCasLogResultList(analyzeCasLogResultList);
        activityCASLogPathDialog.create();
        activityCASLogPathDialog.setLabel(selectedStringList);
        activityCASLogPathDialog.insertArrayToTable(analyzeCasLogResultList);
        activityCASLogPathDialog.open();
    }
}
Also used : CommonTaskExec(com.cubrid.common.ui.spi.progress.CommonTaskExec) AnalyzeCasLogResultList(com.cubrid.cubridmanager.core.logs.model.AnalyzeCasLogResultList) DefaultCubridNode(com.cubrid.common.ui.spi.model.DefaultCubridNode) LogInfo(com.cubrid.cubridmanager.core.logs.model.LogInfo) GetAnalyzeCasLogTask(com.cubrid.cubridmanager.core.logs.task.GetAnalyzeCasLogTask) ArrayList(java.util.ArrayList) SqlLogAnalyzeResultDialog(com.cubrid.cubridmanager.ui.logs.dialog.SqlLogAnalyzeResultDialog) SqlLogFileListDialog(com.cubrid.cubridmanager.ui.logs.dialog.SqlLogFileListDialog) TaskExecutor(com.cubrid.common.ui.spi.progress.TaskExecutor) ExecTaskWithProgress(com.cubrid.common.ui.spi.progress.ExecTaskWithProgress)

Aggregations

ExecTaskWithProgress (com.cubrid.common.ui.spi.progress.ExecTaskWithProgress)155 TaskExecutor (com.cubrid.common.ui.spi.progress.TaskExecutor)124 CommonTaskExec (com.cubrid.common.ui.spi.progress.CommonTaskExec)106 ServerInfo (com.cubrid.cubridmanager.core.common.model.ServerInfo)40 TreeViewer (org.eclipse.jface.viewers.TreeViewer)39 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)37 ITask (com.cubrid.common.core.task.ITask)35 CubridDatabase (com.cubrid.common.ui.spi.model.CubridDatabase)30 ArrayList (java.util.ArrayList)29 ICubridNode (com.cubrid.common.ui.spi.model.ICubridNode)26 DatabaseInfo (com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo)25 ISchemaNode (com.cubrid.common.ui.spi.model.ISchemaNode)23 Shell (org.eclipse.swt.widgets.Shell)15 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)14 HashMap (java.util.HashMap)13 Map (java.util.Map)13 ISelectionProvider (org.eclipse.jface.viewers.ISelectionProvider)13 DefaultCubridNode (com.cubrid.common.ui.spi.model.DefaultCubridNode)12 IEditorPart (org.eclipse.ui.IEditorPart)12 LogInfo (com.cubrid.cubridmanager.core.logs.model.LogInfo)11