Java Code Examples for com.intellij.openapi.actionSystem.DefaultActionGroup#addAll()
The following examples show how to use
com.intellij.openapi.actionSystem.DefaultActionGroup#addAll() .
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: TabLabel.java From consulo with Apache License 2.0 | 5 votes |
private void handlePopup(final MouseEvent e) { if (e.getClickCount() != 1 || !e.isPopupTrigger()) return; if (e.getX() < 0 || e.getX() >= e.getComponent().getWidth() || e.getY() < 0 || e.getY() >= e.getComponent().getHeight()) { return; } String place = myTabs.getPopupPlace(); place = place != null ? place : ActionPlaces.UNKNOWN; myTabs.myPopupInfo = myInfo; final DefaultActionGroup toShow = new DefaultActionGroup(); if (myTabs.getPopupGroup() != null) { toShow.addAll(myTabs.getPopupGroup()); toShow.addSeparator(); } JBTabsImpl tabs = DataManager.getInstance().getDataContext(e.getComponent(), e.getX(), e.getY()).getData(JBTabsImpl.NAVIGATION_ACTIONS_KEY); if (tabs == myTabs && myTabs.myAddNavigationGroup) { toShow.addAll(myTabs.myNavigationActions); } if (toShow.getChildrenCount() == 0) return; myTabs.myActivePopup = myTabs.myActionManager.createActionPopupMenu(place, toShow).getComponent(); myTabs.myActivePopup.addPopupMenuListener(myTabs.myPopupListener); myTabs.myActivePopup.addPopupMenuListener(myTabs); myTabs.myActivePopup.show(e.getComponent(), e.getX(), e.getY()); }
Example 2
Source File: RemoteFilePanel.java From consulo with Apache License 2.0 | 5 votes |
private void initToolbar(Project project) { DefaultActionGroup group = new DefaultActionGroup(); group.add(new RefreshRemoteFileAction(myVirtualFile)); for (RemoteFileEditorActionProvider actionProvider : RemoteFileEditorActionProvider.EP_NAME.getExtensions()) { group.addAll(actionProvider.createToolbarActions(project, myVirtualFile)); } final ActionToolbar actionToolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, group, true); myToolbarPanel.add(actionToolbar.getComponent(), BorderLayout.CENTER); }
Example 3
Source File: XFramesView.java From consulo with Apache License 2.0 | 5 votes |
private ActionToolbarImpl createToolbar() { final DefaultActionGroup framesGroup = new DefaultActionGroup(); CommonActionsManager actionsManager = CommonActionsManager.getInstance(); framesGroup.add(actionsManager.createPrevOccurenceAction(myFramesList)); framesGroup.add(actionsManager.createNextOccurenceAction(myFramesList)); framesGroup.addAll(ActionManager.getInstance().getAction(XDebuggerActions.FRAMES_TOP_TOOLBAR_GROUP)); final ActionToolbarImpl toolbar = (ActionToolbarImpl)ActionManager.getInstance().createActionToolbar(ActionPlaces.DEBUGGER_TOOLBAR, framesGroup, true); toolbar.setReservePlaceAutoPopupIcon(false); toolbar.getComponent().setBorder(new EmptyBorder(1, 0, 0, 0)); return toolbar; }
Example 4
Source File: BlazeConsoleView.java From intellij with Apache License 2.0 | 4 votes |
void createToolWindowContent(ToolWindow toolWindow) { // Create runner UI layout RunnerLayoutUi.Factory factory = RunnerLayoutUi.Factory.getInstance(project); RunnerLayoutUi layoutUi = factory.create("", "", "session", project); layoutUi.getOptions().setMoveToGridActionEnabled(false).setMinimizeActionEnabled(false); Content console = layoutUi.createContent( BlazeConsoleToolWindowFactory.ID, consoleView.getComponent(), "", null, null); console.setCloseable(false); layoutUi.addContent(console, 0, PlaceInGrid.right, false); // Adding actions DefaultActionGroup group = new DefaultActionGroup(); layoutUi.getOptions().setLeftToolbar(group, TOOLBAR_ACTION_PLACE); // Initializing prev and next occurrences actions OccurenceNavigator navigator = fromConsoleView(consoleView); CommonActionsManager actionsManager = CommonActionsManager.getInstance(); AnAction prevAction = actionsManager.createPrevOccurenceAction(navigator); prevAction.getTemplatePresentation().setText(navigator.getPreviousOccurenceActionName()); AnAction nextAction = actionsManager.createNextOccurenceAction(navigator); nextAction.getTemplatePresentation().setText(navigator.getNextOccurenceActionName()); group.addAll(prevAction, nextAction); AnAction[] consoleActions = consoleView.createConsoleActions(); for (AnAction action : consoleActions) { if (!shouldIgnoreAction(action)) { group.add(action); } } group.add(new StopAction()); JComponent layoutComponent = layoutUi.getComponent(); layoutComponent.setFocusTraversalPolicyProvider(true); layoutComponent.setFocusTraversalPolicy( new LayoutFocusTraversalPolicy() { @Override public Component getDefaultComponent(Container container) { if (container.equals(layoutComponent)) { return consoleView.getPreferredFocusableComponent(); } return super.getDefaultComponent(container); } }); Content content = ContentFactory.SERVICE.getInstance().createContent(layoutComponent, null, true); content.setCloseable(false); toolWindow.getContentManager().addContent(content); }
Example 5
Source File: SymfonyProfilerWidget.java From idea-php-symfony2-plugin with MIT License | 4 votes |
public DefaultActionGroup getActions(){ DefaultActionGroup actionGroup = new DefaultActionGroup(null, false); ProfilerIndexInterface index = ProfilerFactoryUtil.createIndex(getProject()); if(index == null) { return actionGroup; } List<ProfilerRequestInterface> requests = index.getRequests(); Collection<AnAction> templateActions = new ArrayList<>(); Map<String, Integer> templateActionsMap = new HashMap<>(); Collection<AnAction> routeActions = new ArrayList<>(); Map<String, Integer> routeActionsMap = new HashMap<>(); Collection<AnAction> controllerActions = new ArrayList<>(); Map<String, Integer> controllerActionsMap = new HashMap<>(); Collection<AnAction> urlActions = new ArrayList<>(); Collection<AnAction> mailActions = new ArrayList<>(); for(ProfilerRequestInterface profilerRequest : requests) { urlActions.add(new SymfonyProfilerWidgetActions.UrlAction(index, profilerRequest)); DefaultDataCollectorInterface collector = profilerRequest.getCollector(DefaultDataCollectorInterface.class); if(collector != null) { attachProfileItem(templateActions, templateActionsMap, collector.getTemplate(), ProfilerTarget.TEMPLATE); attachProfileItem(routeActions, routeActionsMap, collector.getRoute(), ProfilerTarget.ROUTE); attachProfileItem(controllerActions, controllerActionsMap, collector.getController(), ProfilerTarget.CONTROLLER); } // @TODO: use collector //String content = profilerRequest.getContent(); //if(content != null && content.contains("Swift_Mime_Headers_MailboxHeader")) { // mailActions.add(new SymfonyProfilerWidgetActions.UrlAction(getProject(), profilerRequest, statusCode).withPanel("swiftmailer").withIcon(Symfony2Icons.MAIL)); //} } // routes if(urlActions.size() > 0) { actionGroup.addSeparator("Debug-Url"); actionGroup.addAll(urlActions); } // mails send by request if(mailActions.size() > 0) { actionGroup.addSeparator("E-Mail"); actionGroup.addAll(mailActions); } // routes if(routeActions.size() > 0) { actionGroup.addSeparator("Routes"); actionGroup.addAll(routeActions); } // controller methods if(controllerActions.size() > 0) { actionGroup.addSeparator("Controller"); actionGroup.addAll(controllerActions); } // template should be most use case; so keep it in cursor range if(templateActions.size() > 0) { actionGroup.addSeparator("Template"); actionGroup.addAll(templateActions); } return actionGroup; }