Skip to content

Commit

Permalink
clean up of QualNameAffectedCommand and QualNameChangeListener
Browse files Browse the repository at this point in the history
  • Loading branch information
oberlehner committed Jan 20, 2025
1 parent 52ac4ad commit abef213
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,14 @@ public interface QualNameAffectedCommand extends ScopedCommand {
* encapsulate the change to not provide the command to the receiver
*/
default QualNameChange getQualNameChange(final QualNameChangeState state) {
return new QualNameChange(getOldQualName(), getNewQualName(), getChangedElement(), getTypeEntry(getChangedElement()),
state);
return new QualNameChange(getOldQualName(), getNewQualName(), getChangedElement(),
getTypeEntry(getChangedElement()), state);
}

static TypeEntry getTypeEntry(final INamedElement notifier) {
final EObject rootContainer = EcoreUtil.getRootContainer(notifier);
Assert.isTrue(rootContainer instanceof LibraryElement);
if (rootContainer instanceof final LibraryElement element) {
return element.getTypeEntry();
}
return null;
return ((LibraryElement) rootContainer).getTypeEntry();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ protected abstract List<AbstractOperation> constructExecutableUndoOperations(fin

protected void onCommandExecuted(final QualNameChange qualNameChange) {
if (isEnabled(qualNameChange.notifier())) {
addToPendingList(qualNameChange);
addChangeToPendingList(qualNameChange);
}
}

Expand All @@ -55,10 +55,6 @@ protected void onCommandUndoExecuted(final QualNameChange qualNameChange) {
}
}

private void addToPendingList(final QualNameChange qualNameChange) {
addChangeToPendingList(qualNameChange);
}

void onCommandRedoExecuted(final QualNameChange qualNameChange) {
addChangeToPendingList(qualNameChange);
}
Expand Down

0 comments on commit abef213

Please sign in to comment.