mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
make AbstractPopups work as ActionPopupMenus from floating toolbars
(cherry picked from commit fe379917ed)
This commit is contained in:
@@ -13,6 +13,10 @@ import com.intellij.openapi.actionSystem.ex.CustomComponentAction;
|
||||
import com.intellij.openapi.application.impl.LaterInvocator;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.keymap.KeymapUtil;
|
||||
import com.intellij.openapi.ui.popup.JBPopup;
|
||||
import com.intellij.openapi.ui.popup.JBPopupAdapter;
|
||||
import com.intellij.openapi.ui.popup.LightweightWindowEvent;
|
||||
import com.intellij.openapi.ui.popup.StackingPopupDispatcher;
|
||||
import com.intellij.openapi.util.IconLoader;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
@@ -137,7 +141,18 @@ public class ActionButton extends JComponent implements ActionButtonComponent, A
|
||||
if (component != null && !component.isShowing()) {
|
||||
return;
|
||||
}
|
||||
JBPopup prevLast = StackingPopupDispatcher.getInstance().getPopupStream().reduce((a, b) -> b).orElse(null);
|
||||
actionPerformed(event);
|
||||
JBPopup curLast = StackingPopupDispatcher.getInstance().getPopupStream().reduce((a, b) -> b).orElse(null);
|
||||
if (curLast != null && curLast != prevLast) {
|
||||
((ActionManagerImpl)manager).addActionPopup(curLast);
|
||||
curLast.addListener(new JBPopupAdapter() {
|
||||
@Override
|
||||
public void onClosed(LightweightWindowEvent event) {
|
||||
((ActionManagerImpl)manager).removeActionPopup(curLast);
|
||||
}
|
||||
});
|
||||
}
|
||||
manager.queueActionPerformedEvent(myAction, dataContext, event);
|
||||
if (event.getInputEvent() instanceof MouseEvent) {
|
||||
ToolbarClicksCollector.record(myAction, myPlace);
|
||||
|
||||
Reference in New Issue
Block a user