List of usage examples for com.intellij.openapi.actionSystem ActionPlaces COMMANDER_POPUP
String COMMANDER_POPUP
To view the source code for com.intellij.openapi.actionSystem ActionPlaces COMMANDER_POPUP.
Click Source Link
From source file:com.intellij.ide.actions.DeleteAction.java
License:Apache License
public void update(AnActionEvent event) { String place = event.getPlace(); Presentation presentation = event.getPresentation(); if (ActionPlaces.PROJECT_VIEW_POPUP.equals(place) || ActionPlaces.COMMANDER_POPUP.equals(place)) presentation.setText(IdeBundle.message("action.delete.ellipsis")); else//from www .j av a 2s . c o m presentation.setText(IdeBundle.message("action.delete")); DataContext dataContext = event.getDataContext(); Project project = CommonDataKeys.PROJECT.getData(dataContext); if (project == null) { presentation.setEnabled(false); return; } DeleteProvider provider = getDeleteProvider(dataContext); if (event.getInputEvent() instanceof KeyEvent) { KeyEvent keyEvent = (KeyEvent) event.getInputEvent(); Object component = PlatformDataKeys.CONTEXT_COMPONENT.getData(dataContext); if (component instanceof JTextComponent) provider = null; // Do not override text deletion if (keyEvent.getKeyCode() == KeyEvent.VK_BACK_SPACE) { // Do not override text deletion in speed search if (component instanceof JComponent) { SpeedSearchSupply searchSupply = SpeedSearchSupply.getSupply((JComponent) component); if (searchSupply != null) provider = null; } String activeSpeedSearchFilter = SpeedSearchSupply.SPEED_SEARCH_CURRENT_QUERY.getData(dataContext); if (!StringUtil.isEmpty(activeSpeedSearchFilter)) { provider = null; } } } if (provider instanceof TitledHandler) { presentation.setText(((TitledHandler) provider).getActionTitle()); } final boolean canDelete = provider != null && provider.canDeleteElement(dataContext); if (ActionPlaces.isPopupPlace(event.getPlace())) { presentation.setVisible(canDelete); } else { presentation.setEnabled(canDelete); } }
From source file:com.intellij.ide.commander.CommanderPanel.java
License:Apache License
private void invokePopup(final Component c, final int x, final int y) { if (myBuilder == null) return;/*from ww w.ja v a 2 s . com*/ if (myList.getSelectedIndices().length <= 1) { final int popupIndex = myList.locationToIndex(new Point(x, y)); if (popupIndex >= 0) { myList.setSelectedIndex(popupIndex); myList.requestFocus(); } } final ActionGroup group = (ActionGroup) CustomActionsSchema.getInstance() .getCorrectedAction(IdeActions.GROUP_COMMANDER_POPUP); final ActionPopupMenu popupMenu = ActionManager.getInstance() .createActionPopupMenu(ActionPlaces.COMMANDER_POPUP, group); popupMenu.getComponent().show(c, x, y); }
From source file:com.intellij.tools.BaseExternalToolsGroup.java
License:Apache License
private boolean isToolVisible(T tool, String context) { if (!tool.isEnabled()) return false; if (ActionPlaces.EDITOR_POPUP.equals(context) || ActionPlaces.EDITOR_TAB_POPUP.equals(context)) { return tool.isShownInEditor(); } else if (ActionPlaces.PROJECT_VIEW_POPUP.equals(context) || ActionPlaces.COMMANDER_POPUP.equals(context) || ActionPlaces.J2EE_VIEW_POPUP.equals(context) || ActionPlaces.TYPE_HIERARCHY_VIEW_POPUP.equals(context) || ActionPlaces.CALL_HIERARCHY_VIEW_POPUP.equals(context) || ActionPlaces.METHOD_HIERARCHY_VIEW_POPUP.equals(context) || ActionPlaces.FAVORITES_VIEW_POPUP.equals(context) || ActionPlaces.SCOPE_VIEW_POPUP.equals(context) || ActionPlaces.NAVIGATION_BAR.equals(context)) { return tool.isShownInProjectViews(); } else if (ActionPlaces.MAIN_MENU.equals(context)) { return tool.isShownInMainMenu(); } else if (ActionPlaces.USAGE_VIEW_POPUP.equals(context)) { return tool.isShownInSearchResultsPopup(); }/*from w ww . j a v a2 s .com*/ return false; }