use of com.cubrid.cubridmanager.core.logs.task.GetManagerLogListTask in project cubrid-manager by CUBRID.
the class RemoveAllManagerLogAction method refreshLogEditor.
/**
*
* Refresh the log editor
*
* @param node ICubridNode
*/
private void refreshLogEditor(ICubridNode node) {
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
IWorkbenchPage activePage = window.getActivePage();
IEditorPart editor = activePage.findEditor(node);
if (null != editor) {
GetManagerLogListTask task = new GetManagerLogListTask(node.getServer().getServerInfo());
TaskExecutor taskExecutor = new CommonTaskExec(Messages.viewLogJobName);
taskExecutor.addTask(task);
new ExecTaskWithProgress(taskExecutor).busyCursorWhile();
ManagerLogInfos managerLogInfos = (ManagerLogInfos) task.getLogContent();
try {
editor = window.getActivePage().openEditor(node, LogEditorPart.ID);
((LogEditorPart) editor).setManagerLogInfo(managerLogInfos, false);
} catch (PartInitException e) {
LOGGER.error(e.getMessage(), e);
}
}
}
use of com.cubrid.cubridmanager.core.logs.task.GetManagerLogListTask in project cubrid-manager by CUBRID.
the class ManagerLogViewAction method run.
/**
* Open the log editor and show log conent
*/
public void run() {
final IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (window == null) {
return;
}
if (cubridNode == null) {
Object[] obj = this.getSelectedObj();
if (!isSupported(obj[0])) {
setEnabled(false);
return;
}
cubridNode = (ICubridNode) obj[0];
}
final GetManagerLogListTask task = new GetManagerLogListTask(cubridNode.getServer().getServerInfo());
TaskJobExecutor taskJobExecutor = new TaskJobExecutor() {
public IStatus exec(IProgressMonitor monitor) {
if (monitor.isCanceled()) {
cubridNode = null;
return Status.CANCEL_STATUS;
}
for (ITask t : taskList) {
t.execute();
final String msg = t.getErrorMsg();
if (monitor.isCanceled()) {
cubridNode = null;
return Status.CANCEL_STATUS;
}
if (msg != null && msg.length() > 0 && !monitor.isCanceled()) {
cubridNode = null;
return new Status(IStatus.ERROR, CubridManagerUIPlugin.PLUGIN_ID, msg);
} else {
Display.getDefault().syncExec(new Runnable() {
public void run() {
ManagerLogInfos managerLogInfos = (ManagerLogInfos) task.getLogContent();
IEditorPart editorPart = LayoutUtil.getEditorPart(cubridNode, LogEditorPart.ID);
if (editorPart != null) {
window.getActivePage().closeEditor(editorPart, false);
}
try {
IEditorPart editor = window.getActivePage().openEditor(cubridNode, LogEditorPart.ID);
((LogEditorPart) editor).setManagerLogInfo(managerLogInfos, true);
} catch (PartInitException e) {
LOGGER.error(e.getMessage(), e);
}
}
});
}
if (monitor.isCanceled()) {
cubridNode = null;
return Status.CANCEL_STATUS;
}
}
cubridNode = null;
return Status.OK_STATUS;
}
};
taskJobExecutor.addTask(task);
String jobName = Messages.viewLogJobName + " - " + cubridNode.getName() + "@" + cubridNode.getServer().getName();
taskJobExecutor.schedule(jobName, null, false, Job.SHORT);
}
use of com.cubrid.cubridmanager.core.logs.task.GetManagerLogListTask in project cubrid-manager by CUBRID.
the class LogEditorPart method managerConnect.
/**
* each page of manager log connect
*
*/
public void managerConnect() {
GetManagerLogListTask task = null;
if (charsetName == null) {
task = new GetManagerLogListTask(this.cubridNode.getServer().getServerInfo());
} else {
task = new GetManagerLogListTask(this.cubridNode.getServer().getServerInfo(), charsetName);
}
TaskJobExecutor taskJobExecutor = new TaskJobExecutor() {
public IStatus exec(IProgressMonitor monitor) {
if (monitor.isCanceled()) {
return Status.CANCEL_STATUS;
}
for (final ITask task : taskList) {
task.execute();
final String msg = task.getErrorMsg();
if (monitor.isCanceled()) {
return Status.CANCEL_STATUS;
}
if (msg != null && msg.length() > 0 && !monitor.isCanceled()) {
return new Status(IStatus.ERROR, CubridManagerUIPlugin.PLUGIN_ID, msg);
} else {
Display.getDefault().asyncExec(new Runnable() {
public void run() {
GetManagerLogListTask getLogListTask = (GetManagerLogListTask) task;
ManagerLogInfos managerLogInfos = (ManagerLogInfos) getLogListTask.getLogContent();
setManagerLogInfo(managerLogInfos, false);
}
});
}
if (monitor.isCanceled()) {
return Status.CANCEL_STATUS;
}
}
return Status.OK_STATUS;
}
};
taskJobExecutor.addTask(task);
String jobName = Messages.viewLogJobName + " - " + cubridNode.getName() + "@" + cubridNode.getServer().getName();
taskJobExecutor.schedule(jobName, null, false, Job.SHORT);
}
Aggregations