Home » Eclipse Projects » Rich Client Platform (RCP) » Associate Editor with Perspective
| |
Re: Associate Editor with Perspective [message #484222 is a reply to message #484198] |
Fri, 04 September 2009 16:06 |
Dave Messages: 28 Registered: July 2009 |
Junior Member |
|
|
Remy Suen wrote:
> On Fri, 04 Sep 2009 14:22:34 +0000, Dave wrote:
>> Is there a way to do this? Even if there is not a simple way to do it,
>> I am willing to consider more complicated ways. Any suggestions?
> We added new API in 3.5 which should help with this. Please see bug 11001.
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=11001
> http://help.eclipse.org/stable/nftopic/org.eclipse.platform. doc.isv/
> reference/api/org/eclipse/ui/IWorkbenchPage.html#showEditor%
> 28org.eclipse.ui.IEditorReference%29
> http://help.eclipse.org/stable/nftopic/org.eclipse.platform. doc.isv/
> reference/api/org/eclipse/ui/IWorkbenchPage.html#hideEditor%
> 28org.eclipse.ui.IEditorReference%29
> As the API is new, there may be some problems with it. Please report bugs
> if you spot any problems. Thank you.
> Regards,
> Remy
Thanks for the information. The new API looks like the kind of thing I'm
looking for. But I'm still a little confused as to how to use it to
achieve what I want. Is there a recommendation as to where/when (i.e.,
class/method, listener event, etc.) to hide the editors, and where/when to
re-show them? The API documentation says that getEditorReferences() does
not return hidden editors. So how do I get the list of hidden editors
that I want to re-show when a perspective is being re-shown? Note that I
don't necessarily want to re-show all hidden editors, as there may be some
hidden editors associated with perspectives that are not being re-shown.
Any advice would be appreciated!
|
|
| |
Re: Associate Editor with Perspective [message #484247 is a reply to message #484230] |
Fri, 04 September 2009 18:17 |
Dave Messages: 28 Registered: July 2009 |
Junior Member |
|
|
Remy Suen wrote:
> On Fri, 04 Sep 2009 16:06:30 +0000, Dave wrote:
>> Is there a recommendation as to where/when (i.e.,
>> class/method, listener event, etc.) to hide the editors, and where/when
>> to re-show them?
> The simplest thing to do would be to just react to perspective events and
> show/hide your editors.
>> So how do I get the list of hidden
>> editors that I want to re-show when a perspective is being re-shown?
> You need to keep track of what you've shown/hidden yourself and what you
> want to show/hide the next time the perspective changes. This is up to
> the client to decide.
> Regards,
> Remy
Thanks for your help. I'm a novice when it comes to Eclipse RCP
development, so I was wondering if you could point me in the right
direction. What is the recommended way for me to set it up so that I can
react to perspective events? In other words, do I add a listener to
something? If so, what type of listener, what would I be adding it to,
and when would I add it? (i.e., during workbench initialization?
workbench page initialization? what classes/methods represent those
actions in the workbench lifecycle anyway?)
Also, is there a method I can call that will return all of the open
editors, including hidden ones?
Thanks again for being patient with me!
Regards,
Dave
|
|
|
Re: Associate Editor with Perspective [message #484337 is a reply to message #484247] |
Sun, 06 September 2009 22:00 |
Wim Jongman Messages: 423 Registered: July 2009 |
Senior Member |
|
|
Hi Dave,
Try these as a starting point:
PlatformUI.getWorkbench().getActiveWorkbenchWindow().addPers pectiveListener(listener);
PlatformUI.getWorkbench()..getEditorRegistry()
Best regards,
Wim Jongman
> Remy Suen wrote:
>
>> On Fri, 04 Sep 2009 16:06:30 +0000, Dave wrote:
>>> Is there a recommendation as to where/when (i.e.,
>>> class/method, listener event, etc.) to hide the editors, and where/when
>>> to re-show them?
>
>> The simplest thing to do would be to just react to perspective events and
>> show/hide your editors.
>
>>> So how do I get the list of hidden
>>> editors that I want to re-show when a perspective is being re-shown?
>
>> You need to keep track of what you've shown/hidden yourself and what you
>> want to show/hide the next time the perspective changes. This is up to
>> the client to decide.
>
>> Regards,
>> Remy
>
> Thanks for your help. I'm a novice when it comes to Eclipse RCP
> development, so I was wondering if you could point me in the right
> direction. What is the recommended way for me to set it up so that I can
> react to perspective events? In other words, do I add a listener to
> something? If so, what type of listener, what would I be adding it to,
> and when would I add it? (i.e., during workbench initialization?
> workbench page initialization? what classes/methods represent those
> actions in the workbench lifecycle anyway?)
>
> Also, is there a method I can call that will return all of the open
> editors, including hidden ones?
>
> Thanks again for being patient with me!
>
> Regards,
> Dave
|
|
|
Re: Associate Editor with Perspective [message #484687 is a reply to message #484247] |
Tue, 08 September 2009 18:14 |
|
Dave wrote on Fri, 04 September 2009 14:17 |
Thanks for your help. I'm a novice when it comes to Eclipse RCP
development, so I was wondering if you could point me in the right
direction. What is the recommended way for me to set it up so that I can
react to perspective events? In other words, do I add a listener to
something? If so, what type of listener, what would I be adding it to,
and when would I add it? (i.e., during workbench initialization?
workbench page initialization? what classes/methods represent those
actions in the workbench lifecycle anyway?)
Also, is there a method I can call that will return all of the open
editors, including hidden ones?
Thanks again for being patient with me!
Regards,
Dave
|
This API was added for the most hard-core of hard-core RCP developers. It is not how we recommend using editors and the editor areas (the questions you've posted are just the beginning, believe me
That being said, I would consider writing your editor+perspective management code in its own plugin. Try and limit what else it does, and then to get the behaviour your want (in a RCP app) you would look at starting up your management functionality in your workbench advisor (it has post startup methods).
You need to listen to callbacks in the IPerspectiveListener* methods, and you might even need an IPartlListener2 listener in order to tell when editors are opened/closed.
PW
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
|
|
|
Goto Forum:
Current Time: Wed Jan 15 10:41:17 GMT 2025
Powered by FUDForum. Page generated in 0.03347 seconds
|