Java Code Examples for com.intellij.openapi.actionSystem.DefaultActionGroup#add()

The following examples show how to use com.intellij.openapi.actionSystem.DefaultActionGroup#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: ScopesChooser.java    From consulo with Apache License 2.0 6 votes vote down vote up
private void fillActionGroup(final DefaultActionGroup group,
                             final List<NamedScope> scopes,
                             final List<Descriptor> defaultDescriptors,
                             final InspectionProfileImpl inspectionProfile,
                             final Set<String> excludedScopeNames) {
  for (final NamedScope scope : scopes) {
    final String scopeName = scope.getName();
    if (excludedScopeNames.contains(scopeName)) {
      continue;
    }
    group.add(new DumbAwareAction(scopeName) {
      @Override
      public void actionPerformed(final AnActionEvent e) {
        for (final Descriptor defaultDescriptor : defaultDescriptors) {
          inspectionProfile.addScope(defaultDescriptor.getToolWrapper().createCopy(), scope, defaultDescriptor.getLevel(), true, getEventProject(e));
        }
        onScopeAdded();
      }
    });
  }
}
 
Example 2
Source File: RightTreePopupHandler.java    From MavenHelper with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("Duplicates")
public void invokePopup(final Component comp, final int x, final int y) {
	final DefaultMutableTreeNode selectedNode = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent();
	if (selectedNode == null) {
		return;
	}
	final MyTreeUserObject myTreeUserObject = (MyTreeUserObject) selectedNode.getUserObject();
	final MavenArtifactNode mavenArtifactNode = myTreeUserObject.getMavenArtifactNode();
	DefaultActionGroup actionGroup = new DefaultActionGroup();

	if (myTreeUserObject.getMavenArtifactNode().getParent() == null) {
		actionGroup.add(new JumpToSourceAction(project, mavenProject, mavenArtifactNode));
	} else {
		actionGroup.add(new JumpToSourceAction(project, mavenProject, mavenArtifactNode));
		actionGroup.add(getExcludeAction(selectedNode, mavenArtifactNode));
	}

	popup = ActionManager.getInstance().createActionPopupMenu("", actionGroup).getComponent();
	popup.show(comp, x, y);
}
 
Example 3
Source File: MainWindowBase.java    From KodeBeagle with Apache License 2.0 5 votes vote down vote up
protected final DefaultActionGroup getBasicActionGroup() {
    CollapseProjectTreeAction collapseProjectTreeAction = new CollapseProjectTreeAction();
    EditSettingsAction editSettingsAction = new EditSettingsAction();
    ExpandProjectTreeAction expandProjectTreeAction = new ExpandProjectTreeAction();
    IncludeMethodsToggleAction includeMethodsToggleAction = new IncludeMethodsToggleAction();
    DefaultActionGroup group = new DefaultActionGroup();
    group.add(includeMethodsToggleAction);
    group.addSeparator();
    group.add(expandProjectTreeAction);
    group.add(collapseProjectTreeAction);
    group.addSeparator();
    group.add(editSettingsAction);
    return group;
}
 
Example 4
Source File: ArtifactsStructureConfigurable.java    From consulo with Apache License 2.0 5 votes vote down vote up
private AnAction createAddArtifactAction(@Nonnull final ArtifactType type) {
  final List<? extends ArtifactTemplate> templates = type.getNewArtifactTemplates(myPackagingEditorContext);
  final ArtifactTemplate emptyTemplate = new ArtifactTemplate() {
    @Override
    public String getPresentableName() {
      return "Empty";
    }

    @Override
    public NewArtifactConfiguration createArtifact() {
      final String name = "unnamed";
      return new NewArtifactConfiguration(type.createRootElement(PackagingElementFactory.getInstance(myProject), name), name, type);
    }
  };

  if (templates.isEmpty()) {
    return new AddArtifactAction(type, emptyTemplate, type.getPresentableName(), type.getIcon());
  }
  final DefaultActionGroup group = new DefaultActionGroup(type.getPresentableName(), true);
  group.getTemplatePresentation().setIcon(type.getIcon());
  group.add(new AddArtifactAction(type, emptyTemplate, emptyTemplate.getPresentableName(), null));
  group.addSeparator();
  for (ArtifactTemplate template : templates) {
    group.add(new AddArtifactAction(type, template, template.getPresentableName(), null));
  }
  return group;
}
 
Example 5
Source File: ShowAddPackagingElementPopupAction.java    From consulo with Apache License 2.0 5 votes vote down vote up
@RequiredUIAccess
@Override
public void actionPerformed(@Nonnull AnActionEvent e) {
  final DefaultActionGroup group = new DefaultActionGroup();
  for (PackagingElementType type : PackagingElementFactory.getInstance(e.getProject()).getAllElementTypes()) {
    group.add(new AddNewPackagingElementAction((PackagingElementType<?>)type, myArtifactEditor));
  }
  final DataContext dataContext = e.getDataContext();
  final ListPopup popup = JBPopupFactory.getInstance().createActionGroupPopup("Add", group, dataContext, JBPopupFactory.ActionSelectionAid.SPEEDSEARCH, false);
  popup.showInBestPositionFor(dataContext);
}
 
