Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Initialize a view that was contributed via perspective extensions(How to initialize a view, that was contributed via the perspective extensions extension point)
Initialize a view that was contributed via perspective extensions [message #644736] Tue, 14 December 2010 01:48 Go to next message
Simon L. is currently offline Simon L.Friend
Messages: 22
Registered: January 2010
Junior Member
Hello,
I just contributed the console view to my RCP over the extension point:
         <view
               closeable="true"
               id="org.eclipse.ui.console.ConsoleView"
               minimized="false"
               moveable="true"
               relationship="stack"
               standalone="false"
               visible="true">
         </view>


Now, the console view can be displayed. But, with my plugin, I also want to initialize this ui console plugin of eclipse with something -- in my case, the first console in the view. But my Activator class of the plugin is not loaded at the start of the RCP (because no classes from the plugin are loaded), and such, from that plugin, I don't know how to pass something to the console view right from teh start of the RCP.
(Just want to make sure, one, two functions get called from this plugin at RCP start)

Any tips? I'm fairly new to RCP, I dont know the usual proceedings except from looking at other projects and how they did it. But i couldnt manage to find something alike.

Thanks, your time is appreciated!


Re: Initialize a view that was contributed via perspective extensions [message #645286 is a reply to message #644736] Thu, 16 December 2010 13:04 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 add RCP code in
org.eclipse.ui.application.WorkbenchAdvisor.postStartup()

That will be called after the workbench is restored but before the main
event loop is run (well, mostly)

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: Initialize a view that was contributed via perspective extensions [message #645393 is a reply to message #645286] Fri, 17 December 2010 01:35 Go to previous messageGo to next message
Simon L. is currently offline Simon L.Friend
Messages: 22
Registered: January 2010
Junior Member
Hello, Paul,
after your answer, I started looking after an extension point with "startup" in it, and i fugured out, the extension point "org.eclipse.ui.startup" solves exactly my case. Thanks a lot!

So for all who want their plugins loaded from start (not lazy), give org.eclipse.ui.startup a try Smile
Re: Initialize a view that was contributed via perspective extensions [message #647155 is a reply to message #645393] Tue, 04 January 2011 19:24 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

On 12/16/2010 08:35 PM, Simon L. wrote:
>
> So for all who want their plugins loaded from start (not lazy), give
> org.eclipse.ui.startup a try :)

With the caveat that you will be ridiculed forever!

:-)

Small plugins, with no extensions and minimal dependencies, qualify.
But it shouldn't be used outside of that, or it will break eclipse's
lazy loading strategy (which should be decided at the
product/application level, not the plugin level).

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: Initialize a view that was contributed via perspective extensions [message #649880 is a reply to message #647155] Thu, 20 January 2011 20:17 Go to previous messageGo to next message
Simon L. is currently offline Simon L.Friend
Messages: 22
Registered: January 2010
Junior Member
What would be your proposed, ideological conform method to solve my problem? I'm always interested in good practice!

MfG,
Simon
Re: Initialize a view that was contributed via perspective extensions [message #650029 is a reply to message #649880] Fri, 21 January 2011 13:45 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

On 01/20/2011 03:17 PM, Simon L. wrote:
> What would be your proposed, ideological conform method to solve my
> problem? I'm always interested in good practice!

In an RCP, you get to control everything and have a number of
post-methods to do it (like postStartup()).

If you're an eclipse plugin or 2, the best practice is:

1) ask yourself if it can wait until something is loaded (a view, and
editor, a command executed, a connection made, etc).

2) isolate the code that needs to be started. The smaller the plugin,
the better. Separate from UI contributions (things in plugin.xml) is
best, since once activated the framework is free to load and create
instances of all contributions that come in through plugin.xml

3) don't put long operations in the activator or in the early startup
extension class. Make sure they complete swiftly, delegating to a Job
if necessary.

That's about it. It's not that the extension can't be used, but we
admonish people because 7 times out of 10, it's just a spot solution for
them, it doesn't help the Eclipse application as a whole.

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: Initialize a view that was contributed via perspective extensions [message #650140 is a reply to message #650029] Fri, 21 January 2011 22:07 Go to previous message
Simon L. is currently offline Simon L.Friend
Messages: 22
Registered: January 2010
Junior Member
Okay. May I try to exercise this for my case here? Many of those rules I did already consider while trying to find a solution in the first place.

My case again: contributing a view "org.eclipse.ui.console" to the perspectiveExtensions extension point.
My goal: to prepare a self-defined console behaviour which has to be active the very moment the user activates the view.

My problem: the perspectiveExtensions extension points introduces the console view to the pool of views that can be loaded by the user. But I found no way to hook into this loading process to participate in this lazy-loading-process by defining the behaviour of the console the moment it is loaded.

1) ask yourself if it can wait until something is loaded (a view, and editor, a command executed, a connection made, etc).
-- Yes it can wait. Until the console view is loaded.

2) isolate the code that needs to be started. The smaller the plugin, the better. Separate from UI contributions (things in plugin.xml) is best, since once activated the framework is free to load and create instances of all contributions that come in through plugin.xml
-- did. Code is isolated from UI contribution part. I only define behaviour of the console, which can be done before, or after the view is loaded.

3) don't put long operations in the activator or in the early startup extension class. Make sure they complete swiftly, delegating to a Job if necessary.
-- did - code isnt taking much computation

I dont see how that helps me here. Point 1 seems to suggest, since I answered with yes, that I have to wait with the execution to the loading of the view. But I see no way how.
Because of that I gave the early startup a try... But still, I'm not completely satisfied with it, since everything else in RCP context I managed to get done with elegant seeming solutions.

Previous Topic:No UserScope?
Next Topic:Eclipse for beginner
Goto Forum:
  


Current Time: Thu Apr 25 21:52:02 GMT 2024

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

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

Back to the top