Skip to main content

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 LorinczFriend
Messages: 35
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.
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 LorinczFriend
Messages: 35
Registered: April 2011
It look like setting the input on a ViewPart is marked as an Eclipse bug.

However, for the search I've found a new solution. The extension 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: Fri Dec 03 17:37:43 GMT 2021

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

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

Back to the top