@Override
  public boolean maySaveDocument(@NotNull Document document, boolean isSaveExplicit) {
    if (ApplicationManager.getApplication().isDisposed() || isSaveExplicit) {
      return true;
    }

    for (Project project : ProjectManager.getInstance().getOpenProjects()) {
      if (!project.isInitialized() || project.isDisposed()) {
        continue;
      }
      LookupEx lookup = LookupManager.getInstance(project).getActiveLookup();
      if (lookup != null) {
        if (lookup.getTopLevelEditor().getDocument() == document) {
          return false;
        }
      }
    }
    return true;
  }
@Override
  public boolean maySaveDocument(@NotNull Document document, boolean isSaveExplicit)