void (final @NotNull AnActionEvent e) { final Component focusOwner = IdeFocusManager.getGlobalInstance().getFocusOwner(); if (focusOwner != null) { final Window window = focusOwner instanceof JFrame ? (Window)focusOwner : SwingUtilities.getWindowAncestor(focusOwner); if (window instanceof JFrame frame) { if (frame.getExtendedState() == Frame.NORMAL) { frame.setExtendedState(Frame.MAXIMIZED_BOTH); } else if (frame.getExtendedState() == Frame.MAXIMIZED_BOTH) { frame.setExtendedState(Frame.NORMAL); } } } }