Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Set input for a ViewPart(Is it possible?)
Set input for a ViewPart [message #933946] Fri, 05 October 2012 13:40 Go to next message
Lorand Lorincz is currently offline Lorand Lorincz
Messages: 35
Registered: April 2011
Member
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.
Re: Set input for a ViewPart [message #933993 is a reply to message #933946] Fri, 05 October 2012 14:40 Go to previous message
Lorand Lorincz is currently offline Lorand Lorincz
Messages: 35
Registered: April 2011
Member
It look like setting the input on a ViewPart is marked as an Eclipse bug.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=82621.

However, for the search I've found a new solution. The extension org.eclipse.search.searchResultViewPages will do the trick.Add it to your plugin.xml and implement the required methods.
Previous Topic:How to stack views dependent on another view being present
Next Topic:Problem Exporting RCP Product
Goto Forum:
  


Current Time: Sun Sep 21 08:20:40 GMT 2014

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

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