Source:
private void internalCheckOrdering(ReferenceChange diff, boolean rightToLeft) { final EStructuralFeature feature = diff.getReference(); final EObject value = diff.getValue(); final Match match = diff.getMatch(); final Comparison comparison = match.getComparison(); final Match valueMatch = comparison.getMatch(value); final EObject sourceContainer; final EObject targetContainer; final EObject newValue; if (rightToLeft) { sourceContainer = match.getRight(); targetContainer = match.getLeft(); newValue = valueMatch.getLeft(); } else { sourceContainer = match.getLeft(); targetContainer = match.getRight(); newValue = valueMatch.getRight(); } final List<Object> sourceList = ReferenceUtil.getAsList(sourceContainer, feature); final List<Object> targetList = ReferenceUtil.getAsList(targetContainer, feature); final List<Object> lcs = DiffUtil.longestCommonSubsequence(comparison, sourceList, targetList); if (lcs.contains(valueMatch.getLeft()) || lcs.contains(valueMatch.getRight())) { return; } int insertionIndex = DiffUtil.findInsertionIndex(comparison, sourceList, targetList, value); if (insertionIndex >= 0) { @SuppressWarnings("unchecked") final List<EObject> changedList = (List<EObject>)safeEGet(targetContainer, feature); int size = changedList.size(); if (size > 1) { if (changedList instanceof EList<?>) { if (insertionIndex >= size) { ((EList<EObject>)changedList).move(size - 1, newValue); } else { ((EList<EObject>)changedList).move(insertionIndex, newValue); } } else { changedList.remove(newValue); if (insertionIndex >= size) { changedList.add(newValue); } else { changedList.add(insertionIndex, newValue); } } } } }

Target:
private void internalCheckOrdering(ReferenceChange diff, boolean rightToLeft) { final EStructuralFeature feature = diff.getReference(); final EObject value = diff.getValue(); final Match match = diff.getMatch(); final Comparison comparison = match.getComparison(); final Match valueMatch = comparison.getMatch(value); final EObject sourceContainer; final EObject targetContainer; final EObject newValue; if (rightToLeft) { sourceContainer = match.getRight(); targetContainer = match.getLeft(); newValue = valueMatch.getLeft(); } else { sourceContainer = match.getLeft(); targetContainer = match.getRight(); newValue = valueMatch.getRight(); } final List<Object> sourceList = ReferenceUtil.getAsList(sourceContainer, feature); final List<Object> targetList = ReferenceUtil.getAsList(targetContainer, feature); final List<Object> lcs = DiffUtil.longestCommonSubsequence(comparison, sourceList, targetList); if (lcs.contains(valueMatch.getLeft()) || lcs.contains(valueMatch.getRight())) { return; } int insertionIndex = DiffUtil.findInsertionIndex(comparison, sourceList, targetList, value); if (insertionIndex >= 0) { @SuppressWarnings("unchecked") final List<EObject> changedList = (List<EObject>)safeEGet(targetContainer, feature); if (changedList.size() > 1) { if (changedList instanceof EList<?>) { if (insertionIndex > changedList.size()) { ((EList<EObject>)changedList).move(changedList.size() - 1, newValue); } else { ((EList<EObject>)changedList).move(insertionIndex, newValue); } } else { changedList.remove(newValue); if (insertionIndex > changedList.size()) { changedList.add(newValue); } else { changedList.add(insertionIndex, newValue); } } } } }