public static boolean hasSelectionInTerminal(@Nullable Component component) {
    return component instanceof TerminalPanel terminalPanel && terminalPanel.getSelection() != null;
  }
public static boolean hasSelectionInTerminal(@Nullable Component component)