use of com.cubrid.cubridmanager.core.monitoring.task.DelStatusTemplateTask in project cubrid-manager by CUBRID.
the class DeleteStatusMonitorTemplateAction method delStatusTemp.
/**
* delete status template task.
*
* @param activePage IWorkbenchPage
* @param selection ICubridNode
* @return DelStatusTemplateTask
*/
private DelStatusTemplateTask delStatusTemp(IWorkbenchPage activePage, ICubridNode selection) {
DelStatusTemplateTask delTsk = new DelStatusTemplateTask(selection.getServer().getServerInfo());
IViewReference viewRef = activePage.findViewReference(StatusMonitorViewPart.ID, selection.getLabel());
if (viewRef != null) {
IViewPart viewPart = viewRef.getView(false);
//closes the view part
if (null != viewPart && viewPart.getTitle().endsWith(selection.getLabel())) {
activePage.hideView(viewPart);
}
}
delTsk.setTemplateName(selection.getName());
return delTsk;
}
use of com.cubrid.cubridmanager.core.monitoring.task.DelStatusTemplateTask in project cubrid-manager by CUBRID.
the class DeleteStatusMonitorTemplateAction method run.
/**
* Deletes the selected status template
*
*/
public void run() {
Object[] objs = this.getSelectedObj();
assert (objs != null);
List<String> nodeNames = new ArrayList<String>();
for (Object obj : objs) {
ICubridNode selection = (ICubridNode) obj;
nodeNames.add(selection.getLabel());
}
if (!CommonUITool.openConfirmBox(Messages.bind(Messages.delStatusMonitorConfirmContent, nodeNames))) {
return;
}
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (window == null) {
return;
}
IWorkbenchPage activePage = window.getActivePage();
String taskName = Messages.bind(Messages.delTemplateTaskName, nodeNames);
TaskExecutor taskExecutor = new CommonTaskExec(taskName);
for (Object obj : objs) {
ICubridNode selection = (ICubridNode) obj;
if (CubridNodeType.STATUS_MONITOR_TEMPLATE.equals(selection.getType())) {
DelStatusTemplateTask delTsk = delStatusTemp(activePage, selection);
taskExecutor.addTask(delTsk);
}
}
new ExecTaskWithProgress(taskExecutor).exec();
if (!taskExecutor.isSuccess()) {
return;
}
TreeViewer treeViewer = (TreeViewer) this.getSelectionProvider();
CommonUITool.refreshNavigatorTree(treeViewer, ((ICubridNode) objs[0]).getParent());
}
Aggregations