use of com.cubrid.cubridmanager.ui.mondashboard.editor.parts.DatabaseMonitorPart in project cubrid-manager by CUBRID.
the class OpenDatabaseLogAction method isSupported.
/**
* only support database monitor and database must be connected.
*
* @see com.cubrid.common.ui.spi.action.ISelectionAction#isSupported(java.lang.Object)
* @param obj Object must be DatabaseMonitorPart
* @return is supported.
*/
public boolean isSupported(Object obj) {
if (obj instanceof DatabaseMonitorPart) {
DatabaseMonitorPart dbMonPart = (DatabaseMonitorPart) obj;
DatabaseNode dbNode = (DatabaseNode) dbMonPart.getModel();
HostNode hostNode = dbNode.getParent();
if (hostNode != null && hostNode.getServerInfo() != null && hostNode.getServerInfo().isConnected()) {
return true;
}
}
return false;
}
use of com.cubrid.cubridmanager.ui.mondashboard.editor.parts.DatabaseMonitorPart in project cubrid-manager by CUBRID.
the class OpenDatabaseLogAction method run.
/**
* open database log
*
* @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;
}
DatabaseMonitorPart dbMonPart = (DatabaseMonitorPart) objArr[0];
DatabaseNode dbNode = (DatabaseNode) dbMonPart.getModel();
String dbName = dbNode.getDbName();
HostNode hostNode = dbNode.getParent();
ServerInfo serverInfo = hostNode.getServerInfo();
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
DatabaseLogListDialog dialog = new DatabaseLogListDialog(shell, dbName, serverInfo);
dialog.open();
}
use of com.cubrid.cubridmanager.ui.mondashboard.editor.parts.DatabaseMonitorPart in project cubrid-manager by CUBRID.
the class DeleteDatabaseMonitorAction method run.
/**
* delete database monitor from dashboard.
*/
public void run() {
IStructuredSelection selection = (IStructuredSelection) getSelection();
DatabaseMonitorPart dmp = (DatabaseMonitorPart) selection.getFirstElement();
//EditPart dashboardPart = dmp.getParent();
DatabaseNode dn = (DatabaseNode) dmp.getModel();
boolean isDelete = CommonUITool.openConfirmBox(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), Messages.bind(Messages.msgConfirmDeleteDatabase, dn.getName()));
if (!isDelete) {
return;
}
dn.getParent().removeDbNode(dn);
//dashboardPart.refresh();
}
use of com.cubrid.cubridmanager.ui.mondashboard.editor.parts.DatabaseMonitorPart 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