IDEA-146128 "Select Run/Debug Configuration" do nothing when navigation bar hidden

This commit is contained in:
Vassiliy.Kudryashov
2015-10-19 16:50:33 +03:00
parent 5fe18ae81d
commit 57feca3f95
2 changed files with 28 additions and 2 deletions
@@ -30,6 +30,8 @@ import com.intellij.openapi.project.DumbAwareAction;
import com.intellij.openapi.project.IndexNotReadyException;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Condition;
import com.intellij.openapi.wm.ex.WindowManagerEx;
import com.intellij.openapi.wm.impl.IdeFrameImpl;
import com.intellij.ui.IdeBorderFactory;
import com.intellij.ui.SizedIcon;
import com.intellij.ui.components.panels.NonOpaquePanel;
@@ -50,6 +52,18 @@ public class RunConfigurationsComboBoxAction extends ComboBoxAction implements D
public static final Icon CHECKED_SELECTED_ICON = new SizedIcon(AllIcons.Actions.Checked_selected, 16, 16);
public static final Icon EMPTY_ICON = EmptyIcon.ICON_16;
@Override
public void actionPerformed(AnActionEvent e) {
if (e.getPresentation().getClientProperty(CUSTOM_COMPONENT_PROPERTY) == null) {
Project project = e.getProject();
IdeFrameImpl frame = project != null ? WindowManagerEx.getInstanceEx().getFrame(project) : null;
if (frame != null) {
e.getPresentation().putClientProperty(CUSTOM_COMPONENT_PROPERTY, frame.getComponent());
}
}
super.actionPerformed(e);
}
@Override
public void update(AnActionEvent e) {
Presentation presentation = e.getPresentation();
@@ -22,6 +22,7 @@ import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.keymap.KeymapUtil;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.popup.JBPopup;
import com.intellij.openapi.ui.popup.JBPopupFactory;
import com.intellij.openapi.ui.popup.ListPopup;
@@ -58,7 +59,7 @@ public abstract class ComboBoxAction extends AnAction implements CustomComponent
@Override
public void actionPerformed(AnActionEvent e) {
ComboBoxButton button = (ComboBoxButton)e.getPresentation().getClientProperty(CUSTOM_COMPONENT_PROPERTY);
JComponent button = (JComponent)e.getPresentation().getClientProperty(CUSTOM_COMPONENT_PROPERTY);
if (button == null) {
Component contextComponent = e.getData(PlatformDataKeys.CONTEXT_COMPONENT);
JRootPane rootPane = UIUtil.getParentOfType(JRootPane.class, contextComponent);
@@ -74,7 +75,18 @@ public abstract class ComboBoxAction extends AnAction implements CustomComponent
if (button == null) return;
}
if (!button.isShowing()) return;
button.showPopup();
if (button instanceof ComboBoxButton) {
((ComboBoxButton)button).showPopup();
} else {
DataContext context = e.getDataContext();
Project project = e.getProject();
if (project == null) return;
DefaultActionGroup group = createPopupActionGroup(button);
ListPopup popup = JBPopupFactory.getInstance().createActionGroupPopup(
myPopupTitle, group, context, false, shouldShowDisabledActions(), false, null, getMaxRows(), getPreselectCondition());
popup.setMinimumSize(new Dimension(getMinWidth(), getMinHeight()));
popup.showCenteredInCurrentWindow(project);
}
}
@Override