Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#460: Notify source/target feature change on source/target id change #143

Merged
merged 1 commit into from
Dec 7, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -430,14 +430,17 @@ public EList<GPoint> getRoutingPoints() {
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
* @generated NOT
*/
@Override
public void setSourceId(final String newSourceId) {
String oldSourceId = sourceId;
sourceId = newSourceId;
if (eNotificationRequired()) {
eNotify(new ENotificationImpl(this, Notification.SET, GraphPackage.GEDGE__SOURCE_ID, oldSourceId, sourceId));
GModelElement oldSource = findElement(oldSourceId).orElse(null);
GModelElement newSource = findElement(newSourceId).orElse(null);
eNotify(new ENotificationImpl(this, Notification.SET, GraphPackage.GEDGE__SOURCE, oldSource, newSource));
}
}

Expand All @@ -454,14 +457,17 @@ public void setSourceId(final String newSourceId) {
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
* @generated NOT
*/
@Override
public void setTargetId(final String newTargetId) {
String oldTargetId = targetId;
targetId = newTargetId;
if (eNotificationRequired()) {
eNotify(new ENotificationImpl(this, Notification.SET, GraphPackage.GEDGE__TARGET_ID, oldTargetId, targetId));
GModelElement oldTarget = findElement(oldTargetId).orElse(null);
GModelElement newTarget = findElement(newTargetId).orElse(null);
eNotify(new ENotificationImpl(this, Notification.SET, GraphPackage.GEDGE__TARGET, oldTarget, newTarget));
}
}

Expand Down Expand Up @@ -495,14 +501,10 @@ public GModelElement basicGetSource() {
*/
@Override
public void setSource(final GModelElement newSource) {
if (newSource == null) {
this.sourceId = null;
return;
}
this.sourceId = newSource.getId();
setSourceId(newSource == null ? null : newSource.getId());
}

private Optional<GModelElement> findElement(final String elementId) {
protected Optional<GModelElement> findElement(final String elementId) {
return GModelIndex.get(this).get(elementId);
}

Expand Down Expand Up @@ -536,11 +538,7 @@ public GModelElement basicGetTarget() {
*/
@Override
public void setTarget(final GModelElement newTarget) {
if (newTarget == null) {
this.targetId = null;
return;
}
this.targetId = newTarget.getId();
setTargetId(newTarget == null ? null : newTarget.getId());
}

/**
Expand Down