From fb8597a7f42fc72c52bd83274ca402b5167207d0 Mon Sep 17 00:00:00 2001 From: Aleksey Pivovarov Date: Wed, 6 Jul 2016 17:18:49 +0300 Subject: [PATCH] IDEA-144699 go to action: repaint after performing toggle action performAction is asynchronous after 458ebe7 --- .../com/intellij/ide/actions/GotoActionAction.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/ide/actions/GotoActionAction.java b/platform/lang-impl/src/com/intellij/ide/actions/GotoActionAction.java index 5dc1116760ec..668fdb34c929 100644 --- a/platform/lang-impl/src/com/intellij/ide/actions/GotoActionAction.java +++ b/platform/lang-impl/src/com/intellij/ide/actions/GotoActionAction.java @@ -243,8 +243,7 @@ public class GotoActionAction extends GotoActionBase implements DumbAware { else if (value instanceof GotoActionModel.ActionWrapper) { AnAction action = ((GotoActionModel.ActionWrapper)value).getAction(); if (action instanceof ToggleAction) { - performAction(action, component, e); - repaint(popup); + performAction(action, component, e, () -> repaint(popup)); return true; } } @@ -273,6 +272,13 @@ public class GotoActionAction extends GotoActionBase implements DumbAware { } public static void performAction(Object element, @Nullable final Component component, @Nullable final AnActionEvent e) { + performAction(element, component, e, null); + } + + public static void performAction(Object element, + @Nullable final Component component, + @Nullable final AnActionEvent e, + @Nullable final Runnable callback) { // element could be AnAction (SearchEverywhere) if (component == null) return; final AnAction action = element instanceof AnAction ? (AnAction)element : ((GotoActionModel.ActionWrapper)element).getAction(); @@ -285,7 +291,7 @@ public class GotoActionAction extends GotoActionBase implements DumbAware { if (ActionUtil.lastUpdateAndCheckDumb(action, event, false)) { if (action instanceof ActionGroup && ((ActionGroup)action).getChildren(event).length > 0) { ListPopup popup = JBPopupFactory.getInstance().createActionGroupPopup( - event.getPresentation().getText(), (ActionGroup)action, context, JBPopupFactory.ActionSelectionAid.SPEEDSEARCH, false); + event.getPresentation().getText(), (ActionGroup)action, context, JBPopupFactory.ActionSelectionAid.SPEEDSEARCH, false, callback, -1); Window window = SwingUtilities.getWindowAncestor(component); if (window != null) { popup.showInCenterOf(window); @@ -296,6 +302,7 @@ public class GotoActionAction extends GotoActionBase implements DumbAware { } else { ActionUtil.performActionDumbAware(action, event); + if (callback != null) callback.run(); } } });