com.intellij.openapi.actionSystem.ActionPopupMenu Java Examples
The following examples show how to use
com.intellij.openapi.actionSystem.ActionPopupMenu.
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: SlingServerTreeManager.java From aem-ide-tooling-4-intellij with Apache License 2.0 | 6 votes |
private void popupInvoked(final Component comp, final int x, final int y) { Object userObject = null; final TreePath path = tree.getSelectionPath(); if(path != null) { final DefaultMutableTreeNode node = (DefaultMutableTreeNode) path.getLastPathComponent(); if(node != null) { userObject = node.getUserObject(); } } ActionManager actionManager = ActionManager.getInstance(); DefaultActionGroup group = new DefaultActionGroup(); if( userObject instanceof SlingServerNodeDescriptor || userObject instanceof SlingServerModuleNodeDescriptor ) { group.add(actionManager.getAction("AEM.Connection.Popup")); } else { group.add(actionManager.getAction("AEM.Root.Popup")); } final ActionPopupMenu popupMenu = ActionManager.getInstance().createActionPopupMenu(ActionPlaces.ANT_EXPLORER_POPUP, group); popupMenu.getComponent().show(comp, x, y); }
Example #2
Source File: PopupHandler.java From consulo with Apache License 2.0 | 6 votes |
@Nonnull public static MouseListener installPopupHandler(@Nonnull JComponent component, @Nonnull ActionGroup group, @NonNls String place, @Nonnull ActionManager actionManager, @Nullable PopupMenuListener menuListener) { if (ApplicationManager.getApplication() == null) return new MouseAdapter() { }; PopupHandler popupHandler = new PopupHandler() { @Override public void invokePopup(Component comp, int x, int y) { ActionPopupMenu popupMenu = actionManager.createActionPopupMenu(place, group); popupMenu.setTargetComponent(component); JPopupMenu menu = popupMenu.getComponent(); if (menuListener != null) menu.addPopupMenuListener(menuListener); menu.show(comp, x, y); } }; component.addMouseListener(popupHandler); return popupHandler; }
Example #3
Source File: ContextMenuPopupHandler.java From consulo with Apache License 2.0 | 6 votes |
@Override public boolean handlePopup(@Nonnull EditorMouseEvent event) { ActionGroup group = getActionGroup(event); if (group != null) { ActionPopupMenu popupMenu = ActionManager.getInstance().createActionPopupMenu(ActionPlaces.EDITOR_POPUP, group); MouseEvent e = event.getMouseEvent(); final Component c = e.getComponent(); if (c != null && c.isShowing()) { JPopupMenu popupComponent = popupMenu.getComponent(); EditorMouseHoverPopupControl.disablePopupsWhileShowing(event.getEditor(), popupComponent); popupComponent.show(c, e.getX(), e.getY()); event.consume(); } } return true; }
Example #4
Source File: RunAndroidDevicesAction.java From react-native-console with BSD 3-Clause "New" or "Revised" License | 5 votes |
private void showDevicesPopup(Component component, int x, int y, DefaultActionGroup defaultActionGroup) { ActionPopupMenu popupMenu = ((ActionManagerImpl) ActionManager.getInstance()) .createActionPopupMenu(ToolWindowContentUi.POPUP_PLACE, defaultActionGroup, new MenuItemPresentationFactory(false));// don't set forceHide to true, otherwise icons will be hidden in menu item popupMenu.getComponent().show(component, x, y); }
Example #5
Source File: RunIOSDevicesAction.java From react-native-console with BSD 3-Clause "New" or "Revised" License | 5 votes |
private void showDevicesPopup(Component component, int x, int y, DefaultActionGroup defaultActionGroup) { ActionPopupMenu popupMenu = ((ActionManagerImpl) ActionManager.getInstance()) .createActionPopupMenu(ToolWindowContentUi.POPUP_PLACE, defaultActionGroup, new MenuItemPresentationFactory(false));// don't set forceHide to true, otherwise icons will be hidden in menu item popupMenu.getComponent().show(component, x, y); }
Example #6
Source File: CsvTableEditorMouseListener.java From intellij-csv-validator with Apache License 2.0 | 5 votes |
protected JPopupMenu getRowPopupMenu() { if (rowPopupMenu == null) { ActionManager actionManager = ActionManager.getInstance(); ActionGroup rowContextMenu = (ActionGroup) actionManager.getAction(ROW_CONTEXT_MENU_ID); ActionPopupMenu popupMenu = actionManager.createActionPopupMenu(ROW_CONTEXT_MENU_ID, rowContextMenu); // popupMenu.setTargetComponent(csvTableEditor.getComponent()); rowPopupMenu = popupMenu.getComponent(); } return rowPopupMenu; }
Example #7
Source File: CsvTableEditorMouseListener.java From intellij-csv-validator with Apache License 2.0 | 5 votes |
protected JPopupMenu getColumnPopupMenu() { if (columnPopupMenu == null) { ActionManager actionManager = ActionManager.getInstance(); ActionGroup columnContextMenu = (ActionGroup) actionManager.getAction(COLUMN_CONTEXT_MENU_ID); ActionPopupMenu popupMenu = actionManager.createActionPopupMenu(COLUMN_CONTEXT_MENU_ID, columnContextMenu); // popupMenu.setTargetComponent(csvTableEditor.getComponent()); columnPopupMenu = popupMenu.getComponent(); } return columnPopupMenu; }
Example #8
Source File: PopupHandler.java From consulo with Apache License 2.0 | 5 votes |
public static MouseListener installFollowingSelectionTreePopup(final JTree tree, @Nonnull final ActionGroup group, final String place, final ActionManager actionManager){ if (ApplicationManager.getApplication() == null) return new MouseAdapter(){}; PopupHandler handler = new PopupHandler() { public void invokePopup(Component comp, int x, int y) { if (tree.getPathForLocation(x, y) != null && Arrays.binarySearch(tree.getSelectionRows(), tree.getRowForLocation(x, y)) > -1) { //do not show popup menu on rows other than selection final ActionPopupMenu popupMenu = actionManager.createActionPopupMenu(place, group); popupMenu.getComponent().show(comp, x, y); } } }; tree.addMouseListener(handler); return handler; }
Example #9
Source File: EditorActionUtil.java From consulo with Apache License 2.0 | 5 votes |
private static void showEditorPopup(final EditorMouseEvent event, @Nonnull final ActionGroup group) { if (!event.isConsumed() && event.getArea() == EditorMouseEventArea.EDITING_AREA) { ActionPopupMenu popupMenu = ActionManager.getInstance().createActionPopupMenu(ActionPlaces.EDITOR_POPUP, group); MouseEvent e = event.getMouseEvent(); final Component c = e.getComponent(); if (c != null && c.isShowing()) { popupMenu.getComponent().show(c, e.getX(), e.getY()); } e.consume(); } }
Example #10
Source File: ActionPopupMenuListener.java From consulo with Apache License 2.0 | 4 votes |
default void actionPopupMenuCreated(@Nonnull ActionPopupMenu menu) { }
Example #11
Source File: ActionPopupMenuListener.java From consulo with Apache License 2.0 | 4 votes |
default void actionPopupMenuReleased(@Nonnull ActionPopupMenu menu) { }
Example #12
Source File: SimpleTree.java From consulo with Apache License 2.0 | 4 votes |
protected void invokeContextMenu(final MouseEvent e) { SwingUtilities.invokeLater(() -> { final ActionPopupMenu menu = ActionManager.getInstance().createActionPopupMenu(myPlace, myPopupGroup); menu.getComponent().show(e.getComponent(), e.getPoint().x, e.getPoint().y); }); }
Example #13
Source File: TodoCheckinHandler.java From consulo with Apache License 2.0 | 4 votes |
@Override public RefreshableOnComponent getBeforeCheckinConfigurationPanel() { JCheckBox checkBox = new JCheckBox(VcsBundle.message("before.checkin.new.todo.check", "")); return new RefreshableOnComponent() { @Override public JComponent getComponent() { JPanel panel = new JPanel(new BorderLayout(4, 0)); panel.add(checkBox, BorderLayout.WEST); setFilterText(myConfiguration.myTodoPanelSettings.todoFilterName); if (myConfiguration.myTodoPanelSettings.todoFilterName != null) { myTodoFilter = TodoConfiguration.getInstance().getTodoFilter(myConfiguration.myTodoPanelSettings.todoFilterName); } Consumer<TodoFilter> consumer = todoFilter -> { myTodoFilter = todoFilter; String name = todoFilter == null ? null : todoFilter.getName(); myConfiguration.myTodoPanelSettings.todoFilterName = name; setFilterText(name); }; LinkLabel linkLabel = new LinkLabel("Configure", null); linkLabel.setListener(new LinkListener() { @Override public void linkSelected(LinkLabel aSource, Object aLinkData) { DefaultActionGroup group = SetTodoFilterAction.createPopupActionGroup(myProject, myConfiguration.myTodoPanelSettings, consumer); ActionPopupMenu popupMenu = ActionManager.getInstance().createActionPopupMenu(ActionPlaces.TODO_VIEW_TOOLBAR, group); popupMenu.getComponent().show(linkLabel, 0, linkLabel.getHeight()); } }, null); panel.add(linkLabel, BorderLayout.CENTER); CheckinHandlerUtil.disableWhenDumb(myProject, checkBox, "TODO check is impossible until indices are up-to-date"); return panel; } private void setFilterText(String filterName) { if (filterName == null) { checkBox.setText(VcsBundle.message("before.checkin.new.todo.check", IdeBundle.message("action.todo.show.all"))); } else { checkBox.setText(VcsBundle.message("before.checkin.new.todo.check", "Filter: " + filterName)); } } @Override public void refresh() { } @Override public void saveState() { myConfiguration.CHECK_NEW_TODO = checkBox.isSelected(); } @Override public void restoreState() { checkBox.setSelected(myConfiguration.CHECK_NEW_TODO); } }; }
Example #14
Source File: DesktopStripeButton.java From consulo with Apache License 2.0 | 4 votes |
private void showPopup(final Component component, final int x, final int y) { final ActionGroup group = myDecorator.createPopupGroup(); final ActionPopupMenu popupMenu = ActionManager.getInstance().createActionPopupMenu(ActionPlaces.UNKNOWN, group); popupMenu.getComponent().show(component, x, y); }