Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » How to prevent SetPropertyValueCommand from being pushed to CommandStack
How to prevent SetPropertyValueCommand from being pushed to CommandStack [message #1042986] Wed, 17 April 2013 01:56 Go to next message
Yoshinori Sugawara is currently offline Yoshinori Sugawara
Messages: 1
Registered: April 2013
Junior Member
Hi.

I am creating a graphical editor with GEF and using IPropertySource to edit model via Property Sheet.

Now I am having a problem.

When I want to reject an invalid value typed in Property Sheet, I do nothing in IPropertySource#setPropertyValue().
In this case SetPropertyValueCommand doesn't change property but will be pushed to CommandStack.

Can anyone tell me how to reject the input value without pushing SetPropertyValueCommand to CommandStack?

Regards,
Yoshinori
Re: How to prevent SetPropertyValueCommand from being pushed to CommandStack [message #1052908 is a reply to message #1042986] Wed, 01 May 2013 05:22 Go to previous message
Maarten Bezemer is currently offline Maarten Bezemer
Messages: 109
Registered: February 2012
Senior Member
Hi,

The Command class (which, I suppose, is used by your SetPropertyValueCommand class) has the canExecute() method.

Override this method and return false if the command cannot get executed, depending on your conditions. This will prevent the execution of the command and thus prevents it appearing on the CommandStack.

Cheers,
Maarten
Previous Topic:Error when adding figure to container
Next Topic:PolylineConnection figure disappears
Goto Forum:
  


Current Time: Sat Aug 23 07:43:52 EDT 2014

Powered by FUDForum. Page generated in 0.04610 seconds