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 單飛 閱讀(197) 評論(0)  編輯  收藏

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


          網站導航:
           
          主站蜘蛛池模板: 宾阳县| 吐鲁番市| 仁布县| 天峻县| 白河县| 上栗县| 邮箱| 桐柏县| 萨嘎县| 东丰县| 连城县| 莲花县| 阳城县| 左权县| 清徐县| 城步| 保山市| 贺州市| 尉氏县| 蛟河市| 永平县| 封丘县| 成安县| 汉源县| 凤凰县| 高雄县| 师宗县| 屯门区| 五河县| 那曲县| 永修县| 南丹县| 林芝县| 专栏| 濮阳县| 武汉市| 德江县| 苍梧县| 海晏县| 永福县| 梅州市|