private UndoManager getUndoManager(FileEditor editor, DataContext dataContext, boolean isActionPerformed) {
    Component component = PlatformCoreDataKeys.CONTEXT_COMPONENT.getData(dataContext);
    if (component instanceof JTextComponent && !ClientProperty.isTrue(component, IGNORE_SWING_UNDO_MANAGER)) {
      return SwingUndoManagerWrapper.fromContext(dataContext);
    }
    JRootPane rootPane = null;
    JBPopup popup = null;
    if (editor == null) {
      rootPane = UIUtil.getRootPane(component);
      popup = rootPane != null ? (JBPopup)rootPane.getClientProperty(JBPopup.KEY) : null;
      boolean modalPopup = popup != null && popup.isModalContext();
      boolean modalContext = Boolean.TRUE.equals(PlatformCoreDataKeys.IS_MODAL_CONTEXT.getData(dataContext));
      if (modalPopup || modalContext) {
        return SwingUndoManagerWrapper.fromContext(dataContext);
      }
    }
    if (myActionInProgress && isActionPerformed) {
      LOG.error("Recursive undo invocation attempt, component: " + component + ", fileEditor: " + editor +
                ", rootPane: " + rootPane + ", popup: " + popup);
      return null;
    }

    Project project = getProject(editor, dataContext);
    return project != null && !project.isDefault() ? UndoManager.getInstance(project) : UndoManager.getGlobalInstance();
  }
private UndoManager getUndoManager(FileEditor editor, DataContext dataContext, boolean isActionPerformed)