隨筆-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 閱讀(1981) 評(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)論
            

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


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 互助| 新津县| 玉山县| 仁布县| 固安县| 太原市| 惠水县| 柯坪县| 栾川县| 山阳县| 永新县| 屯门区| 滦南县| 常宁市| 东乡族自治县| 搜索| 竹山县| 綦江县| 台湾省| 陇川县| 茂名市| 丹巴县| 双柏县| 宜昌市| 城固县| 尖扎县| 宁南县| 青田县| 包头市| 松潘县| 汉川市| 卢湾区| 广河县| 沙雅县| 福清市| 乐亭县| 忻州市| 太仓市| 库车县| 环江| 扶余县|