Skip to content

Commit

Permalink
Listen to flush event to QualNameChangeListenerManagager
Browse files Browse the repository at this point in the history
  • Loading branch information
oberlehner committed Jan 20, 2025
1 parent 6ac8001 commit 52ac4ad
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ private void initializeListeners() {
for (final IConfigurationElement element : config) {
try {
final Object obj = element.createExecutableExtension("class");
if (obj instanceof QualNameChangeListener) {
listeners.add((QualNameChangeListener) obj);
if (obj instanceof final QualNameChangeListener l) {
listeners.add(l);
}
} catch (final Exception e) {
FordiacLogHelper.logError(EXTENSION_POINT_ID, e);
Expand Down Expand Up @@ -85,13 +85,19 @@ public void stackChanged(final CommandStackEvent event) {
}

if (event.getDetail() == CommandStack.POST_MARK_SAVE && event.getSource() instanceof final CommandStack stack) {

final TypeEntry typeEntry = getTypeEntryKeyFromCommandStack(stack);
if (typeEntry != null) {
notifiyCommit(typeEntry);
}
}

if (event.getDetail() == CommandStack.POST_FLUSH && event.getSource() instanceof final CommandStack stack) {
final TypeEntry typeEntry = getTypeEntryKeyFromCommandStack(stack);
if (typeEntry != null) {
listeners.forEach(l -> l.flush(typeEntry));
}
}

}

private static TypeEntry getTypeEntryKeyFromCommandStack(final CommandStack stack) {
Expand Down

0 comments on commit 52ac4ad

Please sign in to comment.