Search in sources :

Example 1 with Delta

use of org.eclipse.xtext.ide.serializer.impl.EObjectDescriptionDeltaProvider.Delta in project xtext-core by eclipse.

the class ReferenceUpdater method findContainingDelta.

public Delta findContainingDelta(Deltas deltas, EObject obj) {
    EObject current = obj;
    while (current != null) {
        Delta delta = deltas.getDelta(current);
        if (delta != null && delta.hasSimpleNameOrUserdataChanged()) {
            return delta;
        }
        current = current.eContainer();
    }
    return null;
}
Also used : Delta(org.eclipse.xtext.ide.serializer.impl.EObjectDescriptionDeltaProvider.Delta) EObject(org.eclipse.emf.ecore.EObject)

Example 2 with Delta

use of org.eclipse.xtext.ide.serializer.impl.EObjectDescriptionDeltaProvider.Delta in project xtext-core by eclipse.

the class ReferenceUpdater method needsUpdating.

protected boolean needsUpdating(IReferenceUpdaterContext context, IUpdatableReference ref) {
    QualifiedName fqn = getQualifiedName(ref);
    if (fqn == null) {
        return false;
    }
    EObject target = ref.getTargetEObject();
    Deltas deltas = context.getEObjectDescriptionDeltas();
    Delta delta = deltas.getDelta(target);
    if (delta != null && !containsReferenceText(delta, fqn)) {
        return true;
    }
    Delta targetDelta = findContainingDelta(deltas, target);
    if (targetDelta != null && targetDelta.getObject() == target) {
        return true;
    }
    Delta sourceDelta = findContainingDelta(deltas, ref.getSourceEObject());
    return !Objects.equal(sourceDelta, targetDelta);
}
Also used : Deltas(org.eclipse.xtext.ide.serializer.impl.EObjectDescriptionDeltaProvider.Deltas) Delta(org.eclipse.xtext.ide.serializer.impl.EObjectDescriptionDeltaProvider.Delta) QualifiedName(org.eclipse.xtext.naming.QualifiedName) EObject(org.eclipse.emf.ecore.EObject)

Aggregations

EObject (org.eclipse.emf.ecore.EObject)2 Delta (org.eclipse.xtext.ide.serializer.impl.EObjectDescriptionDeltaProvider.Delta)2 Deltas (org.eclipse.xtext.ide.serializer.impl.EObjectDescriptionDeltaProvider.Deltas)1 QualifiedName (org.eclipse.xtext.naming.QualifiedName)1