/**
   * {@inheritDoc}
   *
   * @see org.eclipse.emf.compare.provider.ReferenceChangeItemProvider#getImage(java.lang.Object)
   */
  @Override
  public Object getImage(Object object) {
    ReferenceChange refChange = (ReferenceChange) object;

    Object image = AdapterFactoryUtil.getImage(getRootAdapterFactory(), refChange.getValue());

    return image;
  }
 protected String getValueText(final ReferenceChange refChange) {
   String value = AdapterFactoryUtil.getText(getRootAdapterFactory(), refChange.getValue());
   if (value == null) {
     value = "<null>"; // $NON-NLS-1$
   } else {
     value = org.eclipse.emf.compare.provider.spec.Strings.elide(value, 50, "..."); // $NON-NLS-1$
   }
   return value;
 }
  /**
   * {@inheritDoc}
   *
   * @see org.eclipse.emf.edit.provider.ItemProviderAdapter#getChildren(java.lang.Object)
   */
  @Override
  public Collection<?> getChildren(Object object) {
    Collection<?> superChildren = super.getChildren(object);
    List<? super Object> ret = newArrayList(superChildren);

    ReferenceChange referenceChange = (ReferenceChange) object;
    EReference reference = referenceChange.getReference();

    if (reference.isContainment()) {
      Match matchOfValue =
          referenceChange.getMatch().getComparison().getMatch(referenceChange.getValue());
      if (matchOfValue != null) {
        Collection<?> children = getChildren(matchOfValue);
        children.remove(referenceChange);
        ret.addAll(children);
      }
    }

    return ImmutableList.copyOf(filter(ret, not(MatchItemProviderSpec.REFINED_DIFF)));
  }
  /**
   * {@inheritDoc}
   *
   * @see org.eclipse.emf.compare.provider.ReferenceChangeItemProvider#getText(java.lang.Object)
   */
  @Override
  public String getText(Object object) {
    final ReferenceChange refChange = (ReferenceChange) object;

    EObject value = refChange.getValue();
    final String valueName = CompareItemProviderAdapterFactorySpec.getText(adapterFactory, value);

    String change = "";
    if (refChange.getSource() == DifferenceSource.RIGHT) {
      change = "remotely ";
    }
    if (refChange.getKind() == DifferenceKind.ADD) {
      change += "added to";
    } else if (refChange.getKind() == DifferenceKind.DELETE) {
      change += "deleted from";
    } else if (refChange.getKind() == DifferenceKind.CHANGE) {
      change += "changed from";
    } else {
      change += "moved from";
    }
    final String objectName;
    if (refChange.getMatch().getLeft() instanceof ENamedElement) {
      objectName = ((ENamedElement) refChange.getMatch().getLeft()).getName();
    } else if (refChange.getMatch().getRight() instanceof ENamedElement) {
      objectName = ((ENamedElement) refChange.getMatch().getRight()).getName();
    } else if (refChange.getMatch().getOrigin() instanceof ENamedElement) {
      objectName = ((ENamedElement) refChange.getMatch().getOrigin()).getName();
    } else {
      objectName = "";
    }
    return "value "
        + valueName
        + " has been "
        + change
        + " reference "
        + refChange.getReference().getName()
        + " of object "
        + objectName;
  }
  /**
   * Tests the behavior of reference <code>value</code>'s accessors.
   *
   * @generated
   */
  @Test
  public void testValue() {
    EStructuralFeature feature =
        org.eclipse.emf.compare.ComparePackage.eINSTANCE.getReferenceChange_Value();
    ReferenceChange referenceChange = CompareFactory.eINSTANCE.createReferenceChange();
    referenceChange.eAdapters().add(new MockEAdapter());
    org.eclipse.emf.ecore.EObject valueValue =
        org.eclipse.emf.ecore.EcoreFactory.eINSTANCE.createEObject();

    assertFalse(referenceChange.eIsSet(feature));
    assertNull(referenceChange.getValue());

    referenceChange.setValue(valueValue);
    assertTrue(notified);
    notified = false;
    assertSame(valueValue, referenceChange.getValue());
    assertSame(referenceChange.getValue(), referenceChange.eGet(feature));
    assertSame(referenceChange.getValue(), referenceChange.eGet(feature, false));
    assertTrue(referenceChange.eIsSet(feature));

    referenceChange.eUnset(feature);
    assertTrue(notified);
    notified = false;
    assertNull(referenceChange.getValue());
    assertSame(referenceChange.getValue(), referenceChange.eGet(feature));
    assertSame(referenceChange.getValue(), referenceChange.eGet(feature, false));
    assertFalse(referenceChange.eIsSet(feature));

    referenceChange.setValue(valueValue);
    assertTrue(notified);
    notified = false;
    assertSame(valueValue, referenceChange.getValue());
    assertSame(referenceChange.getValue(), referenceChange.eGet(feature));
    assertSame(referenceChange.getValue(), referenceChange.eGet(feature, false));
    assertTrue(referenceChange.eIsSet(feature));

    referenceChange.eSet(feature, valueValue);
    assertTrue(notified);
    notified = false;
    assertSame(valueValue, referenceChange.getValue());
    assertSame(referenceChange.getValue(), referenceChange.eGet(feature));
    assertSame(referenceChange.getValue(), referenceChange.eGet(feature, false));
    assertTrue(referenceChange.eIsSet(feature));

    referenceChange.setValue(null);
    assertTrue(notified);
    notified = false;
    assertNull(referenceChange.getValue());
    assertSame(feature.getDefaultValue(), referenceChange.getValue());
    assertSame(referenceChange.getValue(), referenceChange.eGet(feature));
    assertSame(referenceChange.getValue(), referenceChange.eGet(feature, false));
    assertFalse(referenceChange.eIsSet(feature));
  }