void (final Runnable runnable) { new AnAction() { @Override public void update(@NotNull AnActionEvent e) { e.getPresentation().setEnabled(!myMonths.isPopupVisible() && !myDays.isPopupVisible()); } @Override public @NotNull ActionUpdateThread getActionUpdateThread() { return ActionUpdateThread.EDT; } @Override public void actionPerformed(@NotNull AnActionEvent e) { runnable.run(); } }.registerCustomShortcutSet(KeyEvent.VK_ENTER, 0, this); }