Java 类com.intellij.openapi.actionSystem.ex.ComboBoxAction 实例源码

项目:intellij-ce-playground    文件:ComboBoxActionFixture.java   
private void click() throws ClassNotFoundException {
  final Class<?> comboBoxButtonClass = getClass().getClassLoader().loadClass(ComboBoxAction.class.getCanonicalName() + "$ComboBoxButton");
  final ActionButtonFixture runButton = projectFrame.findRunApplicationButton();

  Container actionToolbarContainer = execute(new GuiQuery<Container>() {
    @Override
    protected Container executeInEDT() throws Throwable {
      return runButton.target().getParent();
    }
  });
  assertNotNull(actionToolbarContainer);

  JButton comboBoxButton = robot.finder().find(actionToolbarContainer, new GenericTypeMatcher<JButton>(JButton.class) {
    @Override
    protected boolean isMatching(@NotNull JButton component) {
      return comboBoxButtonClass.isInstance(component);
    }
  });

  final JButtonFixture comboBoxButtonFixture = new JButtonFixture(robot, comboBoxButton);
  pause(new Condition("Wait until comboBoxButton is enabled") {
    @Override
    public boolean test() {
      //noinspection ConstantConditions
      return execute(new GuiQuery<Boolean>() {
        @Override
        protected Boolean executeInEDT() throws Throwable {
          return comboBoxButtonFixture.target().isEnabled();
        }
      });
    }
  }, SHORT_TIMEOUT);
  comboBoxButtonFixture.click();
}
项目:consulo    文件:ComboBoxButtonUI.java   
@Override
public Dimension getPreferredSize(JComponent c) {
  ComboBoxButton comboBoxButton = (ComboBoxButton)c;
  ComboBoxAction comboBoxAction = comboBoxButton.getComboBoxAction();

  final boolean isEmpty = comboBoxButton.getIcon() == null && StringUtil.isEmpty(comboBoxButton.getText());
  int width = isEmpty ? JBUI.scale(10) + getArrowIcon().getIconWidth() : super.getPreferredSize(c).width;
  if (comboBoxAction.isSmallVariant()) width += JBUI.scale(4);
  return new Dimension(width, comboBoxAction.isSmallVariant() ? JBUI.scale(19) : super.getPreferredSize(c).height);
}
项目:consulo    文件:ModernComboBoxButtonUI.java   
@Override
public Dimension getPreferredSize(JComponent c) {
  ComboBoxButton comboBoxButton = (ComboBoxButton)c;
  ComboBoxAction comboBoxAction = comboBoxButton.getComboBoxAction();

  final boolean isEmpty = comboBoxButton.getIcon() == null && StringUtil.isEmpty(comboBoxButton.getText());
  int width = isEmpty ? JBUI.scale(18) : super.getPreferredSize(c).width;
  if (comboBoxAction.isSmallVariant()) width += JBUI.scale(4);
  return new Dimension(width, comboBoxAction.isSmallVariant() ? JBUI.scale(21) : super.getPreferredSize(c).height);
}
项目:intellij-ce-playground    文件:NavBarRootPaneExtension.java   
private static boolean isNeedGap(final AnAction group) {
  final AnAction firstAction = getFirstAction(group);
  return firstAction instanceof ComboBoxAction;
}
项目:tools-idea    文件:NavBarRootPaneExtension.java   
private static boolean isNeedGap(final AnAction group) {
  final AnAction firstAction = getFirstAction(group);
  return firstAction instanceof ComboBoxAction;
}
项目:consulo    文件:NavBarRootPaneExtension.java   
private static boolean isNeedGap(final AnAction group) {
  final AnAction firstAction = getFirstAction(group);
  return firstAction instanceof ComboBoxAction;
}