/** * {@inheritDoc} * * @see org.eclipse.emf.compare.diff.merge.api.AbstractMerger#applyInOrigin() */ @Override public void applyInOrigin() { final AttributeChangeLeftTarget theDiff = (AttributeChangeLeftTarget) this.diff; final EObject origin = theDiff.getLeftElement(); final Object value = theDiff.getLeftTarget(); final EAttribute attr = theDiff.getAttribute(); try { EFactory.eRemove(origin, attr.getName(), value); } catch (FactoryException e) { EMFComparePlugin.log(e, true); } super.applyInOrigin(); }
/** * {@inheritDoc} * * @see org.eclipse.emf.compare.diff.merge.api.AbstractMerger#undoInTarget() */ @Override public void undoInTarget() { final AttributeChangeLeftTarget theDiff = (AttributeChangeLeftTarget) this.diff; final EObject target = theDiff.getRightElement(); final Object value = theDiff.getLeftTarget(); final EAttribute attr = theDiff.getAttribute(); try { int valueIndex = -1; if (attr.isMany()) { final EObject leftElement = theDiff.getLeftElement(); final Object leftValues = leftElement.eGet(attr); if (leftValues instanceof List) { final List leftValuesList = (List) leftValues; valueIndex = leftValuesList.indexOf(value); } } EFactory.eAdd(target, attr.getName(), value, valueIndex); } catch (FactoryException e) { EMFComparePlugin.log(e, true); } super.undoInTarget(); }