TerminalAction (@NotNull JBTerminalWidget widget, @NonNls @NotNull AnAction action) { Collection<KeyStroke> strokes = KeymapUtil.getKeyStrokes(action.getShortcutSet()); String name = StringUtil.notNullize(action.getTemplateText(), "unknown"); return new TerminalAction(new TerminalActionPresentation(name, List.copyOf(strokes)), (keyEvent) -> { DataContext dataContext = DataManager.getInstance().getDataContext(widget.getTerminalPanel()); ActionUtil.performActionDumbAwareWithCallbacks(action, AnActionEvent.createFromInputEvent(keyEvent, "Terminal", null, dataContext)); return true; }); }