Posted on 2006-03-28 18:59
ikingqu 阅读(388)
评论(0) 编辑 收藏 所属分类:
Others
第一种:利用Action
IWorkbenchWindow window = getViewSite().getWorkbenchWindow();
IWorkbenchAction max = ActionFactory.MAXIMIZE.create(window);
max.run();这段代码要放在何适的位置上才会起到合适的作用。
第二种:利用Zoom
在ApplicationWorkbenchWindowAdvisor#postWindowOpen中做到
public void postWindowOpen() {
IWorkbenchWindow window = Plugin.getDefault().getWorkbench().getActiveWorkbenchWindow();
IViewPart part=null;
try {
part = window.getActivePage().showView(View.ID);
} catch (PartInitException e) {
e.printStackTrace();
}
if(part!=null){
window.getActivePage().activate(part);
window.getActivePage().bringToTop(part);
WorkbenchPage realPage = (WorkbenchPage) window.getActivePage();
IWorkbenchPartReference partRef = window.getActivePage().getActivePartReference();
if (partRef != null) {
((WorkbenchPage) window.getActivePage()).toggleZoom(partRef);
}else{
System.out.println("partRef is null!");
}
}
}
原文地址 :http://www.blogjava.net/hopeshared/archive/2006/03/27/37641.html