use of com.cubrid.common.ui.spi.progress.ExecTaskWithProgress in project cubrid-manager by CUBRID.
the class CasRunnerResultViewDialog method connect.
/**
* each page of log connect
*
*/
public void connect() {
final GetLogListTask task = new GetLogListTask(selection.getServer().getServerInfo());
task.setPath(path + "." + String.valueOf(currentResultFileIndex - 1));
task.setDbName(dbName);
task.setStart(Long.toString(lineStart));
task.setEnd(Long.toString(lineEnd));
task.execute();
TaskExecutor taskExecutor = new CommonTaskExec(Messages.loadLogTaskName);
taskExecutor.addTask(task);
new ExecTaskWithProgress(taskExecutor).exec();
if (taskExecutor.isSuccess()) {
LogContentInfo logContentInfo = (LogContentInfo) task.getLogContent();
this.setinfo(logContentInfo, selection);
}
}
use of com.cubrid.common.ui.spi.progress.ExecTaskWithProgress in project cubrid-manager by CUBRID.
the class ResetAdminLogAction method run.
/**
* Reset Admin log
*/
public void run() {
if (!CommonUITool.openConfirmBox(Messages.warningResetAdminLog)) {
return;
}
Object[] selected = this.getSelectedObj();
LogInfo logInfo = (LogInfo) ((DefaultCubridNode) selected[0]).getAdapter(LogInfo.class);
ResetLogTask resetLogTask = new ResetLogTask(((DefaultCubridNode) selected[0]).getServer().getServerInfo());
resetLogTask.setPath(logInfo.getPath());
TaskExecutor taskExecutor = new CommonTaskExec(Messages.resetAdminLogTaskName);
taskExecutor.addTask(resetLogTask);
new ExecTaskWithProgress(taskExecutor).exec();
if (taskExecutor.isSuccess()) {
refreshLogEditor((ICubridNode) selected[0]);
CommonUITool.openInformationBox(Messages.msgSuccess, Messages.msgDeleteAllLog);
}
}
use of com.cubrid.common.ui.spi.progress.ExecTaskWithProgress 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.common.ui.spi.progress.ExecTaskWithProgress 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.common.ui.spi.progress.ExecTaskWithProgress in project cubrid-manager by CUBRID.
the class RemoveAllDbLogAction method run.
/**
* Remove all database logs
*/
public void run() {
if (!CommonUITool.openConfirmBox(Messages.warningRemoveLog)) {
return;
}
Object[] selected = this.getSelectedObj();
DelAllLogTask delAllLogTask = new DelAllLogTask(((DefaultCubridNode) selected[0]).getServer().getServerInfo());
String[] path = new String[((DefaultCubridNode) selected[0]).getChildren().size()];
//get last file name
String lastDBLog = "";
LogInfo currLogFile;
for (int i = 0, len = path.length; i < len; i++) {
currLogFile = ((LogInfo) (((DefaultCubridNode) selected[0]).getChildren().get(i).getAdapter(LogInfo.class)));
if (lastDBLog.compareTo(currLogFile.getPath()) < 0) {
lastDBLog = currLogFile.getPath();
}
}
for (int i = 0, len = path.length - 1; i < len; i++) {
if (!((LogInfo) (((DefaultCubridNode) selected[0]).getChildren().get(i).getAdapter(LogInfo.class))).getPath().equals(lastDBLog)) {
path[i] = ((LogInfo) (((DefaultCubridNode) selected[0]).getChildren().get(i).getAdapter(LogInfo.class))).getPath();
}
}
delAllLogTask.setPath(path);
TaskExecutor taskExecutor = new CommonTaskExec(Messages.removeLogTaskName);
taskExecutor.addTask(delAllLogTask);
new ExecTaskWithProgress(taskExecutor).busyCursorWhile();
if (!taskExecutor.isSuccess()) {
return;
}
TreeViewer treeViewer = (TreeViewer) this.getSelectionProvider();
DefaultCubridNode delNode = ((DefaultCubridNode) selected[0]);
ICubridNode parentNode = delNode.getParent().getParent();
parentNode.removeChild(delNode);
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (window == null) {
return;
}
IWorkbenchPage activePage = window.getActivePage();
for (int i = 0, len = path.length; i < len; i++) {
IEditorPart editor = activePage.findEditor(((DefaultCubridNode) selected[0]).getChildren().get(i));
if (!((LogInfo) (((DefaultCubridNode) selected[0]).getChildren().get(i).getAdapter(LogInfo.class))).getPath().equals(lastDBLog)) {
treeViewer.remove(((DefaultCubridNode) selected[0]).getChildren().get(i));
if (null != editor) {
activePage.closeEditor(editor, true);
}
}
}
}
Aggregations