如下代码:
在IStackPresentationSite中,共定义了三个状态
IWorkbenchPage ipage= PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
IWorkbenchPartReference partRef=ipage.getActivePartReference();
WorkbenchPage page=(WorkbenchPage)ipage;
//获得页面状态 IStackPresentationSite.STATE_MINIMIZED
//IStackPresentationSite.STATE_MAXIMIZED
//IStackPresentationSite.STATE_RESTORED三种
int state = getState(partRef, page.getActivePerspective());
int getState(IWorkbenchPartReference ref,Perspective persp) {
if (persp == null) {
return IStackPresentationSite.STATE_RESTORED;
}
PartPane pane = ((WorkbenchPartReference) ref).getPane();
if (ref instanceof IViewReference
&& persp.isFastView((IViewReference) ref)) {
return persp.getFastViewState();
}
PartStack parent = ((PartStack)pane.getContainer());
if (parent != null) {
return parent.getState();
}
return IStackPresentationSite.STATE_RESTORED;
}
在IStackPresentationSite中,共定义了三个状态
public static int STATE_MINIMIZED = 0;
public static int STATE_MAXIMIZED = 1;
public static int STATE_RESTORED = 2;