Eclipse RCP 从菜单打开Editor

Eclipse RCP 从菜单打开Editor
在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 ;
    }
}



你可能感兴趣的:(Eclipse RCP 从菜单打开Editor)