use of com.cubrid.cubridmanager.ui.mondashboard.editor.MonitorDashboardEditor in project cubrid-manager by CUBRID.
the class EditMonitorDashboardAction method run.
/**
* Open the selected monitoring dash board
*/
public void run() {
Object[] objArr = this.getSelectedObj();
if (objArr == null || objArr.length <= 0) {
setEnabled(false);
return;
}
ICubridNode node = (ICubridNode) objArr[0];
Dashboard dashboard = (Dashboard) node.getAdapter(Dashboard.class);
if (dashboard == null) {
return;
}
AddDashboardDialog dialog = new AddDashboardDialog(getShell());
dialog.setDashboard(dashboard);
int returnCode = dialog.open();
if (returnCode == IDialogConstants.OK_ID) {
node.setId(dashboard.getName());
node.setLabel(dashboard.getName());
MonitorDashboardPersistManager.getInstance().saveDashboard();
ISelectionProvider provider = getSelectionProvider();
if (provider instanceof TreeViewer) {
TreeViewer treeViewer = (TreeViewer) provider;
treeViewer.refresh(node, true);
}
IEditorPart part = LayoutUtil.getEditorPart(node, node.getEditorId());
if (part instanceof MonitorDashboardEditor) {
((MonitorDashboardEditor) part).changePartName(dashboard.getName());
}
} else {
for (int i = 0; i < dashboard.getHostNodeList().size(); i++) {
HostNode hostNode = dashboard.getHostNodeList().get(i);
hostNode.getCopyedHaNodeList().clear();
hostNode.getCopyedHaNodeList().addAll(hostNode.getDbNodeList());
hostNode.getCopyedHaNodeList().addAll(hostNode.getBrokerNodeList());
}
}
}
Aggregations