Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » How to detect when the result of the canExecute-method method has changed on an already open menu
How to detect when the result of the canExecute-method method has changed on an already open menu [message #1749330] Mon, 05 December 2016 15:18 Go to next message
Klaus Reger is currently offline Klaus RegerFriend
Messages: 2
Registered: December 2016
Junior Member
Hello everybody,

I have the following question:

A user has opened a menu with the right mouse button, but has not yet made a selection. In the meantime, the canExecute method returns the value false for one of the menu items.
However, the corresponding menu entry in question is not grayed out, and a click on it only calls the canExecute method.

But in this case, I would like to generate a warning message informing the user that the function is no longer available.

How can you do this because the canExecute handler has no indication of the event's trigger?

Thank you very much.
Re: How to detect when the result of the canExecute-method method has changed on an already open men [message #1752542 is a reply to message #1749330] Wed, 25 January 2017 00:26 Go to previous messageGo to next message
Patrik Suzzi is currently offline Patrik SuzziFriend
Messages: 86
Registered: June 2010
Location: Imola, Italy
Member

@CanExecute is computed at initialization, and when the state changes.
It is not intended to be triggered when your mouse hovers over one menuItem linked to a specific handler.

I suggest you change the label of the related menuItem, instead of displaying a warning.

Below you can see a change in Eclipse code where, at the end of the @Execute method, the commandService is used to change the label of a menu Item:
https://git.eclipse.org/r/#/c/89058/2/bundles/org.eclipse.ui.workbench/Eclipse+UI/org/eclipse/ui/internal/handlers/ToggleStatusBarHandler.java

Regards,
Ing. Patrik Suzzi
Consultant Software Engineer,
Eclipse Platform Committer
https://about.me/psuzzi
Re: How to detect when the result of the canExecute-method method has changed on an already open men [message #1752543 is a reply to message #1749330] Wed, 25 January 2017 00:26 Go to previous message
Patrik Suzzi is currently offline Patrik SuzziFriend
Messages: 86
Registered: June 2010
Location: Imola, Italy
Member

deleted duplicated message

[Updated on: Wed, 25 January 2017 00:28]

Report message to a moderator

Previous Topic:eclipse ui problem with fedora gnome 3
Next Topic:e4xmi view class uri
Goto Forum:
  


Current Time: Fri Jun 22 03:55:13 GMT 2018

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

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

Back to the top