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:Windows gradient feedback
Next Topic:EditDomain Listener blocks draw2d's dragListener on Figures
Goto Forum:
  


Current Time: Wed Mar 29 11:29:52 GMT 2017

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

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