隨筆-112  評論-73  文章-0  trackbacks-0
          在Eclipse RCP 開發中從菜單中打開Editor 的方法如下:

          public class OpenEditorHander extends AbstractHandler implements IHandler {

              @Override
              
          public Object execute(ExecutionEvent event) throws ExecutionException {
                  
          // HandlerUtil.getActiveWorkbenchWindow(event).close();
                  IEditorInput editorInput = new DBConfigEditInput();
                  IWorkbenchPage workbenchPage 
          = PlatformUI.getWorkbench()
                          .getActiveWorkbenchWindow().getActivePage();
                  IEditorPart editorPart 
          =workbenchPage.findEditor(editorInput);
                  
          try {
                      workbenchPage.openEditor(editorInput, 
          "sm.core.ui.DBConfig");
                  } 
          catch (PartInitException e) {
                      e.printStackTrace();
                  }
                  
          return null;
              }
          }



          posted on 2009-02-07 19:35 Libo 閱讀(1977) 評論(4)  編輯  收藏 所屬分類: Eclipse RCP

          評論:
          # re: Eclipse RCP 從菜單打開Editor 2009-02-10 23:40 | 與你同飛
          多謝分享  回復  更多評論
            
          # re: Eclipse RCP 從菜單打開Editor 2009-06-08 09:16 | ccat
          sm.core.ui.DBConfig
          這個ID要事先寫在plugin.xml中吧?  回復  更多評論
            
          # re: Eclipse RCP 從菜單打開Editor[未登錄] 2009-06-09 08:40 | Libo
          @ccat
          是的。這個是Editor的ID,在plugin.xml中配置.  回復  更多評論
            
          # re: Eclipse RCP 從菜單打開Editor 2009-09-08 22:38 | endswel
          那如何像eclipse project explorer
          那樣點擊左邊的樹
          可以在右邊顯示editor呢
          你這樣可以實現,
          但是如果我想打開editor1,editor2
          但現在我想回到editor1怎么辦?  回復  更多評論
            

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


          網站導航:
           
          主站蜘蛛池模板: 万载县| 台中市| 望都县| 龙门县| 兴山县| 洛南县| 卢龙县| 肥东县| 奉节县| 西安市| 望谟县| 阿拉尔市| 虎林市| 勃利县| 寻乌县| 兴城市| 江门市| 岑巩县| 闻喜县| 图木舒克市| 贵阳市| 阿坝县| 新蔡县| 仪征市| 马关县| 汝阳县| 体育| 邵阳县| 历史| 佛山市| 镇安县| 昌黎县| 孟津县| 南溪县| 玉龙| 平阳县| 钟祥市| 郓城县| 门源| 红桥区| 滦南县|