How to to listen to editor restore events? [message #901229] |
Fri, 10 August 2012 08:40  |
Eclipse User |
|
|
|
Is there a way to listen to an editor's restore events?
The specifics of my problem: I have an editor inside an RCP application, which is connected to a toolbar. When I minimise the editor, the toolbar disapears. If I restore the editor, the toolbar is not re-appearing.
Once I give focus to the editor, the toolbar appears. I believe this is normal eclipse behaviour, yet I have to make the toolbar appear as soon as the editor is restored.
I am convinced that it will be as basic as give the editor focus as soon as it is restored, however I have not been able to find out how to listen to editors minimise/maximise/restore events.
Any suggestions would be appreciated.
|
|
|
Re: How to to listen to editor restore events? [message #901250 is a reply to message #901229] |
Fri, 10 August 2012 09:41  |
Eclipse User |
|
|
|
Hi Jang,
One option you can try is adding an IPartListener directly to the page like so:
page.addPartListener(new IPartListener() {
partOpened(IWorkbenchPart part) {
...
}
...
});
Or you can directly register an object as a listener with the IWorkbenchPage IPartService like so:
getSite().getPage().addPartListener (objecToBeNotified);
objectToBeNotified will need to implement IPartListener2, which has the following API:
public void partActivated(IWorkbenchPartReference partRef);
public void partBroughtToTop(IWorkbenchPartReference partRef);
public void partClosed(IWorkbenchPartReference partRef);
public void partDeactivated(IWorkbenchPartReference partRef);
public void partOpened(IWorkbenchPartReference partRef);
public void partHidden(IWorkbenchPartReference partRef);
public void partVisible(IWorkbenchPartReference partRef);
public void partInputChanged(IWorkbenchPartReference partRef);
objectToBeNotified will now be notified, and you can react accordingly.
You might also want to take a look at using a source provider and a property tester for
managing the visibility of the toolbar. It's none of the editor's business.
Hope this helps!
|
|
|
Powered by
FUDForum. Page generated in 0.25355 seconds