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)  編輯  收藏

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


          網站導航:
           
          主站蜘蛛池模板: 乌恰县| 华池县| 迭部县| 上虞市| 泾源县| 陆丰市| 溧水县| 丁青县| 塘沽区| 抚远县| 七台河市| 镇远县| 水城县| 宜川县| 桑日县| 宁陕县| 葵青区| 汉中市| 中西区| 布拖县| 蕉岭县| 原阳县| 广水市| 塔河县| 察隅县| 泰安市| 泽普县| 大冶市| 固镇县| 望谟县| 文水县| 阳江市| 轮台县| 鹿邑县| 福贡县| 宝坻区| 东港市| 水城县| 海淀区| 化德县| 阳信县|