String (@NotNull AnAction action) { List<String> groups = Arrays.stream(MenuSelectionManager.defaultManager().getSelectedPath()) .filter(o -> o instanceof ActionMenu) .map(o -> ((ActionMenu)o).getAnAction().getTemplateText()) .collect(Collectors.toList()); if (groups.size() > 0) { String text = getActionText(action); groups.add(text); return convertMenuItemsToKey(groups); } return null; }