隨筆-112  評(píng)論-73  文章-0  trackbacks-0
          在Eclipse RCP 開發(fā)中從菜單中打開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 閱讀(1974) 評(píng)論(4)  編輯  收藏 所屬分類: Eclipse RCP

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

          只有注冊用戶登錄后才能發(fā)表評(píng)論。


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 翁源县| 西城区| 盘锦市| 久治县| 新巴尔虎左旗| 拉萨市| 枣强县| 南华县| 武胜县| 平顶山市| 虎林市| 伊宁县| 龙海市| 台湾省| 万年县| 鄂托克旗| 工布江达县| 日照市| 阜宁县| 额敏县| 全南县| 峨眉山市| 金湖县| 涪陵区| 怀安县| 常熟市| 崇仁县| 长岛县| 郧西县| 招远市| 涟源市| 濮阳市| 拉孜县| 大新县| 金沙县| 当涂县| 黑山县| 察哈| 陇西县| 桐柏县| 永清县|