Java Code Examples for com.intellij.openapi.ui.popup.JBPopup#showUnderneathOf()

The following examples show how to use com.intellij.openapi.ui.popup.JBPopup#showUnderneathOf() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ComboBoxButtonImpl.java    From consulo with Apache License 2.0 6 votes vote down vote up
private void showPopup0() {
  hidePopup0();

  if (myOnClickListener != null) {
    myOnClickListener.run();

    myCurrentPopupCanceler = null;
    return;
  }

  JBPopup popup = createPopup(() -> {
    myCurrentPopupCanceler = null;

    updateSize();
  });
  popup.showUnderneathOf(this);

  myCurrentPopupCanceler = popup::cancel;
}
 
Example 2
Source File: SearchUtil.java    From consulo with Apache License 2.0 6 votes vote down vote up
public static void showHintPopup(final ConfigurableSearchTextField searchField,
                                 final JBPopup[] activePopup,
                                 final Alarm showHintAlarm,
                                 final Consumer<String> selectConfigurable,
                                 final Project project) {
  for (JBPopup aPopup : activePopup) {
    if (aPopup != null) {
      aPopup.cancel();
    }
  }

  final JBPopup popup = createPopup(searchField, activePopup, showHintAlarm, selectConfigurable, project, 0); //no selection
  if (popup != null) {
    popup.showUnderneathOf(searchField);
    searchField.requestFocusInWindow();
  }

  activePopup[0] = popup;
  activePopup[1] = null;
}
 
Example 3
Source File: ToolbarComboBoxAction.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public void showPopup() {
  JBPopup popup = createPopup(setForcePressed());
  if (Registry.is("ide.helptooltip.enabled")) {
    HelpTooltip.setMasterPopup(this, popup);
  }

  popup.showUnderneathOf(this);
}
 
Example 4
Source File: ToolbarComboBoxAction.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public void showPopup() {
  JBPopup popup = createPopup(setForcePressed());
  if (Registry.is("ide.helptooltip.enabled")) {
    HelpTooltip.setMasterPopup(this, popup);
  }

  popup.showUnderneathOf(this);
}
 
Example 5
Source File: MultipleValueFilterPopupComponent.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void actionPerformed(@Nonnull AnActionEvent e) {
  Project project = e.getProject();
  if (project == null) {
    return;
  }

  Filter filter = myFilterModel.getFilter();
  List<String> values = filter == null
                        ? Collections.emptyList()
                        : myFilterModel.getFilterValues(filter);
  final MultilinePopupBuilder popupBuilder = new MultilinePopupBuilder(project, myVariants,
                                                                       getPopupText(values),
                                                                       supportsNegativeValues());
  JBPopup popup = popupBuilder.createPopup();
  popup.addListener(new JBPopupAdapter() {
    @Override
    public void onClosed(LightweightWindowEvent event) {
      if (event.isOk()) {
        List<String> selectedValues = popupBuilder.getSelectedValues();
        if (selectedValues.isEmpty()) {
          myFilterModel.setFilter(null);
        }
        else {
          myFilterModel.setFilter(myFilterModel.createFilter(selectedValues));
          rememberValuesInSettings(selectedValues);
        }
      }
    }
  });
  popup.showUnderneathOf(MultipleValueFilterPopupComponent.this);
}
 
Example 6
Source File: InspectionResultsView.java    From consulo with Apache License 2.0 5 votes vote down vote up
public static void showPopup(AnActionEvent e, JBPopup popup) {
  final InputEvent event = e.getInputEvent();
  if (event instanceof MouseEvent) {
    popup.showUnderneathOf(event.getComponent());
  }
  else {
    popup.showInBestPositionFor(e.getDataContext());
  }
}
 
Example 7
Source File: Utils.java    From consulo with Apache License 2.0 5 votes vote down vote up
public static void showCompletionPopup(JComponent toolbarComponent,
                                       final JList list,
                                       String title,
                                       final JTextComponent textField,
                                       String ad) {

  final Runnable callback = new Runnable() {
    @Override
    public void run() {
      String selectedValue = (String)list.getSelectedValue();
      if (selectedValue != null) {
        textField.setText(selectedValue);
      }
    }
  };

  final PopupChooserBuilder builder = JBPopupFactory.getInstance().createListPopupBuilder(list);
  if (title != null) {
    builder.setTitle(title);
  }
  final JBPopup popup = builder.setMovable(false).setResizable(false)
          .setRequestFocus(true).setItemChoosenCallback(callback).createPopup();

  if (ad != null) {
    popup.setAdText(ad, SwingConstants.LEFT);
  }

  if (toolbarComponent != null) {
    popup.showUnderneathOf(toolbarComponent);
  }
  else {
    popup.showUnderneathOf(textField);
  }
}