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 05:56 Go to next message
Yoshinori Sugawara is currently offline Yoshinori SugawaraFriend
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 09:22 Go to previous message
Maarten Bezemer is currently offline Maarten BezemerFriend
Messages: 117
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: Sun Nov 23 18:58:21 GMT 2014

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

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