Example 6
Source File: BlazeProblemsViewPanel.java    From intellij with Apache License 2.0 5 votes vote down vote up
@Override
protected void fillRightToolbarGroup(DefaultActionGroup group) {
  super.fillRightToolbarGroup(group);
  group.add(new AutoscrollToConsoleAction());
  group.add(new ShowWarningsAction());
  group.add(new ExpandAllAction(myTree));
  group.add(new CollapseAllAction(myTree));
}
 
Example 7
Source File: XFramesView.java    From consulo with Apache License 2.0 5 votes vote down vote up
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 8
Source File: EsyToolWindowFactory.java    From reasonml-idea-plugin with MIT License 5 votes vote down vote up
@NotNull
private ActionToolbar createToolbar(@NotNull BsConsole console) {
    DefaultActionGroup group = new DefaultActionGroup();
    group.add(new ScrollToTheEndToolbarAction(console.getEditor()));
    group.add(new ClearLogAction(console));
    group.add(new EsyInstallAction());
    group.add(new EsyBuildAction());
    group.add(new EsyShellAction());

    ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar("left", group, false);
    toolbar.setTargetComponent(console.getComponent());

    return toolbar;
}
 
Example 9
Source File: DuneToolWindowFactory.java    From reasonml-idea-plugin with MIT License 5 votes vote down vote up
@NotNull
private ActionToolbar createToolbar(@NotNull BsConsole console) {
    DefaultActionGroup group = new DefaultActionGroup();
    group.add(new ScrollToTheEndToolbarAction(console.getEditor()));
    group.add(new ClearLogAction(console));
    group.add(new DuneBuildAction());
    group.add(new DuneCleanAction());
    group.add(new DuneInstallAction());

    ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar("left", group, false);
    toolbar.setTargetComponent(console.getComponent());

    return toolbar;
}
 
Example 10
Source File: BsToolWindowFactory.java    From reasonml-idea-plugin with MIT License 5 votes vote down vote up
@NotNull
private ActionToolbar createToolbar(@NotNull BsConsole console) {
    DefaultActionGroup group = new DefaultActionGroup();
    group.add(new ScrollToTheEndToolbarAction(console.getEditor()));
    group.add(new ClearLogAction(console));
    group.add(new BsMakeAction());
    group.add(new BsMakeWorldAction());

    ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar("left", group, false);
    toolbar.setTargetComponent(console.getComponent());

    return toolbar;
}
 
Example 11
Source File: TabFormImpl.java    From azure-devops-intellij with MIT License 5 votes vote down vote up
/**
 * Create the option buttons for the toolbar
 *
 * @return action group
 */
protected DefaultActionGroup createOptionsGroup() {
    autoRefreshToggleButton = new ToolbarToggleButton(
            TfPluginBundle.message(TfPluginBundle.KEY_VCS_AUTO_REFRESH),
            true,
            CMD_AUTO_REFRESH_CHANGED);
    DefaultActionGroup group = new DefaultActionGroup();
    group.add(autoRefreshToggleButton);
    return group;
}
 
Example 12
Source File: BranchFilterPopupComponent.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
protected ActionGroup createActionGroup() {
  DefaultActionGroup actionGroup = new DefaultActionGroup();

  actionGroup.add(createAllAction());
  actionGroup.add(createSelectMultipleValuesAction());

  actionGroup.add(
          new MyBranchPopupBuilder(myFilterModel.getDataPack(), myBranchFilterModel.getVisibleRoots(), getRecentValuesFromSettings()).build());
  return actionGroup;
}
 
Example 13
Source File: RemoteFilePanel.java    From consulo with Apache License 2.0 5 votes vote down vote up
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 14
Source File: QuickChangeKeymapAction.java    From consulo with Apache License 2.0 5 votes vote down vote up
private static void addKeymapAction(final DefaultActionGroup group, final KeymapManagerEx manager, final Keymap current, final Keymap keymap, final boolean addScheme) {
  group.add(new AnAction(keymap.getPresentableName(), "", keymap == current ? ourCurrentAction : ourNotCurrentAction) {
    @Override
    public void actionPerformed(AnActionEvent e) {
      if (addScheme) {
        manager.getSchemesManager().addNewScheme(keymap, false);
      }
      manager.setActiveKeymap(keymap);
    }
  });
}
 
Example 15
Source File: MuleDebugProcess.java    From mule-intellij-plugins with Apache License 2.0 4 votes vote down vote up
@Override
public void registerAdditionalActions(@NotNull DefaultActionGroup leftToolbar, @NotNull DefaultActionGroup topToolbar, @NotNull DefaultActionGroup settings) {
  super.registerAdditionalActions(leftToolbar, topToolbar, settings);
  leftToolbar.add(new ExceptionBreakpointSwitchAction(muleDebuggerSession));
}
 
