Reputation: 6009
I create new editor that extend from TextEditor
public class RDLEditor extends TextEditor {
}
When I launch my program and press on the file ( file1) a new Editor is created.( like in java editor)
When I press on another file (file2) a new file is created.( in new tab )
Now I have two files that are exist as tabs ( file1,file2).
I want to add some logic when I change the focus of one file to another file.
Which event from TextEditor I can catch for the change of the focus ?
Upvotes: 0
Views: 94
Reputation: 111217
Use org.eclipse.ui.IPartListener
to listen for parts becoming active.
Set this up with something like:
PlatformUI.getWorkbench().getActiveWorkbenchWindow().addPartListener(listener);
among other methods the part listener has:
public void partActivated(IWorkbenchPart part)
which will be called when any part is activated. You will need to check the part
parameter matches your editor instances.
Upvotes: 1