use of com.cubrid.cubridmanager.core.logs.task.GetLogListTask in project cubrid-manager by CUBRID.
the class ResetAdminLogAction 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) {
LogInfo logInfo = (LogInfo) node.getAdapter(LogInfo.class);
TaskExecutor taskExecutor = new CommonTaskExec(Messages.viewLogJobName);
GetLogListTask task = new GetLogListTask(node.getServer().getServerInfo());
task.setPath(logInfo.getPath());
task.setStart("1");
task.setEnd("100");
taskExecutor.addTask(task);
new ExecTaskWithProgress(taskExecutor).busyCursorWhile();
LogContentInfo logContentInfo = (LogContentInfo) task.getLogContent();
try {
editor = window.getActivePage().openEditor(node, LogEditorPart.ID);
((LogEditorPart) editor).setTableInfo(logContentInfo, true);
} catch (PartInitException e) {
LOGGER.error(e.getMessage(), e);
}
}
}
use of com.cubrid.cubridmanager.core.logs.task.GetLogListTask in project cubrid-manager by CUBRID.
the class TimeSetAction method run.
/**
* Open dialog
*/
public void run() {
TimeSetDialog timeSetDialog = new TimeSetDialog(getShell());
timeSetDialog.create();
timeSetDialog.getShell().setSize(580, 275);
if (timeSetDialog.open() == Dialog.OK) {
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (window == null) {
return;
}
Object[] obj = this.getSelectedObj();
if (!isSupported(obj[0])) {
setEnabled(false);
return;
}
ICubridNode node = (ICubridNode) obj[0];
LogInfo logInfo = (LogInfo) node.getAdapter(LogInfo.class);
GetLogListTask task = new GetLogListTask(node.getServer().getServerInfo());
task.setPath(logInfo.getPath());
task.setStart("1");
task.setEnd("100");
TaskExecutor taskExcutor = new CommonTaskExec(Messages.loadLogTaskName);
taskExcutor.addTask(task);
new ExecTaskWithProgress(taskExcutor).exec();
if (!taskExcutor.isSuccess()) {
return;
}
LogContentInfo logContentInfo = (LogContentInfo) task.getLogContent();
IEditorPart editor;
try {
editor = window.getActivePage().openEditor(node, LogEditorPart.ID);
((LogEditorPart) editor).setTableInfo(logContentInfo, true);
} catch (PartInitException e) {
LOGGER.error(e.getMessage(), e);
}
}
}
use of com.cubrid.cubridmanager.core.logs.task.GetLogListTask in project cubrid-manager by CUBRID.
the class ViewReplicationErrorLogAction method run.
/**
* view replication error log
*/
public void run() {
final IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (window == null) {
return;
}
Object[] obj = this.getSelectedObj();
if (!isSupported(obj[0])) {
setEnabled(false);
return;
}
final ISchemaNode schemaNode = (ISchemaNode) obj[0];
cubridNode = schemaNode;
ReplicationInfo replInfo = (ReplicationInfo) schemaNode.getAdapter(ReplicationInfo.class);
final GetLogListTask task = new GetLogListTask(schemaNode.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() {
LogContentInfo logContentInfo = (LogContentInfo) 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).setTableInfo(logContentInfo, true);
} catch (PartInitException e) {
LOGGER.error(e.getMessage(), e);
}
}
});
}
if (monitor.isCanceled()) {
cubridNode = null;
return Status.CANCEL_STATUS;
}
}
cubridNode = null;
return Status.OK_STATUS;
}
};
String errPath = replInfo.getDistInfo().getCopyLogPath().substring(0, replInfo.getDistInfo().getCopyLogPath().indexOf(replInfo.getDistInfo().getDistDbName())) + replInfo.getDistInfo().getDistDbName() + schemaNode.getServer().getServerInfo().getPathSeparator() + replInfo.getDistInfo().getDistDbName() + ".err";
task.setPath(errPath);
task.setStart("1");
task.setEnd("100");
taskJobExecutor.addTask(task);
String jobName = Messages.viewLogJobName + " - " + cubridNode.getName() + "@" + cubridNode.getServer().getName();
taskJobExecutor.schedule(jobName, null, false, Job.SHORT);
}
Aggregations