Search in sources :

Example 11 with BrokerMonitorPart

use of com.cubrid.cubridmanager.ui.mondashboard.editor.parts.BrokerMonitorPart in project cubrid-manager by CUBRID.

the class EditAliasNameAction method run.

/**
	 * Edit alias name
	 * 
	 * @see org.eclipse.jface.action.Action#run()
	 */
public void run() {
    Object[] objArr = this.getSelectedObj();
    if (objArr == null || objArr.length <= 0 || !isSupported(objArr[0])) {
        setEnabled(false);
        return;
    }
    HANode haNode = null;
    if (objArr[0] instanceof HostMonitorPart) {
        HostMonitorPart hostMonPart = (HostMonitorPart) objArr[0];
        haNode = (HANode) hostMonPart.getModel();
    } else if (objArr[0] instanceof DatabaseMonitorPart) {
        DatabaseMonitorPart dbMonPart = (DatabaseMonitorPart) objArr[0];
        haNode = (HANode) dbMonPart.getModel();
    } else if (objArr[0] instanceof BrokerMonitorPart) {
        BrokerMonitorPart brokerMonPart = (BrokerMonitorPart) objArr[0];
        haNode = (HANode) brokerMonPart.getModel();
    } else if (objArr[0] instanceof ClientMonitorPart) {
        ClientMonitorPart clientMonitorPart = (ClientMonitorPart) objArr[0];
        haNode = (HANode) clientMonitorPart.getModel();
    } else if (objArr[0] instanceof BrokerDBListMonitorPart) {
        BrokerDBListMonitorPart brokerDBListMonitorPart = (BrokerDBListMonitorPart) objArr[0];
        haNode = (HANode) brokerDBListMonitorPart.getModel();
    }
    if (haNode == null) {
        return;
    }
    InputDialog dialog = new InputDialog(getShell(), Messages.titleEditNickNameDialog, Messages.msgEditNickNameDialog, haNode.getName(), new IInputValidator() {

        public String isValid(String newText) {
            if (newText == null || newText.trim().length() == 0) {
                return Messages.errEditNickName;
            }
            return null;
        }
    });
    if (IDialogConstants.OK_ID == dialog.open()) {
        String aliasName = dialog.getValue();
        haNode.setName(aliasName);
    }
}
Also used : BrokerDBListMonitorPart(com.cubrid.cubridmanager.ui.mondashboard.editor.parts.BrokerDBListMonitorPart) InputDialog(org.eclipse.jface.dialogs.InputDialog) BrokerMonitorPart(com.cubrid.cubridmanager.ui.mondashboard.editor.parts.BrokerMonitorPart) ClientMonitorPart(com.cubrid.cubridmanager.ui.mondashboard.editor.parts.ClientMonitorPart) HostMonitorPart(com.cubrid.cubridmanager.ui.mondashboard.editor.parts.HostMonitorPart) DatabaseMonitorPart(com.cubrid.cubridmanager.ui.mondashboard.editor.parts.DatabaseMonitorPart) HANode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.HANode) IInputValidator(org.eclipse.jface.dialogs.IInputValidator)

Aggregations

BrokerMonitorPart (com.cubrid.cubridmanager.ui.mondashboard.editor.parts.BrokerMonitorPart)11 BrokerNode (com.cubrid.cubridmanager.ui.mondashboard.editor.model.BrokerNode)8 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)7 DatabaseMonitorPart (com.cubrid.cubridmanager.ui.mondashboard.editor.parts.DatabaseMonitorPart)6 DashboardPart (com.cubrid.cubridmanager.ui.mondashboard.editor.parts.DashboardPart)5 Dashboard (com.cubrid.cubridmanager.ui.mondashboard.editor.model.Dashboard)4 HostMonitorPart (com.cubrid.cubridmanager.ui.mondashboard.editor.parts.HostMonitorPart)4 DatabaseNode (com.cubrid.cubridmanager.ui.mondashboard.editor.model.DatabaseNode)3 BrokerDBListNode (com.cubrid.cubridmanager.ui.mondashboard.editor.model.BrokerDBListNode)2 ClientNode (com.cubrid.cubridmanager.ui.mondashboard.editor.model.ClientNode)2 HostNode (com.cubrid.cubridmanager.ui.mondashboard.editor.model.HostNode)2 BrokerDBListMonitorPart (com.cubrid.cubridmanager.ui.mondashboard.editor.parts.BrokerDBListMonitorPart)2 ClientMonitorPart (com.cubrid.cubridmanager.ui.mondashboard.editor.parts.ClientMonitorPart)2 HANode (com.cubrid.cubridmanager.ui.mondashboard.editor.model.HANode)1 HANodePart (com.cubrid.cubridmanager.ui.mondashboard.editor.parts.HANodePart)1 MonitorEditPartFacotry (com.cubrid.cubridmanager.ui.mondashboard.editor.parts.MonitorEditPartFacotry)1 ArrayList (java.util.ArrayList)1 EditPart (org.eclipse.gef.EditPart)1 GraphicalViewer (org.eclipse.gef.GraphicalViewer)1 KeyHandler (org.eclipse.gef.KeyHandler)1