use of com.cubrid.cubridmanager.ui.mondashboard.editor.HostDashboardHistoryViewPart 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());
}
}
Aggregations