mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
assert that document saving and commit happen with write actions allowed
This commit is contained in:
@@ -214,6 +214,11 @@ public abstract class PsiDocumentManagerBase extends PsiDocumentManager implemen
|
||||
@Override
|
||||
public void commitAllDocuments() {
|
||||
ApplicationManager.getApplication().assertIsDispatchThread();
|
||||
if (!((TransactionGuardImpl)TransactionGuard.getInstance()).isWriteActionAllowed()) {
|
||||
// please assign exceptions here to Peter
|
||||
LOG.error("Write access is not allowed in this context, see TransactionGuard documentation for details");
|
||||
}
|
||||
|
||||
if (myUncommittedDocuments.isEmpty()) return;
|
||||
|
||||
final Document[] documents = getUncommittedDocuments();
|
||||
@@ -286,6 +291,11 @@ public abstract class PsiDocumentManagerBase extends PsiDocumentManager implemen
|
||||
|
||||
@Override
|
||||
public void commitDocument(@NotNull final Document doc) {
|
||||
if (!((TransactionGuardImpl)TransactionGuard.getInstance()).isWriteActionAllowed()) {
|
||||
// please assign exceptions here to Peter
|
||||
LOG.error("Write access is not allowed in this context, see TransactionGuard documentation for details");
|
||||
}
|
||||
|
||||
final Document document = doc instanceof DocumentWindow ? ((DocumentWindow)doc).getDelegate() : doc;
|
||||
if (!isCommitted(document)) {
|
||||
doCommit(document);
|
||||
|
||||
+11
@@ -28,6 +28,8 @@ import com.intellij.diff.util.DiffUserDataKeys;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.application.AccessToken;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.TransactionGuard;
|
||||
import com.intellij.openapi.application.TransactionGuardImpl;
|
||||
import com.intellij.openapi.command.CommandProcessor;
|
||||
import com.intellij.openapi.command.UndoConfirmationPolicy;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
@@ -298,6 +300,10 @@ public class FileDocumentManagerImpl extends FileDocumentManager implements Virt
|
||||
*/
|
||||
public void saveAllDocuments(boolean isExplicit) {
|
||||
ApplicationManager.getApplication().assertIsDispatchThread();
|
||||
if (!((TransactionGuardImpl)TransactionGuard.getInstance()).isWriteActionAllowed()) {
|
||||
// please assign exceptions here to Peter
|
||||
LOG.error("Write access is not allowed in this context, see TransactionGuard documentation for details");
|
||||
}
|
||||
|
||||
myMultiCaster.beforeAllDocumentsSaving();
|
||||
if (myUnsavedDocuments.isEmpty()) return;
|
||||
@@ -338,6 +344,11 @@ public class FileDocumentManagerImpl extends FileDocumentManager implements Virt
|
||||
|
||||
public void saveDocument(@NotNull final Document document, final boolean explicit) {
|
||||
ApplicationManager.getApplication().assertIsDispatchThread();
|
||||
if (!((TransactionGuardImpl)TransactionGuard.getInstance()).isWriteActionAllowed()) {
|
||||
// please assign exceptions here to Peter
|
||||
LOG.error("Write access is not allowed in this context, see TransactionGuard documentation for details");
|
||||
}
|
||||
|
||||
if (!myUnsavedDocuments.contains(document)) return;
|
||||
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user