IPartListener partClosed & partActivated notification [message #874574] |
Mon, 21 May 2012 07:15 |
|
Hi,
During last week working on editor. I observerved partActivated notification occur before the partClosed notification which cause problem for some workflows.
Can anybody guide me to change the order of notification, partClosed notification occur before partActivated which seems logical order?
Thanks in advance.
-Omer Gillani
|
|
|
|
Re: IPartListener partClosed & partActivated notification [message #874791 is a reply to message #874753] |
Mon, 21 May 2012 14:42 |
|
Thorsten,
Yes. I am talking about different parts. When we open multiple editor parts and we close one of the editor part, in this case eclipse WorkbenchPage.firePartActivated first for other editor part which will be visible after closing the selected editor part and then it calls Workbenchpage.firePartClosed for the selected editor part. Actually whatever we have decorated in partActivated method, partClosed method clear all. It doesn't seem logical to me.
when we close editor, it should call partClosed where we may do clean up and then partActivated for the newly visible editor.
Thanks Thorsten.
-Omer Gillani
|
|
|
|
Re: IPartListener partClosed & partActivated notification [message #875202 is a reply to message #874934] |
Tue, 22 May 2012 10:07 |
|
Have a look over the code
public void partClosed(IWorkbenchPart part) {
if (part == MyEditor.this) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
MyEditorInput vi = (MyEditorInput ) getEditorInput();
MyEvent event = createEvent(vi.getViewEvent());
fireViewRemoved(event);
});
close();
}
}
public void partActivated(IWorkbenchPart part) {
if (part == MyEditor.this) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
MyEvent event = createEvent(vi.getViewEvent());
fireViewSelected(event);
}
});
}
}
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03665 seconds