Package org.eclipse.gef.ui.properties
Class SetPropertyValueCommand
java.lang.Object
org.eclipse.gef.commands.Command
org.eclipse.gef.ui.properties.SetPropertyValueCommand
A command used to set or reset the value of a property.
- Since:
- 3.7
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected static final ObjectValue constant to indicate that the property is to be reset to its default value during execute/redo and undo.
- 
Constructor SummaryConstructorsConstructorDescriptionSetPropertyValueCommand(String propertyLabel, IPropertySource propertySource, Object propertyId, Object newValue) Constructs a newSetPropertyValueCommand.
- 
Method SummaryModifier and TypeMethodDescriptionbooleanvoidexecute()Executes the Command.protected ObjectReturns the new value to be set for the property when executing or redoing.protected ObjectAfter the command has been executed or redone, returns the old value of the property orDEFAULT_VALUEif the property did not have a value before.protected ObjectReturns the id by which to identify the property whose value is to be set.protected IPropertySourceReturns theIPropertySourcewhich provides the property, whose value is to be set.voidredo()Re-executes the Command.voidundo()Undoes the changes performed duringexecute().Methods inherited from class org.eclipse.gef.commands.CommandcanRedo, canUndo, chain, dispose, getDebugLabel, getLabel, setDebugLabel, setLabel
- 
Field Details- 
DEFAULT_VALUEValue constant to indicate that the property is to be reset to its default value during execute/redo and undo.
 
- 
- 
Constructor Details- 
SetPropertyValueCommandpublic SetPropertyValueCommand(String propertyLabel, IPropertySource propertySource, Object propertyId, Object newValue) Constructs a newSetPropertyValueCommand.- Parameters:
- propertyLabel- A label to identify the property whose value is set by this command.
- propertySource- The property source which provides the property, whose value is to be set.
- propertyId- The id of the property whose value is to be set.
- newValue- The new value to set for the property or- DEFAULT_VALUEto indicate that the property should be reset.
- Since:
- 3.7
 
 
- 
- 
Method Details- 
canExecutepublic boolean canExecute()- Overrides:
- canExecutein class- Command
- Returns:
- trueif the command can be executed
- See Also:
 
- 
executepublic void execute()Description copied from class:CommandExecutes the Command. This method should not be called if the Command is not executable.
- 
getNewValueReturns the new value to be set for the property when executing or redoing.- Returns:
- the new value or DEFAULT_VALUEto indicate that the default value should be set as the new value.
- Since:
- 3.7
 
- 
getOldValueAfter the command has been executed or redone, returns the old value of the property orDEFAULT_VALUEif the property did not have a value before.- Returns:
- the old value of the property or DEFAULT_VALUE.
- Since:
- 3.7
 
- 
getPropertyIdReturns the id by which to identify the property whose value is to be set.- Returns:
- the id of the property whose value is to be set.
- Since:
- 3.7
 
- 
getPropertySourceReturns theIPropertySourcewhich provides the property, whose value is to be set.- Returns:
- the IPropertySourcewhich provides the property.
- Since:
- 3.7
 
- 
redopublic void redo()Description copied from class:CommandRe-executes the Command. This method should only be called afterundo()has been called.
- 
undopublic void undo()Description copied from class:CommandUndoes the changes performed duringexecute(). This method should only be called afterexecutehas been called, and only whencanUndo()returnstrue.
 
-