diff --git a/platform/usageView/src/com/intellij/usages/impl/UsageViewImpl.java b/platform/usageView/src/com/intellij/usages/impl/UsageViewImpl.java index 88630fbf7ce0..4579c5842841 100644 --- a/platform/usageView/src/com/intellij/usages/impl/UsageViewImpl.java +++ b/platform/usageView/src/com/intellij/usages/impl/UsageViewImpl.java @@ -857,7 +857,7 @@ public class UsageViewImpl implements UsageViewEx { new Separator(), isPreviewUsageActionEnabled() ? new PreviewUsageAction(this) : null, new Separator(), - canShowSettings() ? showSettings() : null, + canShowSettings() ? new ShowSettings() : null, }; } @@ -867,43 +867,6 @@ public class UsageViewImpl implements UsageViewEx { return target instanceof ConfigurableUsageTarget; } - @NotNull - private AnAction showSettings() { - final ConfigurableUsageTarget configurableUsageTarget = getConfigurableTarget(myTargets); - String description = null; - try { - description = configurableUsageTarget == null ? null : "Show settings for "+configurableUsageTarget.getLongDescriptiveName(); - } - catch (IndexNotReadyException ignored) { - } - if (description == null) { - description = "Show find usages settings dialog"; - } - return new AnAction("Settings...", description, AllIcons.General.GearPlain) { - { - KeyboardShortcut shortcut = configurableUsageTarget == null ? getShowUsagesWithSettingsShortcut() : configurableUsageTarget.getShortcut(); - if (shortcut != null) { - registerCustomShortcutSet(new CustomShortcutSet(shortcut), getComponent()); - } - } - - @Override - public boolean startInTransaction() { - return true; - } - - @Override - public void update(@NotNull AnActionEvent e) { - e.getPresentation().setEnabled(e.getData(CommonDataKeys.EDITOR) == null); - } - - @Override - public void actionPerformed(@NotNull AnActionEvent e) { - FindManager.getInstance(getProject()).showSettingsAndFindUsages(myTargets); - } - }; - } - private static ConfigurableUsageTarget getConfigurableTarget(@NotNull UsageTarget[] targets) { ConfigurableUsageTarget configurableUsageTarget = null; if (targets.length != 0) { @@ -1099,6 +1062,43 @@ public class UsageViewImpl implements UsageViewEx { } } + private class ShowSettings extends AnAction { + private ShowSettings() { + super("Settings...", null, AllIcons.General.GearPlain); + final ConfigurableUsageTarget configurableUsageTarget = getConfigurableTarget(myTargets); + String description = null; + try { + description = configurableUsageTarget == null ? null : "Show settings for " + configurableUsageTarget.getLongDescriptiveName(); + } + catch (IndexNotReadyException ignored) { + } + if (description == null) { + description = "Show find usages settings dialog"; + } + getTemplatePresentation().setDescription(description); + KeyboardShortcut shortcut = + configurableUsageTarget == null ? getShowUsagesWithSettingsShortcut() : configurableUsageTarget.getShortcut(); + if (shortcut != null) { + registerCustomShortcutSet(new CustomShortcutSet(shortcut), getComponent()); + } + } + + @Override + public boolean startInTransaction() { + return true; + } + + @Override + public void update(@NotNull AnActionEvent e) { + e.getPresentation().setEnabled(e.getData(CommonDataKeys.EDITOR) == null); + } + + @Override + public void actionPerformed(@NotNull AnActionEvent e) { + FindManager.getInstance(getProject()).showSettingsAndFindUsages(myTargets); + } + } + public void refreshUsages() { reset(); doReRun();