|Creating and initializing a view based on some initial data [message #990197]
||Tue, 11 December 2012 06:30
| Levente Mising name
Registered: December 2010
When a view is created, is there a way to pass in some information based on which it can initialize its component widgets?
For example, in my application I am trying to create multiple instances of the same view, each instance showing information about a different product. One of the widgets in this view is a ComboViewer which displays the product type (stock, future, option, etc).
I would like to initialize the selection in the ComboViewer to the type of the product that is used to initialize the view.
So far I was only able to do this as a two-step process:
1. Create/show the view using IWorkbenchPage.showView(viewId, secondaryId, IWorkbenchPage.VIEW_ACTIVATE) which returns a IViewPart
2. Cast the reurned IViewPart to my view's type and explicitly call an initialization method on the view:
Is there any way to do this in a single step somehow, by specifying the myProductObject to use at view creation time? Is there any way in the view's createPartControl() method to retrieve this initialization data?
I am looking for a solution that does not use a static registry.