public void saveDocument(@NotNull Document document, boolean explicit) {
    ThreadingAssertions.assertEventDispatchThread();
    ((TransactionGuardImpl)TransactionGuard.getInstance()).assertWriteActionAllowed();

    myMultiCaster.beforeAnyDocumentSaving(document, explicit);
    if (!myUnsavedDocuments.contains(document)) return;

    try {
      doSaveDocument(document, explicit);
    }
    catch (IOException e) {
      handleErrorsOnSave(Collections.singletonMap(document, e));
    }
    catch (SaveVetoException ignored) {
    }
  }
public void saveDocument(@NotNull Document document, boolean explicit)