Is there a notion of active or topmost editor in Eclipse?
I wrote a view and want it to show some data about active editor.
Currently I am using selection service, while editor is providing selection information. Unfortunately, this way I can't distinguish if editor was deselected or closed. So I am showing last selected editor information even after it was closed.
Use an IPartListener
(or IPartListener2
) to be informed about all the changes to active parts.
IPartService service = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getPartService();
service.addPartListener(listener);
IPartService
also has a getActivePart()
method - the active part may be a view as well as an editor.
The above is assuming an Eclipse 3.x style RCP, Eclipse e4 is different.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.