Skip to main content



      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
Eclipse UserFriend
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
Eclipse UserFriend
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: Wed Jul 23 18:44:52 EDT 2025

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

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

Back to the top