use of com.cubrid.cubridmanager.core.logs.task.GetAnalyzeCasLogTask 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();
}
}
Aggregations