I want to add a listener to the default code editor in Eclipse. It should be triggered whenever a new code file is opened or closed. Is there anything available like that? I did a google search for hours, but could find a working solution.
I'm especially focusing the default Java code editor. But once I know how to hook into such an editor it shouldn't be a big problem to add additional ones. The main problem I have so far is, that I don't know what I should do with the IEditorDescriptor I could get.
You can register an IPartListener2 with the PartService, for example:
There are other ways to register the IPartListener, for example if you have a reference to an
The part listener is notified when editors are opened or closed, among other things. For
IPartListener2, you get an
IWorkbenchPartReference which you can use to check what kind of editor is involved. For example, to detect the standard Java editor, you can check for the ID