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

    final String valueText = getValueText(refChange);
    final String referenceText = getReferenceText(refChange);

    String remotely = ""; // $NON-NLS-1$
    if (refChange.getSource() == DifferenceSource.RIGHT) {
      remotely = "remotely "; // $NON-NLS-1$
    }

    String ret = ""; // $NON-NLS-1$
    switch (refChange.getKind()) {
      case ADD:
        ret =
            valueText
                + " has been "
                + remotely
                + "added to "
                + referenceText; //$NON-NLS-1$ //$NON-NLS-2$
        break;
      case DELETE:
        ret =
            valueText
                + " has been "
                + remotely
                + "deleted from "
                + referenceText; //$NON-NLS-1$ //$NON-NLS-2$
        break;
      case CHANGE:
        String changeText = changeText(refChange, refChange.getReference());
        ret =
            referenceText
                + " "
                + valueText
                + " has been "
                + remotely
                + changeText; //$NON-NLS-1$ //$NON-NLS-2$
        break;
      case MOVE:
        ret =
            valueText
                + " has been "
                + remotely
                + "moved in "
                + referenceText; //$NON-NLS-1$ //$NON-NLS-2$
        break;
      default:
        throw new IllegalStateException(
            "Unsupported "
                + DifferenceKind.class.getSimpleName() // $NON-NLS-1$
                + " value: "
                + refChange.getKind()); // $NON-NLS-1$
    }

    return ret;
  }
  /**
   * Tests the behavior of attribute <code>kind</code>'s accessors.
   *
   * @generated
   */
  @Test
  public void testKind() {
    EStructuralFeature feature = org.eclipse.emf.compare.ComparePackage.eINSTANCE.getDiff_Kind();
    ReferenceChange referenceChange = CompareFactory.eINSTANCE.createReferenceChange();
    referenceChange.eAdapters().add(new MockEAdapter());
    org.eclipse.emf.compare.DifferenceKind kindValue =
        (org.eclipse.emf.compare.DifferenceKind) feature.getDefaultValue();
    for (org.eclipse.emf.compare.DifferenceKind aDifferenceKind :
        org.eclipse.emf.compare.DifferenceKind.VALUES) {
      if (kindValue.getValue() != aDifferenceKind.getValue()) {
        kindValue = aDifferenceKind;
        break;
      }
    }

    assertFalse(referenceChange.eIsSet(feature));
    assertEquals(feature.getDefaultValue(), referenceChange.getKind());

    referenceChange.setKind(kindValue);
    assertTrue(notified);
    notified = false;
    assertEquals(kindValue, referenceChange.getKind());
    assertEquals(referenceChange.getKind(), referenceChange.eGet(feature));
    assertTrue(referenceChange.eIsSet(feature));

    referenceChange.eUnset(feature);
    assertTrue(notified);
    notified = false;
    assertEquals(feature.getDefaultValue(), referenceChange.getKind());
    assertEquals(referenceChange.getKind(), referenceChange.eGet(feature));
    assertFalse(referenceChange.eIsSet(feature));

    referenceChange.eSet(feature, kindValue);
    assertTrue(notified);
    notified = false;
    assertEquals(kindValue, referenceChange.getKind());
    assertEquals(referenceChange.getKind(), referenceChange.eGet(feature));
    assertTrue(referenceChange.eIsSet(feature));

    referenceChange.setKind(null);
    assertTrue(notified);
    notified = false;
    assertEquals(feature.getDefaultValue(), referenceChange.getKind());
    assertEquals(referenceChange.getKind(), referenceChange.eGet(feature));
    assertFalse(referenceChange.eIsSet(feature));
  }
  /**
   * {@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;
  }