在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;
}
}
posted on 2009-02-07 19:35
Libo 阅读(1968)
评论(4) 编辑 收藏 所属分类:
Eclipse RCP