public class SingleValuedAttributeModelUpdateStrategy extends Object implements IModelUpdateStrategy
IModelUpdateStrategy
for single-valued EAttributes
.
This strategy is tolerant in the sense that it will not throw exceptions if the input is not a supported
AttributeChange
. In this case, this strategy will return false
on
#canUpdate(Diff, MergeViewerSide)
and return a command on
#getModelUpdateCommand(Diff, Object, MergeViewerSide)
that specifies false on
Command.canExecute()
. Therefore, it can be used as default strategy.
Constructor and Description |
---|
SingleValuedAttributeModelUpdateStrategy() |
Modifier and Type | Method and Description |
---|---|
boolean |
canUpdate(Diff diff,
IMergeViewer.MergeViewerSide side)
Specifies whether the value in the model can to be updated on the given
side . |
Command |
getModelUpdateCommand(Diff diff,
Object newValue,
IMergeViewer.MergeViewerSide side)
Returns a command for updating the underlying model with the given
newValue on the given
side . |
public SingleValuedAttributeModelUpdateStrategy()
public boolean canUpdate(Diff diff, IMergeViewer.MergeViewerSide side)
side
.canUpdate
in interface IModelUpdateStrategy
diff
- The diff acting as context of the potential model update.side
- The side to check.true
if the value can be updated, false
otherwise.IModelUpdateStrategy#canUpdate(Diff, MergeViewerSide)
public Command getModelUpdateCommand(Diff diff, Object newValue, IMergeViewer.MergeViewerSide side)
newValue
on the given
side
.getModelUpdateCommand
in interface IModelUpdateStrategy
diff
- The diff acting as context of the model update.newValue
- The new value to be set.side
- The side on which the update is to be performed.IModelUpdateStrategy#getModelUpdateCommand(Diff, Object, MergeViewerSide)
Copyright (c) 2006, 2014 Obeo and others. All rights reserved.