Search in sources :

Example 1 with SqlLogAnalyzeResultDialog

use of com.cubrid.cubridmanager.ui.logs.dialog.SqlLogAnalyzeResultDialog 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

DefaultCubridNode (com.cubrid.common.ui.spi.model.DefaultCubridNode)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 AnalyzeCasLogResultList (com.cubrid.cubridmanager.core.logs.model.AnalyzeCasLogResultList)1 LogInfo (com.cubrid.cubridmanager.core.logs.model.LogInfo)1 GetAnalyzeCasLogTask (com.cubrid.cubridmanager.core.logs.task.GetAnalyzeCasLogTask)1 SqlLogAnalyzeResultDialog (com.cubrid.cubridmanager.ui.logs.dialog.SqlLogAnalyzeResultDialog)1 SqlLogFileListDialog (com.cubrid.cubridmanager.ui.logs.dialog.SqlLogFileListDialog)1 ArrayList (java.util.ArrayList)1