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

The following examples show how to use com.intellij.openapi.ui.popup.ListPopup#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: IntelliSortChooserPopupAction.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public void actionPerformed(AnActionEvent e) {
  VcsLogUi logUI = e.getRequiredData(VcsLogDataKeys.VCS_LOG_UI);
  VcsLogUiProperties properties = e.getRequiredData(VcsLogInternalDataKeys.LOG_UI_PROPERTIES);

  ActionGroup settingsGroup = new DefaultActionGroup(
          ContainerUtil.map(PermanentGraph.SortType.values(), (Function<PermanentGraph.SortType, AnAction>)sortType -> new SelectIntelliSortTypeAction(logUI, properties, sortType)));


  ListPopup popup = JBPopupFactory.getInstance().createActionGroupPopup(null, settingsGroup, e.getDataContext(), JBPopupFactory.ActionSelectionAid.MNEMONICS, true, ToolWindowContentUI.POPUP_PLACE);
  Component component = e.getInputEvent().getComponent();
  if (component instanceof ActionButtonComponent) {
    popup.showUnderneathOf(component);
  }
  else {
    popup.showInCenterOf(component);
  }
}
 
Example 2
Source File: WelcomePopupAction.java    From consulo with Apache License 2.0 6 votes vote down vote up
protected void showPopup(DataContext context, ListPopup popup, JComponent contextComponent) {
  Component focusedComponent = contextComponent != null ? contextComponent : context.getData(PlatformDataKeys.CONTEXT_COMPONENT);
  if (focusedComponent != null) {
    if (popup instanceof PopupFactoryImpl.ActionGroupPopup && focusedComponent instanceof JLabel) {
      ((PopupFactoryImpl.ActionGroupPopup)popup).showUnderneathOfLabel((JLabel)focusedComponent);
    } else {
      popup.showUnderneathOf(focusedComponent);
    }
  }
  else {
    Rectangle r;
    int x;
    int y;
    focusedComponent = WindowManagerEx.getInstanceEx().getFocusedComponent((Project)null);
    r = WindowManagerEx.getInstanceEx().getScreenBounds();
    x = r.x + r.width / 2;
    y = r.y + r.height / 2;
    Point point = new Point(x, y);
    SwingUtilities.convertPointToScreen(point, focusedComponent.getParent());

    popup.showInScreenCoordinates(focusedComponent.getParent(), point);
  }
}
 
Example 3
Source File: ExecuteQueryAction.java    From jetbrains-plugin-graph-database-support with Apache License 2.0 5 votes vote down vote up
protected void actionPerformed(AnActionEvent e, Project project, Editor editor, String query, Map<String, Object> parameters) {
    VirtualFile virtualFile = e.getData(CommonDataKeys.VIRTUAL_FILE);
    MessageBus messageBus = project.getMessageBus();
    DataSourcesComponent dataSourcesComponent = project.getComponent(DataSourcesComponent.class);

    query = decorateQuery(query);

    ExecuteQueryPayload executeQueryPayload = new ExecuteQueryPayload(query, parameters, editor);
    ConsoleToolWindow.ensureOpen(project);

    if (nonNull(virtualFile)) {
        String fileName = virtualFile.getName();
        if (fileName.startsWith(GraphConstants.BOUND_DATA_SOURCE_PREFIX)) {
            Optional<? extends DataSourceApi> boundDataSource = dataSourcesComponent.getDataSourceContainer()
                    .findDataSource(NameUtil.extractDataSourceUUID(fileName));
            if (boundDataSource.isPresent()) {
                executeQuery(messageBus, boundDataSource.get(), executeQueryPayload);
                return;
            }
        }
    }

    ListPopup popup = JBPopupFactory.getInstance().createActionGroupPopup(
            "Choose Data Source",
            new ChooseDataSourceActionGroup(messageBus, dataSourcesComponent, executeQueryPayload),
            e.getDataContext(),
            JBPopupFactory.ActionSelectionAid.SPEEDSEARCH,
            false
    );

    Component eventComponent = e.getInputEvent().getComponent();
    if (eventComponent instanceof ActionButtonComponent) {
        popup.showUnderneathOf(eventComponent);
    } else {
        popup.showInBestPositionFor(e.getDataContext());
    }
}
 
