Skip to content

Commit

Permalink
avoid blocking lock when switching AsciiDoc editor when trying to sav…
Browse files Browse the repository at this point in the history
…e contents of changed documents (#520)
  • Loading branch information
ahus1 committed Jul 9, 2020
1 parent 0daac52 commit 3bc0a6e
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -421,22 +421,22 @@ public void selectNotify() {
ApplicationManager.getApplication().runWriteAction(() -> {
// project might be already closed (yes, this really happens when you work in multiple projects opened in separate windows)
if (!project.isDisposed()) {
currentContent = null; // force a refresh of the preview by resetting the current memorized content
// save the content in all other editors as their content might be referenced in preview
// don't use ApplicationManager.getApplication().saveAll() as it will save in the background and will save settings as well
for (Document unsavedDocument : FileDocumentManager.getInstance().getUnsavedDocuments()) {
FileDocumentManager.getInstance().saveDocument(unsavedDocument);
}
reprocessAnnotations();
currentContent = null; // force a refresh of the preview by resetting the current memorized content
renderIfVisible();
}
});
} finally {
SAVE_ALL_LOCK.unlock();
}
} else {
currentContent = null; // force a refresh of the preview by resetting the current memorized content
reprocessAnnotations();
currentContent = null; // force a refresh of the preview by resetting the current memorized content
renderIfVisible();
log.warn("unable to acquire lock for save-all-docs");
}
Expand All @@ -446,8 +446,8 @@ public void selectNotify() {
});
} else {
if (!project.isDisposed()) {
currentContent = null; // force a refresh of the preview by resetting the current memorized content
reprocessAnnotations();
currentContent = null; // force a refresh of the preview by resetting the current memorized content
renderIfVisible();
}
}
Expand Down

0 comments on commit 3bc0a6e

Please sign in to comment.