mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Refactoring for better FUS: anonymous action UsageViewImpl$10 -> UsageViewImpl.ShowSettings
GitOrigin-RevId: fd4d4ddb3752a29d1c47c4a3553517e513ddc399
This commit is contained in:
committed by
intellij-monorepo-bot
parent
e41dfc50b4
commit
c4b367a0dc
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user