TerminalAction (@NotNull JBTerminalWidget widget, @NotNull TerminalActionPresentation actionPresentation, @NotNull Predicate<? super JBTerminalWidgetListener> action) { return new TerminalAction(actionPresentation, input -> { JBTerminalWidgetListener listener = widget.getListener(); if (listener != null) { return action.test(listener); } return false; }).withEnabledSupplier(() -> widget.getListener() != null); }