use of com.cubrid.cubridmanager.ui.mondashboard.editor.parts.HostMonitorPart in project cubrid-manager by CUBRID.
the class HARoleChangeAction method isSupported.
/**
* node should be active node.
*
* @see com.cubrid.common.ui.spi.action.ISelectionAction#isSupported(java.lang.Object)
* @param obj Object
* @return is supported.
*/
public boolean isSupported(Object obj) {
if (obj instanceof HostMonitorPart) {
HostMonitorPart dbPart = (HostMonitorPart) obj;
HostNode dbNode = (HostNode) dbPart.getModel();
return dbNode.getHostStatusInfo() != null && dbNode.getHostStatusInfo().getStatusType() == HostStatusType.MASTER;
}
return false;
}
use of com.cubrid.cubridmanager.ui.mondashboard.editor.parts.HostMonitorPart in project cubrid-manager by CUBRID.
the class HideHostAction method run.
/**
* Create a new figure in dashboard.
*
* @see org.eclipse.jface.action.Action#run()
*/
public void run() {
IStructuredSelection selection = (IStructuredSelection) getSelection();
Iterator<?> iterator = selection.iterator();
while (iterator.hasNext()) {
Object objSelected = iterator.next();
if (objSelected instanceof HostMonitorPart) {
HostMonitorPart cmp = (HostMonitorPart) objSelected;
HostNode hn = (HostNode) cmp.getModel();
hn.setVisible(false);
cmp.getParent().refresh();
}
}
}
use of com.cubrid.cubridmanager.ui.mondashboard.editor.parts.HostMonitorPart in project cubrid-manager by CUBRID.
the class HostDashboardHistoryAction method run.
/**
* Open monitor host detail windows.
*/
public void run() {
if (getSelectedObj() == null || getSelectedObj().length == 0) {
return;
}
Object obj = getSelectedObj()[0];
if (!(obj instanceof HostMonitorPart)) {
return;
}
HostMonitorPart part = (HostMonitorPart) obj;
HostNode hn = (HostNode) part.getModel();
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (window == null) {
return;
}
IWorkbenchPage page = window.getActivePage();
if (page == null) {
return;
}
String secondaryId = new StringBuffer(hn.getUserName()).append("&").append(hn.getIp()).append("&").append(hn.getPort()).toString();
IViewReference viewReference = page.findViewReference(HostDashboardHistoryViewPart.ID, secondaryId);
if (viewReference == null) {
try {
IViewPart viewPart = page.showView(HostDashboardHistoryViewPart.ID, secondaryId, IWorkbenchPage.VIEW_ACTIVATE);
((HostDashboardHistoryViewPart) viewPart).init((HostNode) part.getModel());
} catch (PartInitException ex) {
viewReference = null;
}
} else {
IViewPart viewPart = viewReference.getView(false);
window.getActivePage().bringToTop(viewPart);
((HostDashboardHistoryViewPart) viewPart).init((HostNode) part.getModel());
}
}
use of com.cubrid.cubridmanager.ui.mondashboard.editor.parts.HostMonitorPart 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