Getting the last opened Editor

Good afternoon to all (or maybe it is morning in your part of the world).

I am faced with a strange situation, which probably has an easy solution.
What I want to do is dead simple, but the parameters of the situation seem to make it more complicated.

The aim is to insert code into an editor, that happened to be the last one opened.
It is currently not selected as there is a GUI component which has taken the focus, and will perform the insert.

I have tried all the known ways of getting and editor by using the project (I have the project but the way, but no action), and they all come up with null.

So, as I see it, there are two solutions : either a call to some great little function somewhere, or to implement a listener that records the last opened editor (and cursor position).

Any ideas?



Any update on this? I am in the same situation. Want to insert code in the editor but focus is in a tool window.




Thanks alot. This is what I was looking for.


Please sign in to leave a comment.