Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Context menu for table viewer
Context menu for table viewer [message #629265] Mon, 27 September 2010 15:59 Go to next message
ash is currently offline ashFriend
Messages: 142
Registered: July 2010
Senior Member
HI all

I have table viewer i want menu option in context menu or view toolbar to be enabled only when user has selected row in the table else menu option has to disabled when user has not selected any row.

can any one how to implent this ...

Thanks
Ashok
Re: Context menu for table viewer [message #629400 is a reply to message #629265] Tue, 28 September 2010 06:33 Go to previous messageGo to next message
Daniel Krügler is currently offline Daniel KrüglerFriend
Messages: 853
Registered: July 2009
Senior Member
On 27.09.2010 17:59, ashok_kumar_rr@yahoo.com wrote:
> HI all
>
> I have table viewer i want menu option in context menu or view toolbar
> to be enabled only when user has selected row in the table else menu
> option has to disabled when user has not selected any row.

Just create a MenuManager as in

http://www.vogella.de/articles/EclipseCommands/article.html# contextmenu

and use the known techniques to contribute/constrain actions/commands
via extension point to the popup menu of this TableViewer.

If you have more than one context menu (popup menu) in your view, you
should create the MenuManager with the constructor that acce3pts a
(unique) id as its second constructor argument and use this ID (instead
of the view ID) as targetID when attempting to add a viewerContribution
when working with actions or when attempting to specify the locationURI
when working with commands.

Don't forget to register as selection provider as shown in above link.

HTH & Greetings from Bremen,

Daniel Krügler
Re: Context menu for table viewer [message #629846 is a reply to message #629265] Wed, 29 September 2010 17:58 Go to previous message
ash is currently offline ashFriend
Messages: 142
Registered: July 2010
Senior Member
Hi

Thanks for reply ...

Its working for the first time..

i have refresh action in my view . when user select refresh button
it clear the table and fetch the data from the database and then load the data to the table at that point of time menu item are not removed/disabled table row is not selected.

any solution for this ???

thanks
ashok

[Updated on: Wed, 29 September 2010 17:59]

Report message to a moderator

Previous Topic:eclipse workebench plugin start problem
Next Topic:Optimize TreeViewer refresh()
Goto Forum:
  


Current Time: Sat Apr 27 00:16:47 GMT 2024

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

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

Back to the top