use of com.cubrid.cubridmanager.ui.mondashboard.dialog.AddDashboardDialog 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());
}
}
}
use of com.cubrid.cubridmanager.ui.mondashboard.dialog.AddDashboardDialog in project cubrid-manager by CUBRID.
the class AddMonitorDashboardAction method run.
/**
* Open the dialog
*/
public void run() {
AddDashboardDialog dialog = new AddDashboardDialog(getShell());
int returnCode = dialog.open();
if (returnCode == IDialogConstants.OK_ID) {
Dashboard dashboard = dialog.getDashboard();
DefaultCubridNode dashboardNode = new DefaultCubridNode(dashboard.getName(), dashboard.getName(), "icons/navigator/status_item.png");
dashboardNode.setType(CubridNodeType.MONITOR_DASHBOARD);
dashboardNode.setEditorId(MonitorDashboardEditor.ID);
dashboardNode.setModelObj(dashboard);
MonitorDashboardPersistManager.getInstance().addMonitorDashboard(dashboardNode);
ISelectionProvider provider = getSelectionProvider();
if (provider instanceof TreeViewer) {
TreeViewer treeViewer = (TreeViewer) provider;
/*TOOLS-3665 Refresh the input of TreeViewer*/
treeViewer.setInput(CubridMonitorNavigatorView.getTreeViewerInput());
CubridNodeManager.getInstance().fireCubridNodeChanged(new CubridNodeChangedEvent(dashboardNode, CubridNodeChangedEventType.NODE_ADD));
LayoutManager.getInstance().getWorkbenchContrItem().openEditorOrView(dashboardNode);
}
}
}
Aggregations