隨筆-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 閱讀(1974) 評論(4)  編輯  收藏 所屬分類: Eclipse RCP

          評論:
          # re: Eclipse RCP 從菜單打開Editor 2009-02-10 23:40 | 與你同飛
          多謝分享  回復(fù)  更多評論
            
          # re: Eclipse RCP 從菜單打開Editor 2009-06-08 09:16 | ccat
          sm.core.ui.DBConfig
          這個ID要事先寫在plugin.xml中吧?  回復(fù)  更多評論
            
          # re: Eclipse RCP 從菜單打開Editor[未登錄] 2009-06-09 08:40 | Libo
          @ccat
          是的。這個是Editor的ID,在plugin.xml中配置.  回復(fù)  更多評論
            
          # 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ù)  更多評論
            

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


          網(wǎng)站導(dǎo)航:
          博客園   IT新聞   Chat2DB   C++博客   博問  
           
          主站蜘蛛池模板: 安阳县| 通海县| 宁阳县| 长葛市| 平罗县| 巴马| 庄河市| 方山县| 峨边| 麻城市| 建德市| 鹤庆县| 寿光市| 兴隆县| 遵义市| 泰和县| 秀山| 绥中县| 西宁市| 广饶县| 大城县| 依兰县| 嘉禾县| 蓝田县| 韩城市| 日喀则市| 洞头县| 濉溪县| 汨罗市| 白玉县| 绥阳县| 芒康县| 临西县| 赤壁市| 女性| 阳高县| SHOW| 勐海县| 永仁县| 贵溪市| 城步|