use of com.cubrid.cubridmanager.ui.mondashboard.editor.model.HostNode 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());
}
}
}
use of com.cubrid.cubridmanager.ui.mondashboard.editor.model.HostNode 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.model.HostNode 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.model.HostNode 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.model.HostNode in project cubrid-manager by CUBRID.
the class OpenApplyLogDBLogAction method isSupported.
/**
*
*
* @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 DatabaseMonitorPart) {
DatabaseMonitorPart dbMonPart = (DatabaseMonitorPart) obj;
DatabaseNode dbNode = (DatabaseNode) dbMonPart.getModel();
HostNode hostNode = dbNode.getParent();
if (hostNode != null && hostNode.isConnected() && (dbNode.getDbStatusType() == DBStatusType.STANDBY || dbNode.getDbStatusType() == DBStatusType.MAINTENANCE) && hostNode.getHostStatusInfo() != null && hostNode.getHostStatusInfo().getMasterHostStatusInfo() != null) {
return true;
}
}
return false;
}
Aggregations