Hi all,
I'd like the get the text of editor in a command handler, so how can I get the reference of Editor, thanks
Hi all,
I'd like the get the text of editor in a command handler, so how can I get the reference of Editor, thanks
Hi,
to get the referece of the editor in a command handler you could do this:
public class myCommandHandler extends AbstractHandler implements IHandler {
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
Shell shell = HandlerUtil.getActiveWorkbenchWindow(event).getShell();
IWorkbenchPage page = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage();
IEditorInput editorInput = page.getActiveEditor().getEditorInput();
...
Good luck