I am writing an eclipse plugin which exposes a view to the user with several buttons. On the click of any button, I would like to paste a certain comment into the editor window where the user is currently working and at the cursor location he is pointing to.
Once the user clicks the button, the editor window no longer has focus and the following code does not work.
workbench.getActiveWorkbenchWindow().getActivePage().getActiveEditor()
How can I detect the editor window where the user was working and the cursor location before the user clicked the button?