Ejemplo n.º 1
0
 @Override
 public boolean shouldBeShowing(Object value) {
   if (!myStep.isSpeedSearchEnabled()) return true;
   SpeedSearchFilter<Object> filter = myStep.getSpeedSearchFilter();
   if (!filter.canBeHidden(value)) return true;
   String text = filter.getIndexedString(value);
   return mySpeedSearch.shouldBeShowing(text);
 }
Ejemplo n.º 2
0
  public WizardPopup(@Nullable JBPopup aParent, @NotNull PopupStep<Object> aStep) {
    myParent = (WizardPopup) aParent;
    myStep = aStep;

    mySpeedSearch.setEnabled(myStep.isSpeedSearchEnabled());

    final JComponent content = createContent();

    JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(content);
    scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
    scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    scrollPane.getHorizontalScrollBar().setBorder(null);

    scrollPane.getActionMap().get("unitScrollLeft").setEnabled(false);
    scrollPane.getActionMap().get("unitScrollRight").setEnabled(false);

    scrollPane.setBorder(null);

    final Project project =
        CommonDataKeys.PROJECT.getData(DataManager.getInstance().getDataContext());
    init(
        project,
        scrollPane,
        getPreferredFocusableComponent(),
        true,
        true,
        true,
        null,
        false,
        aStep.getTitle(),
        null,
        true,
        null,
        false,
        null,
        null,
        null,
        false,
        null,
        true,
        false,
        true,
        null,
        0f,
        null,
        true,
        false,
        new Component[0],
        null,
        SwingConstants.LEFT,
        true,
        Collections.<Pair<ActionListener, KeyStroke>>emptyList(),
        null,
        null,
        false,
        true,
        true,
        true,
        null);

    registerAction(
        "disposeAll",
        KeyEvent.VK_ESCAPE,
        InputEvent.SHIFT_MASK,
        new AbstractAction() {
          @Override
          public void actionPerformed(ActionEvent e) {
            if (mySpeedSearch.isHoldingFilter()) {
              mySpeedSearch.reset();
            } else {
              disposeAll();
            }
          }
        });

    AbstractAction goBackAction =
        new AbstractAction() {
          @Override
          public void actionPerformed(ActionEvent e) {
            goBack();
          }
        };

    registerAction("goBack3", KeyEvent.VK_ESCAPE, 0, goBackAction);

    myMnemonicsSearch =
        new MnemonicsSearch(this) {
          @Override
          protected void select(Object value) {
            onSelectByMnemonic(value);
          }
        };
  }