List of usage examples for com.intellij.openapi.ui.popup ListPopup setMinimumSize
void setMinimumSize(@Nullable Dimension size);
From source file:com.intellij.android.designer.actions.AbstractComboBoxAction.java
License:Apache License
@Override protected FlatComboButton createComboBoxButton(Presentation presentation) { if (myShowDisabledActions) { return new FlatComboButton(presentation) { @Override/* w ww. j ava 2 s.com*/ protected JBPopup createPopup(Runnable onDispose) { ListPopup popup = JBPopupFactory.getInstance().createActionGroupPopup(null, createPopupActionGroup(this), getDataContext(), JBPopupFactory.ActionSelectionAid.SPEEDSEARCH, true, onDispose, getMaxRows()); popup.setMinimumSize(new Dimension(getMinWidth(), getMinHeight())); return popup; } }; } return super.createComboBoxButton(presentation); }
From source file:com.vladsch.MissingInActions.util.ui.ComboBoxAction.java
License:Apache License
@Override public void actionPerformed(AnActionEvent e) { 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); if (rootPane != null) { button = (ComboBoxButton) UIUtil.uiTraverser(rootPane).bfsTraversal() .filter(component -> component instanceof ComboBoxButton && ((ComboBoxButton) component).getMyAction() == this) .first();/*from w w w. ja v a 2 s. c o m*/ } if (button == null) return; } //if (!button.isShowing()) return; if (button instanceof ComboBoxButton && button.isShowing()) { final Editor editor = e.getData(PlatformDataKeys.EDITOR); ((ComboBoxButton) button).myPresentation.putClientProperty(COMBO_BOX_EDITOR_PROPERTY, editor); ((ComboBoxButton) button).showPopup(); } else { DataContext context = e.getDataContext(); Project project = e.getProject(); if (project == null) return; final Editor editor = e.getData(PlatformDataKeys.EDITOR); DefaultActionGroup group = createPopupActionGroup(button, editor); ListPopup popup = JBPopupFactory.getInstance().createActionGroupPopup(myPopupTitle, group, context, myShowNumbers, shouldShowDisabledActions(), false, null, getMaxRows(), getPreselectCondition()); popup.setMinimumSize(new Dimension(getMinWidth(), getMinHeight())); JComponent finalButton = button; popup.addListSelectionListener(ev -> { actionSelected(finalButton, editor, ev); }); popup.addListener(new JBPopupListener() { @Override public void beforeShown(final LightweightWindowEvent event) { popupStart(finalButton, editor); } @Override public void onClosed(final LightweightWindowEvent event) { popupDone(finalButton, editor); } }); popup.showCenteredInCurrentWindow(project); } }
From source file:org.cordovastudio.editors.designer.actions.AbstractComboBoxAction.java
License:Apache License
@Override protected ComboBoxButton createComboBoxButton(Presentation presentation) { if (myShowDisabledActions) { return new ComboBoxButton(presentation) { @Override//from w w w . java 2 s .com protected JBPopup createPopup(Runnable onDispose) { ListPopup popup = JBPopupFactory.getInstance().createActionGroupPopup(null, createPopupActionGroup(this), getDataContext(), JBPopupFactory.ActionSelectionAid.SPEEDSEARCH, true, onDispose, getMaxRows()); popup.setMinimumSize(new Dimension(getMinWidth(), getMinHeight())); return popup; } }; } return super.createComboBoxButton(presentation); }