Java Code Examples for com.intellij.openapi.ui.JBPopupMenu#add()

The following examples show how to use com.intellij.openapi.ui.JBPopupMenu#add() . 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: TabFormImpl.java    From azure-devops-intellij with MIT License 5 votes vote down vote up
/**
 * Display popup menu on the view
 *
 * @param component
 * @param x
 * @param y
 * @param listener
 */
protected void showPopupMenu(final Component component, final int x, final int y, final ActionListener listener) {
    final JBPopupMenu menu = new JBPopupMenu();
    final List<JBMenuItem> openMenuItems = getMenuItems(listener);
    for (JBMenuItem menuItem : openMenuItems) {
        menu.add(menuItem);
    }
    menu.show(component, x, y);
}
 
Example 2
Source File: FollowButton.java    From saros with GNU General Public License v2.0 5 votes vote down vote up
private void createMenu() {
  popupMenu = new JBPopupMenu();

  popupMenu.setForeground(FOREGROUND_COLOR);
  popupMenu.setBackground(BACKGROUND_COLOR);

  menuItemPrefix = Messages.FollowButton_user_entry_prefix;

  ISarosSession currentSession = session;
  FollowModeManager currentFollowModeManager = followModeManager;

  if (currentSession == null || currentFollowModeManager == null) {
    return;
  }

  for (User user : currentSession.getRemoteUsers()) {
    JMenuItem menuItem = createItemForUser(user);
    popupMenu.add(menuItem);
  }

  popupMenu.addSeparator();

  JMenuItem leaveItem = new JBMenuItem(Messages.FollowButton_leave_follow_mode_entry);

  leaveItem.setForeground(FOREGROUND_COLOR);
  leaveItem.setBackground(BACKGROUND_COLOR);

  leaveItem.addActionListener(e -> followModeAction.execute(session, followModeManager, null));
  leaveItem.setEnabled(currentFollowModeManager.getFollowedUser() != null);

  popupMenu.add(leaveItem);
}
 
Example 3
Source File: FilterDialog.java    From consulo with Apache License 2.0 5 votes vote down vote up
private void makePopup() {
  myPopup = new JBPopupMenu();
  String[] macrosName = RegexpFilter.getMacrosName();
  JMenuItem[] items = new JMenuItem[macrosName.length];
  for (int i = 0; i < macrosName.length; i++) {
    items[i] = myPopup.add(macrosName[i]);
    items[i].addActionListener(new MenuItemListener(macrosName[i]));
  }
  myRegexpField.addMouseListener(new PopupListener());
}