Example 16
Source File: WidgetPerfTable.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
private ActionGroup createTreePopupActions() {
  final DefaultActionGroup group = new DefaultActionGroup();
  final ActionManager actionManager = ActionManager.getInstance();
  group.add(actionManager.getAction(InspectorActions.JUMP_TO_SOURCE));
  return group;
}
 
Example 17
Source File: NoSqlExplorerPanel.java    From nosql4idea with Apache License 2.0 4 votes vote down vote up
public void installActions() {

        final TreeExpander treeExpander = new TreeExpander() {
            @Override
            public void expandAll() {
                NoSqlExplorerPanel.this.expandAll();
            }

            @Override
            public boolean canExpand() {
                return true;
            }

            @Override
            public void collapseAll() {
                NoSqlExplorerPanel.this.collapseAll();
            }

            @Override
            public boolean canCollapse() {
                return true;
            }
        };

        CommonActionsManager actionsManager = CommonActionsManager.getInstance();

        final AnAction expandAllAction = actionsManager.createExpandAllAction(treeExpander, rootPanel);
        final AnAction collapseAllAction = actionsManager.createCollapseAllAction(treeExpander, rootPanel);

        Disposer.register(this, new Disposable() {
            @Override
            public void dispose() {
                collapseAllAction.unregisterCustomShortcutSet(rootPanel);
                expandAllAction.unregisterCustomShortcutSet(rootPanel);
            }
        });


        DefaultActionGroup actionGroup = new DefaultActionGroup("NoSqlExplorerGroup", false);
        ViewCollectionValuesAction viewCollectionValuesAction = new ViewCollectionValuesAction(this);
        RefreshServerAction refreshServerAction = new RefreshServerAction(this);
        if (ApplicationManager.getApplication() != null) {
            actionGroup.add(refreshServerAction);
            actionGroup.add(new NoSqlDatabaseConsoleAction(this));
            actionGroup.add(viewCollectionValuesAction);
            actionGroup.add(expandAllAction);
            actionGroup.add(collapseAllAction);
            actionGroup.addSeparator();
            actionGroup.add(new OpenPluginSettingsAction());
        }

        GuiUtils.installActionGroupInToolBar(actionGroup, toolBarPanel, ActionManager.getInstance(), "NoSqlExplorerActions", true);

        DefaultActionGroup actionPopupGroup = new DefaultActionGroup("NoSqlExplorerPopupGroup", true);
        if (ApplicationManager.getApplication() != null) {
            actionPopupGroup.add(refreshServerAction);
            actionPopupGroup.add(viewCollectionValuesAction);
            actionPopupGroup.add(new DropCollectionAction(this));
            actionPopupGroup.add(new DropDatabaseAction(this));
        }

        PopupHandler.installPopupHandler(databaseTree, actionPopupGroup, "POPUP", ActionManager.getInstance());

        databaseTree.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent mouseEvent) {
                if (!(mouseEvent.getSource() instanceof JTree)) {
                    return;
                }

                DefaultMutableTreeNode treeNode = (DefaultMutableTreeNode) databaseTree.getLastSelectedPathComponent();
                if (treeNode == null) {
                    return;
                }

                if (mouseEvent.getClickCount() == 2) {
                    if (treeNode.getUserObject() instanceof DatabaseServer && treeNode.getChildCount() == 0) {
                        reloadServerConfiguration(getSelectedServerNode(), true);
                    }
                    if (treeNode.getUserObject() instanceof MongoCollection) {
                        loadRecords();
                    }
                    if (treeNode.getUserObject() instanceof RedisDatabase) {
                        loadRecords();
                    }

                    if (treeNode.getUserObject() instanceof CouchbaseDatabase) {
                        loadRecords();
                    }
                }
            }
        });
    }
 
Example 18
Source File: TogglePlatformAction.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
private static DefaultActionGroup createPopupActionGroup(FlutterApp app, AppState appState) {
  final DefaultActionGroup group = new DefaultActionGroup();
  group.add(appState.registerAction(new PlatformTargetAction(app, PlatformTarget.android)));
  group.add(appState.registerAction(new PlatformTargetAction(app, PlatformTarget.iOS)));
  return group;
}
 
Example 19
Source File: WidgetPerfTable.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
private ActionGroup createTreePopupActions() {
  final DefaultActionGroup group = new DefaultActionGroup();
  final ActionManager actionManager = ActionManager.getInstance();
  group.add(actionManager.getAction(InspectorActions.JUMP_TO_SOURCE));
  return group;
}
 
Example 20
Source File: FavoritesProjectViewPane.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public void addToolbarActions(final DefaultActionGroup group) {
  group.add(ActionManager.getInstance().getAction(IdeActions.RENAME_FAVORITES_LIST));
}