|Set input for a ViewPart [message #933946]
||Fri, 05 October 2012 13:40
| Lorand Lorincz
Registered: April 2011
I'm wondering if there is any mechanism to set an input to a ViewPart.|
For example: My application has a search functionality. When I hit search i want to show my result in a ViewPart that contains a table. How can I set the input of this table, how can a transmit the results to the ViewPart? I'm currently using org.eclipse.ui.IWorkbenchPage.showView(String, String, int) to show the ViewPart.
The clients requirement is that the ViewPart in which you input the search criteria is not the same in which you show the results.
I am currently using a Util class, called ViewUtil with static methods like showView(String id) and showViewWithParameter(String id, Object parameter). The second method shows the view, and save the parameter in a Map in the ViewUtil class. The createPartControl(Composite) method gets the parameter from this map and sets the input to the table. It works but I really don't like it.
Another problem is that when a call the org.eclipse.ui.IWorkbenchPage.showView(String, String, int) method, if the ViewPart is already shown, the createPartControl(Composite) method is not called, thus the input of the table is not set.
I'm sure there is a better way but I can't find it.
Powered by FUDForum
. Page generated in 0.02642 seconds