Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » How to to listen to editor restore events?
How to to listen to editor restore events? [message #901229] Fri, 10 August 2012 12:40 Go to next message
Jang de Blannen Missing name is currently offline Jang de Blannen Missing nameFriend
Messages: 2
Registered: September 2011
Junior Member
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 13:41 Go to previous message
John Steele is currently offline John SteeleFriend
Messages: 50
Registered: January 2010
Member
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!
Previous Topic:Common Navigator Framework
Next Topic:Eclipse CNF popup
Goto Forum:
  


Current Time: Thu Nov 14 18:01:09 GMT 2024

Powered by FUDForum. Page generated in 0.03387 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top