Skip to content

Commit d9e8196

Browse files
committed
FIX: Detected bulk mode status update from DocumentBulkUpdateListener #384
1 parent cd41db5 commit d9e8196

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

src/main/java/net/seesharpsoft/intellij/plugins/csv/psi/CsvPsiTreeUpdater.java

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -340,34 +340,34 @@ private void doAddField(@NotNull PsiElement anchor, @Nullable String text, boole
340340
public synchronized void commit() {
341341
if (isSuspended() || myUncommittedActions == null || myUncommittedActions.size() == 0) return;
342342

343-
suspend();
344343
List<PsiAction> actionsToCommit = new ArrayList<>(myUncommittedActions);
345344
myUncommittedActions.clear();
346-
if (!doCommit(() -> {
347-
try {
348-
actionsToCommit.forEach(PsiAction::execute);
349-
} finally {
350-
resume();
351-
fireCommitted();
352-
}
353-
})) {
354-
resume();
355-
}
345+
346+
doCommit(() -> actionsToCommit.forEach(PsiAction::execute));
356347
}
357348

358349
private boolean doCommit(@NotNull Runnable runnable) {
359350
PsiFile psiFile = getPsiFile();
360351
Document document = getDocument();
361352

362-
if (psiFile == null || !psiFile.isWritable() || document == null || !document.isWritable()) return false;
353+
if (psiFile == null || !psiFile.isWritable() || document == null || !document.isWritable())
354+
{
355+
return false;
356+
}
363357

358+
suspend();
364359
ApplicationManager.getApplication().runWriteAction(() -> {
365-
CommandProcessor.getInstance().executeCommand(
366-
getPsiFile().getProject(),
367-
() -> DocumentUtil.executeInBulk(document, runnable),
368-
"CSV Editor changes",
369-
null,
370-
document);
360+
try {
361+
CommandProcessor.getInstance().executeCommand(
362+
getPsiFile().getProject(),
363+
() -> DocumentUtil.executeInBulk(document, runnable),
364+
"CSV Editor changes",
365+
null,
366+
document);
367+
} finally {
368+
resume();
369+
fireCommitted();
370+
}
371371
});
372372

373373
return true;

0 commit comments

Comments
 (0)