Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » How to Set TableViewer in a Dialog as a Selection Provider
How to Set TableViewer in a Dialog as a Selection Provider [message #500292] Wed, 25 November 2009 15:32 Go to next message
Aaron L is currently offline Aaron LFriend
Messages: 18
Registered: November 2009
Junior Member
I have an RCP application that contains a wizard with a summary page that displays a table of data at the end.

The table in the wizard page includes a context/popup menu with a copy action contributed to it via the plugin.xml. Since this is a context menu in a wizard page, I can't register the menu via getSite().registerContextMenu(). Instead I use IMenuService.populateContributionManager(myTable) to populate the context menu.

The Copy command is displayed in the context menu fine, but it is never enabled. The Copy command includes an "enabledWhen" clause in the plugin.xml file that uses the current selection and a property tester to determine the enabled state.

When I remove the "enabledWhen" clause from the Copy handler, my Copy command works perfectly.

I believe the problem is due to the fact that the table in my wizard page is not a set as a selection provider and therefore my Copy command's enabled state is never evaluated when my table selection changes.

I would like to know how (or if it is even possible) to register the tableviewer in my wizard page as a selection provider even though no view or editor part is used (i.e. I can't call getSite().setSelectionProvider()).

Any help would be greatly appreciated.

Re: How to Set TableViewer in a Dialog as a Selection Provider [message #500386 is a reply to message #500292] Wed, 25 November 2009 20:57 Go to previous message
Aaron L is currently offline Aaron LFriend
Messages: 18
Registered: November 2009
Junior Member
I haven't figured out how to register the TableViewer in a Dialog as a selection provider, but I did find another solution to enabling my Copy command.

My copy handler was using the "selection" variable in the handler's "enabledWhen" clause. I replaced the "selection" variable with the "activeMenuSelection" variable and now it evaluates the enabled state correctly.

I would still be interested to know if I could register a non-ViewPart tableViewer as a selection provider for the workbench. I think if this can be done, I could go back to just using the plain old "selection" variable.
Previous Topic:how to place views when opening a perspective?
Next Topic:Using a form page as the GUI for a properties view tab?
Goto Forum:
  


Current Time: Fri Apr 26 12:08:27 GMT 2024

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

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

Back to the top