void (final MyActionButton removeButton) { new AnAction(IdeBundle.messagePointer("action.Anonymous.text.delete.hook")) { @Override public void actionPerformed(@NotNull AnActionEvent e) { removeButton.actionPerformed(e); } @Override public boolean isDumbAware() { return removeButton.isDumbAware(); } @Override public void update(@NotNull AnActionEvent e) { final JComponent contextComponent = removeButton.getContextComponent(); if (contextComponent instanceof JTable && ((JTable)contextComponent).isEditing()) { e.getPresentation().setEnabled(false); return; } final SpeedSearchSupply supply = SpeedSearchSupply.getSupply(contextComponent); if (supply != null && supply.isPopupActive()) { e.getPresentation().setEnabled(false); return; } removeButton.update(e); } @Override public @NotNull ActionUpdateThread getActionUpdateThread() { return ActionUpdateThread.EDT; } }.registerCustomShortcutSet(CustomShortcutSet.fromString("DELETE", "BACK_SPACE"), removeButton.getContextComponent()); }