title: Eclipse Plugin - How to get the last worked on editor
body: <p>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.</p>
  
  <p>Once the user clicks the button, the editor window no longer has focus and the following code does not work.</p>
  
  <pre><code>workbench.getActiveWorkbenchWindow().getActivePage().getActiveEditor()
  </code></pre>
  
  <p>How can I detect the editor window where the user was working and the cursor location before the user clicked the button?</p>