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);
}
}
Aggregations