1. 从当前窗口改变透视图需要以下2个步骤:
步骤1 隐藏当前透视图:
IPerspectiveDescriptor persDescription = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.getActivePage().getPerspective();
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
.closePerspective(persDescription, false, false);
步骤2 显示新的透视图:
IPerspectiveDescriptor persDescription1 = PlatformUI.getWorkbench().getPerspectiveRegistry()
.findPerspectiveWithId(NewPerspective.ID);
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().setPerspective(persDescription1);
2. 在新窗口打开透视图:
PlatformUI.getWorkbench().openWorkbenchWindow(newPerspectiveI);
3. 隐藏当前视图:
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().hideView(ivref[0]);
4. 从plug-in另外一个视图:
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(ViewID);
5. 获得视图的reference:
View view = (View) PlatformUI.getWorkbench().
getActiveWorkbenchWindow().getActivePage().findView(ViewID);
Now using this reference the Controls and methods of the view can be accesed.
说明:RAP隐藏透视图,隐藏视图的功能相当于删除