Search in sources :

Example 1 with MonitorDashboardEditor

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());
        }
    }
}
Also used : AddDashboardDialog(com.cubrid.cubridmanager.ui.mondashboard.dialog.AddDashboardDialog) ISelectionProvider(org.eclipse.jface.viewers.ISelectionProvider) TreeViewer(org.eclipse.jface.viewers.TreeViewer) HostNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.HostNode) MonitorDashboardEditor(com.cubrid.cubridmanager.ui.mondashboard.editor.MonitorDashboardEditor) Dashboard(com.cubrid.cubridmanager.ui.mondashboard.editor.model.Dashboard) ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode) IEditorPart(org.eclipse.ui.IEditorPart)

Aggregations

ICubridNode (com.cubrid.common.ui.spi.model.ICubridNode)1 AddDashboardDialog (com.cubrid.cubridmanager.ui.mondashboard.dialog.AddDashboardDialog)1 MonitorDashboardEditor (com.cubrid.cubridmanager.ui.mondashboard.editor.MonitorDashboardEditor)1 Dashboard (com.cubrid.cubridmanager.ui.mondashboard.editor.model.Dashboard)1 HostNode (com.cubrid.cubridmanager.ui.mondashboard.editor.model.HostNode)1 ISelectionProvider (org.eclipse.jface.viewers.ISelectionProvider)1 TreeViewer (org.eclipse.jface.viewers.TreeViewer)1 IEditorPart (org.eclipse.ui.IEditorPart)1