private AnAction patch(final AnAction child) { if (child instanceof ActionGroup) { return new IconsFreeActionGroup((ActionGroup) child); } Presentation presentation = child.getTemplatePresentation(); return new AnAction(presentation.getText(), presentation.getDescription(), null) { @Override public void actionPerformed(@NotNull AnActionEvent e) { child.actionPerformed(e); UsageTrigger.trigger("welcome.screen." + e.getActionManager().getId(child)); } @Override public void update(@NotNull AnActionEvent e) { child.update(e); e.getPresentation().setIcon(null); } @Override public boolean isDumbAware() { return child.isDumbAware(); } }; }
private AnAction wrapGroups(AnAction action) { if (action instanceof ActionGroup && ((ActionGroup) action).isPopup()) { final Pair<JPanel, JBList> panel = createActionGroupPanel( (ActionGroup) action, mySlidingPanel, new Runnable() { @Override public void run() { goBack(); } }); final Runnable onDone = new Runnable() { @Override public void run() { final JBList list = panel.second; ScrollingUtil.ensureSelectionExists(list); final ListSelectionListener[] listeners = ((DefaultListSelectionModel) list.getSelectionModel()) .getListeners(ListSelectionListener.class); // avoid component cashing. This helps in case of LaF change for (ListSelectionListener listener : listeners) { listener.valueChanged( new ListSelectionEvent( list, list.getSelectedIndex(), list.getSelectedIndex(), true)); } list.requestFocus(); } }; final String name = action.getClass().getName(); mySlidingPanel.add(name, panel.first); final Presentation p = action.getTemplatePresentation(); return new DumbAwareAction(p.getText(), p.getDescription(), p.getIcon()) { @Override public void actionPerformed(@NotNull AnActionEvent e) { mySlidingPanel .getLayout() .swipe(mySlidingPanel, name, JBCardLayout.SwipeDirection.FORWARD, onDone); } }; } return action; }