Class SingleValuedAttributeModelUpdateStrategy
- java.lang.Object
-
- org.eclipse.emf.compare.rcp.ui.internal.contentmergeviewer.SingleValuedAttributeModelUpdateStrategy
-
- All Implemented Interfaces:
IModelUpdateStrategy
public class SingleValuedAttributeModelUpdateStrategy extends Object implements IModelUpdateStrategy
AIModelUpdateStrategy
for single-valuedEAttributes
.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 returnfalse
oncanUpdate(Diff, MergeViewerSide)
and return a command ongetModelUpdateCommand(Diff, Object, MergeViewerSide)
that specifies false onCommand.canExecute()
. Therefore, it can be used as default strategy.
-
-
Constructor Summary
Constructors Constructor Description SingleValuedAttributeModelUpdateStrategy()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canUpdate(Diff diff, IMergeViewer.MergeViewerSide side)
Specifies whether the value in the model can to be updated on the givenside
.Command
getModelUpdateCommand(Diff diff, Object newValue, IMergeViewer.MergeViewerSide side)
Returns a command for updating the underlying model with the givennewValue
on the givenside
.
-
-
-
Method Detail
-
canUpdate
public boolean canUpdate(Diff diff, IMergeViewer.MergeViewerSide side)
Specifies whether the value in the model can to be updated on the givenside
.- Specified by:
canUpdate
in interfaceIModelUpdateStrategy
- Parameters:
diff
- The diff acting as context of the potential model update.side
- The side to check.- Returns:
true
if the value can be updated,false
otherwise.- See Also:
IModelUpdateStrategy.canUpdate(Diff, MergeViewerSide)
-
getModelUpdateCommand
public Command getModelUpdateCommand(Diff diff, Object newValue, IMergeViewer.MergeViewerSide side)
Returns a command for updating the underlying model with the givennewValue
on the givenside
.- Specified by:
getModelUpdateCommand
in interfaceIModelUpdateStrategy
- Parameters:
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.- Returns:
- A command to perform the model update.
- See Also:
IModelUpdateStrategy.getModelUpdateCommand(Diff, Object, MergeViewerSide)
-
-