Class EMFCompareChangeRecorder

All Implemented Interfaces:
Adapter, Adapter.Internal

public class EMFCompareChangeRecorder extends ChangeRecorder
This custom implementation of a change recorder will avoid copying the internal lists every time they're needed as they can grow to very large sizes along with the size of the compared models.
  • Constructor Details

    • EMFCompareChangeRecorder

      public EMFCompareChangeRecorder()
  • Method Details

    • setTarget

      public void setTarget(Notifier target)
      Overrides the superclass method to ignore the "originalTargetObjets" list since we never resume recording a paused change description.
      Specified by:
      setTarget in interface Adapter
      Overrides:
      setTarget in class ChangeRecorder
    • handleFeature

      protected void handleFeature(EStructuralFeature feature, EReference containment, Notification notification, EObject eObject)
      The "setOriginalTargetObjects" Set is used to register target objects instead of the "originalTargetObjects" list to avoid duplicates, and fill this list with the bare minimum afterwards, for optimization purposes.
      Overrides:
      handleFeature in class ChangeRecorder
    • beginRecording

      public void beginRecording(ChangeDescription changeDescription, Collection<?> rootObjects)
      This avoids growing the "originalTargetObjects" and "setOriginalTargetObjects" collections indefinitely during the same comparison each time a merge is executed.
      Overrides:
      beginRecording in class ChangeRecorder
    • consolidateChanges

      protected void consolidateChanges()
      See bug 562321. Some Sirius objects that changed during merging may become orphans and were removed by the org.eclipse.emf.ecore.change.util.ChangeRecorder#consolidateChanges() method. So we fill the originalTargetObjects list with these orphaned objects to keep them.
      Overrides:
      consolidateChanges in class ChangeRecorder
    • createChangeDescription

      protected ChangeDescription createChangeDescription()
      Overrides:
      createChangeDescription in class BasicChangeRecorder