Example 4
Source File: FilterDropDown.java    From azure-devops-intellij with MIT License 5 votes vote down vote up
/**
 * Displays the dropdown menu with the latest items
 */
private void showDropDownMenu() {
    if (isEnabled) {
        final ListPopup popup = JBPopupFactory.getInstance().createActionGroupPopup(null, group, DataManager.getInstance().getDataContext(this), JBPopupFactory.ActionSelectionAid.SPEEDSEARCH, true);
        popup.showUnderneathOf(this);
    }
}
 
Example 5
Source File: ConfigPartStack.java    From p4ic4idea with Apache License 2.0 5 votes vote down vote up
private void showAddItemPopup() {
    final ListPopup popup = createConfigPartPopup(factory -> {
        if (factory != null) {
            addChildFirst(factory.createEmpty(vcsRoot, connectionController));
        }
    });
    popup.showUnderneathOf(myAddItemButton);
}
 
Example 6
Source File: MasterDetailsComponent.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void actionPerformed(AnActionEvent e) {
  final JBPopupFactory popupFactory = JBPopupFactory.getInstance();
  final ListPopupStep step = popupFactory.createActionsStep(myActionGroup, e.getDataContext(), false, false,
                                                            myActionGroup.getTemplatePresentation().getText(), myTree, true,
                                                            myPreselection != null ? myPreselection.getDefaultIndex() : 0, true);
  final ListPopup listPopup = popupFactory.createListPopup(step);
  listPopup.setHandleAutoSelectionBeforeShow(true);
  listPopup.showUnderneathOf(myNorthPanel);
}
 
Example 7
Source File: VcsLogGearActionGroup.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void actionPerformed(@Nonnull AnActionEvent e) {
  DefaultActionGroup group = new DefaultActionGroup(ActionManager.getInstance().getAction(myActionGroup));

  ListPopup popup = JBPopupFactory.getInstance().createActionGroupPopup(null, group, e.getDataContext(), JBPopupFactory.ActionSelectionAid.MNEMONICS, true, ToolWindowContentUI.POPUP_PLACE);
  Component component = e.getInputEvent().getComponent();
  if (component instanceof ActionButtonComponent) {
    popup.showUnderneathOf(component);
  }
  else {
    popup.showInCenterOf(component);
  }
}
 
Example 8
Source File: FindPopupPanel.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void actionPerformed(@Nonnull AnActionEvent e) {
  if (e.getData(PlatformDataKeys.CONTEXT_COMPONENT) == null) return;

  ListPopup listPopup = JBPopupFactory.getInstance().createActionGroupPopup(null, mySwitchContextGroup, e.getDataContext(), false, null, 10);
  listPopup.showUnderneathOf(myFilterContextButton);
}
 
Example 9
Source File: TabContentLayout.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void showContentPopup(ListPopup listPopup) {
  Content selected = myUi.myManager.getSelectedContent();
  if (selected != null) {
    ContentTabLabel tab = myContent2Tabs.get(selected);
    listPopup.showUnderneathOf(tab);
  }
  else {
    listPopup.showUnderneathOf(myIdLabel);
  }
}
 
Example 10
Source File: DataSourceListPanel.java    From intellij-xquery with Apache License 2.0 4 votes vote down vote up
protected void showAddDataSourcePopupWithActionExecutor(XQueryDataSourceTypeBasedActionExecutor
                                                                addDataSourceActionExecutor) {
    DataSourceTypesListPopup dataSourceTypesListPopup = new DataSourceTypesListPopup(addDataSourceActionExecutor);
    final ListPopup popup = JBPopupFactory.getInstance().createListPopup(dataSourceTypesListPopup);
    popup.showUnderneathOf(toolbarDecorator.getActionsPanel());
}
 
Example 11
Source File: VcsLogPopupComponent.java    From consulo with Apache License 2.0 4 votes vote down vote up
private void showPopupMenu() {
  ListPopup popup = createPopupMenu();
  popup.showUnderneathOf(this);
}