Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Setting input on default perspective
Setting input on default perspective [message #640767] Tue, 23 November 2010 06:13 Go to next message
Missing name Mising name is currently offline Missing name Mising nameFriend
Messages: 16
Registered: May 2010
Junior Member
Hi all,
I was wondering if anyone could tell me how to programatically set the default perspective of an RCP application when you also want to set the input. I know about overriding getInitialWindowPerspectiveId() in the ApplicationWorkbenchAdvisor, but that does not allow you to set the IAdaptable input like IWorkbechWindow.openPage(), IWorkbench.openWorkbenchWindow(), and IWorkbench.showPerspective() do. Is there something in the ApplicationWorkbenchAdvisor I have to override so I can open the perspective with something like showPerspective(), instead of letting it just use the initial Perspective?

Any advice is greatly appreciated!
Jim

[Updated on: Tue, 23 November 2010 06:44]

Report message to a moderator

Re: Setting input on default view [message #640885 is a reply to message #640767] Tue, 23 November 2010 12:57 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

You can override
org.eclipse.ui.application.WorkbenchAdvisor.getDefaultPageIn put()

PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Platform_Expression_Framework
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Re: Setting input on default perspective [message #640948 is a reply to message #640767] Tue, 23 November 2010 16:08 Go to previous messageGo to next message
Missing name Mising name is currently offline Missing name Mising nameFriend
Messages: 16
Registered: May 2010
Junior Member
Thanks! It is so obvious now that you mention it - I can't believe I missed it!

Unfortunately for me, this make my situation a little harder to manage. To give you some background, I have an RCP application that is made up of multiple plug-ins. The main app plug-in provides a login, some security, manages events between it's "child" plug-ins, and creates the workbench. The child plug-ins connect to this main app through extension points - the children depend on the main app but the main app does not know anything about the children. These children each contain a perspective that is opened via menu extensions. I also want to set the initial perspective of the workbench to one of these child plug-in perspectives.

The problem is that I want the child plug-in to create its own window/page so that it has access to it's own input. The ApplicationWorkbenchAdvisor resides in the main app, so overriding the default input there won't help me since the child plug-in is what knows how to create the input.

I got around this by setting the default perspective to a blank perspective, then calling a command handler from the child to close the active page and open a new one with it's input and perspective. This works, but it doesn't look very good because you see the flip between perspectives. I would rather have a seamless opening of the child plug-in's perspective when the app is launched.

Sorry for how long winded this has become, but I am looking for the best way to accomplish this, and I am not sure how. This is why I initially asked if there is a method I can override, perhaps in the ApplicationWorkbenchWindowAdvisor, where I can do a openPage() instead of letting it set its own initial perspective. That way I can call the openPage() in a command handler from the child plug-in so it can handle the input itself.

Thanks again!
Jim

[Updated on: Tue, 23 November 2010 16:26]

Report message to a moderator

Re: Setting input on default perspective [message #640971 is a reply to message #640948] Tue, 23 November 2010 17:17 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

What about using org.eclipse.ui.IWorkbench.openWorkbenchWindow(String,
IAdaptable) as that allows you to specify both the perspectveId and input?

PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Platform_Expression_Framework
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Re: Setting input on default perspective [message #640997 is a reply to message #640971] Tue, 23 November 2010 19:37 Go to previous messageGo to next message
Missing name Mising name is currently offline Missing name Mising nameFriend
Messages: 16
Registered: May 2010
Junior Member
I actually am using that at the moment, but how do I suppress the default behavior of the ApplicationWorkbenchAdvisor? It wants to open an initial window/perspective. Is there a way to stop it from doing so, so that I can call openWorkbenchWindow myself? Currently, I am letting it open a default perspective (blank), closing it, and letting the child plug-in open it with openWorkbenchWindow(). That works great but has the side-effect of flashing the default window briefly. I tried setting the shell of the default window to setVisible(false) in ApplicationWorkbenchWindowAdvisor.postWindowCreate() , but that does not stop the flashing.

Jim
Re: Setting input on default perspective [message #641255 is a reply to message #640997] Wed, 24 November 2010 16:19 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

SO the login that you have provided by the main app is not hosted in a
workbench window? Is it just a dialog before you start processing child
contributions/windows?

PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Platform_Expression_Framework
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Re: Setting input on default perspective [message #641494 is a reply to message #641255] Thu, 25 November 2010 16:53 Go to previous messageGo to next message
Missing name Mising name is currently offline Missing name Mising nameFriend
Messages: 16
Registered: May 2010
Junior Member
That is correct. The Login is a dialog that launches the workbench on success.
Re: Setting input on default perspective [message #641971 is a reply to message #641494] Mon, 29 November 2010 12:23 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Jim wrote:
> That is correct. The Login is a dialog that launches the workbench on
> success.

Can you get away with closing the window in the
org.eclipse.ui.application.WorkbenchWindowAdvisor.postWindow Restore() ?

PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Platform_Expression_Framework
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Previous Topic:Showing dialog window before closing the view
Next Topic:Debuging org.eclipse.core.expressions.definitions
Goto Forum:
  


Current Time: Fri Nov 21 17:51:02 GMT 2014

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

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