隨筆-112  評論-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) 評論(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呢
          你這樣可以實現(xiàn),
          但是如果我想打開editor1,editor2
          但現(xiàn)在我想回到editor1怎么辦?  回復  更多評論
            

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


          網站導航:
           
          主站蜘蛛池模板: 潼南县| 怀远县| 茂名市| 通道| 邵阳市| 怀来县| 陆良县| 绥化市| 永城市| 沈丘县| 雅安市| 昭觉县| 会理县| 易门县| 唐山市| 呈贡县| 广东省| 平和县| 左云县| 方山县| 阿合奇县| 班戈县| 广宁县| 曲沃县| 景宁| 威海市| 津南区| 白银市| 黄山市| 金秀| 和平县| 韩城市| 松江区| 纳雍县| 新巴尔虎左旗| 岗巴县| 且末县| 乌什县| 邮箱| 彰化县| 东光县|