use of org.eclipse.ui.IViewReference in project cubrid-manager by CUBRID.
the class HostMonitorPart method performRequest.
/**
* @see org.eclipse.gef.editparts.AbstractEditPart#performRequest(org.eclipse.gef.Request)
* @param req Request
*/
public void performRequest(Request req) {
if (req.getType() == RequestConstants.REQ_OPEN) {
HostNode hn = (HostNode) getModel();
if (!hn.isConnected()) {
return;
}
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(HostDashboardViewPart.ID, secondaryId);
if (viewReference == null) {
try {
IViewPart viewPart = page.showView(HostDashboardViewPart.ID, secondaryId, IWorkbenchPage.VIEW_ACTIVATE);
((HostDashboardViewPart) viewPart).init((HostNode) getModel());
} catch (PartInitException ex) {
viewReference = null;
}
} else {
IViewPart viewPart = viewReference.getView(false);
window.getActivePage().bringToTop(viewPart);
((HostDashboardViewPart) viewPart).init((HostNode) getModel());
}
}
}
use of org.eclipse.ui.IViewReference in project cubrid-manager by CUBRID.
the class DeleteStatusMonitorTemplateAction method delStatusTemp.
/**
* delete status template task.
*
* @param activePage IWorkbenchPage
* @param selection ICubridNode
* @return DelStatusTemplateTask
*/
private DelStatusTemplateTask delStatusTemp(IWorkbenchPage activePage, ICubridNode selection) {
DelStatusTemplateTask delTsk = new DelStatusTemplateTask(selection.getServer().getServerInfo());
IViewReference viewRef = activePage.findViewReference(StatusMonitorViewPart.ID, selection.getLabel());
if (viewRef != null) {
IViewPart viewPart = viewRef.getView(false);
//closes the view part
if (null != viewPart && viewPart.getTitle().endsWith(selection.getLabel())) {
activePage.hideView(viewPart);
}
}
delTsk.setTemplateName(selection.getName());
return delTsk;
}
use of org.eclipse.ui.IViewReference 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 org.eclipse.ui.IViewReference in project cubrid-manager by CUBRID.
the class OpenMonitorDashboardViewAction method run.
/**
* Open HA monitor view part
*/
public void run() {
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
boolean isExist = false;
IViewReference[] viewRefArr = page.getViewReferences();
if (viewRefArr != null && viewRefArr.length > 0) {
for (IViewReference viewRef : viewRefArr) {
String id = viewRef.getId();
if (CubridMonitorNavigatorView.ID.equals(id)) {
IViewPart viewPart = viewRef.getView(true);
if (viewPart == null) {
isExist = false;
} else {
page.bringToTop(viewRef.getView(true));
isExist = true;
}
break;
}
}
}
if (!isExist) {
try {
page.showView(CubridMonitorNavigatorView.ID);
} catch (PartInitException e) {
LOGGER.error(e.getMessage());
}
}
}
use of org.eclipse.ui.IViewReference in project tdi-studio-se by Talend.
the class StartMonitorJobAction method getProperriesView.
/**
* Gets the currently opened properties view.
*
* @return The properties views
*/
private static List<PropertySheet> getProperriesView() {
List<PropertySheet> list = new ArrayList<PropertySheet>();
IViewReference[] views = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getViewReferences();
for (IViewReference viewReference : views) {
if (IPageLayout.ID_PROP_SHEET.equals(viewReference.getId())) {
list.add((PropertySheet) viewReference.getView(true));
}
}
return list;
}
Aggregations