public static boolean isCloseRequest(KeyEvent e) {
    if (e != null && e.getID() == KeyEvent.KEY_PRESSED) {
      KeymapManager keymapManager = KeymapManager.getInstance();
      if (keymapManager != null) {
        Shortcut[] shortcuts = keymapManager.getActiveKeymap().getShortcuts(IdeActions.ACTION_EDITOR_ESCAPE);
        for (Shortcut shortcut : shortcuts) {
          if (shortcut instanceof KeyboardShortcut keyboardShortcut) {
            if (keyboardShortcut.getFirstKeyStroke().getKeyCode() == e.getKeyCode() &&
                keyboardShortcut.getSecondKeyStroke() == null) {
              int m1 = keyboardShortcut.getFirstKeyStroke().getModifiers() & (InputEvent.SHIFT_MASK | InputEvent.CTRL_MASK | InputEvent.META_MASK | InputEvent.ALT_MASK);
              int m2 = e.getModifiers();
              return m1 == m2;
            }
          }
        }
      }
      return e.getKeyCode() == KeyEvent.VK_ESCAPE && e.getModifiers() == 0;
    }
    return false;
  }
public static boolean isCloseRequest(KeyEvent e)