Skip to main content



      Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Best place to initialize data?
Best place to initialize data? [message #461326] Tue, 09 January 2007 06:14 Go to next message
Eclipse UserFriend
My RCP application uses several view parts to display some data model. I'd like to initialize the data before these views are populated from a perspective. The data is unmarshalled from a simple xml file.

I am wondering where is the best place to initialize the data. I think of 2 probable ways:


1. I found in the documentation that the WorkbenchWindowAdvisor class has method postWindowOpen() that is called after the window has been opened; use to hook window listeners, etc. I think this is a possible place to initialize my data.

But then I don't know how to get back the data, that is suppose that I am in a view part, how can I get the WorkbenchWindowAdvisor of the application? I don't find any method for this.

2. I also found also that the interface IWorkbenchWindowConfigurer provides methods getData() and setData() to access a data object associated with the given key. The workbench window configurer is typically initialized within the WorkbenchWindowAdvisor or WorkbenchAdvisor objects.

But as above, I don't know how to get the IWorkbenchWindowConfigurer object from a view part. So I cannot get the data for the views.


My questions are:

1. Are those above places good for initialization of data? If one of them is the right place, what method that I need to call to access the WorkbenchWindowAdvisor object if I am in a view part?

2. Or is there any better place to initialize the data?


Any response or suggestion is greatly appreciated.
Re: Best place to initialize data? [message #461332 is a reply to message #461326] Tue, 09 January 2007 08:07 Go to previous messageGo to next message
Eclipse UserFriend
It might be better to have a plugin/bundle activator, which is called when your bundle is started. If you've got something that makes contributions to the UI, then you'll probably have it already; something like MyPluginUI? It should have 'start' and 'stop' methods on it.

If you put initialisation code in there, then when the bundle is started (but not before) the initialisation code will be called. If you put it in the WorkbenchWindowAdvisor, then it will work if you start your app as an RCP but fail as a bundle.

If you have a UI and non-UI bundle, then put the initialisation code into the non-UI bundle (if it's for data) or the UI bundle (if it's for presentation).

Alex.
Re: Best place to initialize data? [message #461350 is a reply to message #461332] Tue, 09 January 2007 11:26 Go to previous message
Eclipse UserFriend
Alex,

Thank you very much for your response. Surely I have a bundle activator with start() and stop() method. I will put the initialization and the removal of data into these methods.

Regards,

Phuong
Previous Topic:how to hide the actionsets associated with view part
Next Topic:Context menus on views
Goto Forum:
  


Current Time: Mon Mar 24 22:40:12 EDT 2025

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

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

Back to the top