9910

          單飛

             :: 首頁 :: 聯系 :: 聚合  :: 管理
          我只知道它屬于org.eclipse.pde.ui的擴展點org.eclipse.ui.perspectives,看來要好好研究一下這部分的代碼,才能解決隱藏Perspective,實現權限管理。

          參考了別人的代碼:
          看了看eclipse的源代碼,終于知道怎么關閉了:

          IWorkbench w=PlatformUI.getWorkbench();
          IPerspectiveRegistry pr=w.getPerspectiveRegistry() ;
          IPerspectiveDescriptor persdes=pr.findPerspectiveWithId("perspectiveID");

          WorkbenchPage p=(WorkbenchPage)w.getActiveWorkbenchWindow().getActivePage();
          Perspective persp = p.getActivePerspective();
          p.closePerspective(persdes,false,false);

          try {
          w.showPerspective("nextperspectiveID", w.getActiveWorkbenchWindow());
          } catch (WorkbenchException e) {
          e.printStackTrace();
          }

          關閉當前perspective,并打開一個新的perspective:

          IWorkbench w=PlatformUI.getWorkbench();

          ActionFactory.IWorkbenchAction closePerspectiveAction
          = ActionFactory.CLOSE_PERSPECTIVE.create(w.getActiveWorkbenchWindow());
          closePerspectiveAction.run();

          try {
          PlatformUI.getWorkbench().showPerspective("com.ibm.demo.saic.ui.views.NextPerspective", w.getActiveWorkbenchWindow());
          } catch (WorkbenchException e) {
          e.printStackTrace();
          }


          posted on 2008-08-12 22:37 單飛 閱讀(198) 評論(0)  編輯  收藏

          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 色达县| 光泽县| 恩平市| 星座| 溧阳市| 青龙| 正阳县| 榆中县| 山阴县| 卢湾区| 潮安县| 石棉县| 井研县| 施甸县| 宜章县| 弥渡县| 凤凰县| 鹤壁市| 方正县| 岳西县| 绥中县| 巍山| 饶平县| 东光县| 比如县| 乌兰察布市| 冷水江市| 南皮县| 田东县| 石家庄市| 大足县| 于田县| 金溪县| 仪陇县| 扎赉特旗| 溧阳市| 明溪县| 治县。| 延长县| 山西省| 邢台县|