void () { final DefaultActionGroup pagerGroup = new DefaultActionGroup(); pagerGroup.add(new ItemAction("PreviousOccurence", this) { @Override public void update(@NotNull AnActionEvent e) { final Presentation presentation = e.getPresentation(); presentation.setEnabled(myModel.getSelectedIndex() < myModel.getSize() - 1); presentation.setText(XPathBundle.message("action.previous.history.entry.text")); presentation.setDescription(XPathBundle.message("action.navigate.to.previous.history.entry.description")); } @Override public void actionPerformed(@NotNull AnActionEvent e) { myModel.setSelectedIndex(myModel.getSelectedIndex() + 1); refocus(); } }); pagerGroup.add(new ItemAction("NextOccurence", this) { @Override public void update(@NotNull AnActionEvent e) { final Presentation presentation = e.getPresentation(); presentation.setEnabled(myModel.getSelectedIndex() > 0); presentation.setText(XPathBundle.message("action.next.history.entry.text")); presentation.setDescription(XPathBundle.message("action.navigate.to.next.history.entry.description")); } @Override public void actionPerformed(@NotNull AnActionEvent e) { myModel.setSelectedIndex(myModel.getSelectedIndex() - 1); refocus(); } }); final ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar("HistoryPager", pagerGroup, false); add(toolbar.getComponent(), BorderLayout.EAST); }