com.intellij.openapi.actionSystem.DefaultActionGroup Java Examples

The following examples show how to use com.intellij.openapi.actionSystem.DefaultActionGroup. 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: BuckToolWindowImpl.java    From buck with Apache License 2.0 6 votes vote down vote up
@Override
public ActionGroup getLeftToolbarActions() {
  ActionManager actionManager = ActionManager.getInstance();

  DefaultActionGroup group = new DefaultActionGroup();

  group.add(actionManager.getAction("buck.ChooseTarget"));
  group.addSeparator();
  group.add(actionManager.getAction("buck.Build"));
  group.add(actionManager.getAction("buck.Stop"));
  group.add(actionManager.getAction("buck.Test"));
  group.add(actionManager.getAction("buck.Install"));
  group.add(actionManager.getAction("buck.Uninstall"));
  group.add(actionManager.getAction("buck.Kill"));
  group.add(actionManager.getAction("buck.ScrollToEnd"));
  group.add(actionManager.getAction("buck.Clear"));

  return group;
}
 
Example #2
Source File: RunIOSDevicesAction.java    From react-native-console with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
private DefaultActionGroup createDevicesPopupGroup(java.util.List<IOSDeviceInfo> devices) {
    DefaultActionGroup group = new DefaultActionGroup();
    devices.forEach(iosDeviceInfo -> {
        if (iosDeviceInfo != null) {
            String deviceName = iosDeviceInfo.name + " " + iosDeviceInfo.version;
            group.add(new BaseRNConsoleAction(super.terminal, deviceName, "Run on iOS device: '" + deviceName + "'",
                    iosDeviceInfo.simulator ? PluginIcons.IPhoneSimulator
                            : PluginIcons.IPhoneDevice) {
                @Override
                public void doAction(AnActionEvent anActionEvent) {
                    RNConsole consoleView = terminal.getRNConsole(getText(), getIcon());
                    consoleView.runRawNPMCI(
                            RNPathUtil.getExecuteFullPathSingle("react-native"),
                            "run-ios",
                            iosDeviceInfo.simulator ? "--simulator" : "--device",
                            iosDeviceInfo.name);
                }
            });
        }
    });


    return group;
}
 
Example #3
Source File: IMPanel.java    From SmartIM4IntelliJ with Apache License 2.0 6 votes vote down vote up
private void initUI() {
    DefaultActionGroup group = new DefaultActionGroup();
    group.add(new LoginAction(this));
    group.add(new HideContactAction(this));
    group.add(new DisconnectAction(this));
    createBroadcastAction(group);
    group.add(new SettingsAction(this));
    MockConsoleAction test = new MockConsoleAction(this);
    //group.add(test);

    ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar("SmartQQ", group, false);
    // toolbar.getComponent().addFocusListener(createFocusListener());
    toolbar.setTargetComponent(this);
    setToolbar(toolbar.getComponent());

    left = createContactsUI();
    left.onLoadContacts(false);

    tabbedChat = new ClosableTabHost(this);

    splitter = new JBSplitter(false);
    splitter.setSplitterProportionKey("main.splitter.key");
    splitter.setFirstComponent(left.getPanel());
    splitter.setSecondComponent(tabbedChat);
    splitter.setProportion(0.3f);
    setContent(splitter);
}
 
Example #4
Source File: QuickChangeLookAndFeel.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
protected void fillActions(Project project, @Nonnull DefaultActionGroup group, @Nonnull DataContext dataContext) {
  final LafManager manager = LafManager.getInstance();
  final UIManager.LookAndFeelInfo[] lfs = manager.getInstalledLookAndFeels();
  final UIManager.LookAndFeelInfo current = manager.getCurrentLookAndFeel();
  for (final UIManager.LookAndFeelInfo lf : lfs) {
    group.add(new DumbAwareAction(lf.getName(), "", lf == current ? ourCurrentAction : ourNotCurrentAction) {
      @Override
      public void actionPerformed(AnActionEvent e) {
        final UIManager.LookAndFeelInfo cur = manager.getCurrentLookAndFeel();
        if (cur == lf) return;
        manager.setCurrentLookAndFeel(lf);
        manager.updateUI();
      }
    });
  }
}
 
Example #5
Source File: FilterDropDown.java    From azure-devops-intellij with MIT License 6 votes vote down vote up
public FilterDropDown() {
    this.group = new DefaultActionGroup();

    this.clickListener = new ClickListener() {
        @Override
        public boolean onClick(MouseEvent event, int clickCount) {
            showDropDownMenu();
            return true;
        }
    };

    this.keyAdapter = new KeyAdapter() {
        @Override
        public void keyPressed(KeyEvent keyEvent) {
            if (keyEvent.getKeyCode() == KeyEvent.VK_ENTER || keyEvent.getKeyCode() == KeyEvent.VK_DOWN) {
                showDropDownMenu();
            }
        }
    };
}
 
Example #6
Source File: ProjectLevelVcsManagerImpl.java    From consulo with Apache License 2.0 6 votes vote down vote up
private Content getOrCreateConsoleContent(final ContentManager contentManager) {
  final String displayName = VcsBundle.message("vcs.console.toolwindow.display.name");
  Content content = contentManager.findContent(displayName);
  if (content == null) {
    releaseConsole();

    myConsole = TextConsoleBuilderFactory.getInstance().createBuilder(myProject).getConsole();

    JPanel panel = new JPanel(new BorderLayout());
    panel.add(myConsole.getComponent(), BorderLayout.CENTER);

    ActionToolbar toolbar = ActionManager.getInstance()
            .createActionToolbar("VcsManager", new DefaultActionGroup(myConsole.createConsoleActions()), false);
    panel.add(toolbar.getComponent(), BorderLayout.WEST);

    content = ContentFactory.getInstance().createContent(panel, displayName, true);
    content.setDisposer(myConsoleDisposer);
    contentManager.addContent(content);

    for (Pair<String, ConsoleViewContentType> pair : myPendingOutput) {
      printToConsole(pair.first, pair.second);
    }
    myPendingOutput.clear();
  }
  return content;
}
 
Example #7
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 #8
Source File: EmbeddedLinuxJVMConsoleView.java    From embeddedlinux-jvmdebugger-intellij with Apache License 2.0 6 votes vote down vote up
/**
 * Creats the tool window content
 * @param toolWindow
 */
public void createToolWindowContent(@NotNull ToolWindow toolWindow) {
    //Create runner UI layout
    RunnerLayoutUi.Factory factory = RunnerLayoutUi.Factory.getInstance(project);
    RunnerLayoutUi layoutUi = factory.create("", "", "session", project);

    // Adding actions
    DefaultActionGroup group = new DefaultActionGroup();
    layoutUi.getOptions().setLeftToolbar(group, ActionPlaces.UNKNOWN);

    Content console = layoutUi.createContent(EmbeddedLinuxJVMToolWindowFactory.ID, consoleView.getComponent(), "", null, null);
    AnAction[] consoleActions = consoleView.createConsoleActions();
    for (AnAction action : consoleActions) {
        if (!shouldIgnoreAction(action)) {
            group.add(action);
        }
    }
    layoutUi.addContent(console, 0, PlaceInGrid.right, false);

    JComponent layoutComponent = layoutUi.getComponent();
    myConsolePanel.add(layoutComponent, BorderLayout.CENTER);
    Content content = ContentFactory.SERVICE.getInstance().createContent(layoutComponent, null, true);
    toolWindow.getContentManager().addContent(content);
}
 
Example #9
Source File: DefaultSdksModel.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public void createAddActions(DefaultActionGroup group, final JComponent parent, final Consumer<Sdk> updateTree, @Nullable Condition<SdkTypeId> filter) {
  final List<SdkType> types = SdkType.EP_NAME.getExtensionList();
  List<SdkType> list = new ArrayList<>(types.size());
  for (SdkType sdkType : types) {
    if (filter != null && !filter.value(sdkType)) {
      continue;
    }

    list.add(sdkType);
  }
  Collections.sort(list, (o1, o2) -> StringUtil.compare(o1.getPresentableName(), o2.getPresentableName(), true));

  for (final SdkType type : list) {
    final AnAction addAction = new DumbAwareAction(type.getPresentableName(), null, type.getIcon()) {
      @RequiredUIAccess
      @Override
      public void actionPerformed(@Nonnull AnActionEvent e) {
        doAdd(parent, type, updateTree);
      }
    };
    group.add(addAction);
  }
}
 
Example #10
Source File: SlingServerTreeManager.java    From aem-ide-tooling-4-intellij with Apache License 2.0 6 votes vote down vote up
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 #11
Source File: ActionUtil.java    From react-native-console with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Create some actions
 *
 * @param horizontal     is horizontal displayed
 * @return
 */
public static ActionToolbar createToolbarWithActions(boolean horizontal,
                                                     AnAction... actions) {
    DefaultActionGroup group = new DefaultActionGroup();

    if (actions != null) {
        for (AnAction anAction : actions) {
            group.add(anAction);
        }
    }
    //group.addSeparator();
    return ActionManager.getInstance().createActionToolbar("unknown", group, horizontal);// horizontal
}
 
Example #12
Source File: RunAndroidDevicesAction.java    From react-native-console with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
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 #13
Source File: ChangeSchemaCombo.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
@Override
public DefaultActionGroup createPopupActionGroup(JComponent component) {
  DefaultActionGroup group = new DefaultActionGroup(new ChangeSchemaAction(FileTemplatesScheme.DEFAULT));
  FileTemplatesScheme scheme = myConfigurable.getManager().getProjectScheme();
  if (scheme != null) {
    group.add(new ChangeSchemaAction(scheme));
  }
  return group;
}
 
Example #14
Source File: SdksConfigurable.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
@Nullable
protected ArrayList<AnAction> createActions(final boolean fromPopup) {
  final ArrayList<AnAction> actions = new ArrayList<AnAction>();
  DefaultActionGroup group = new DefaultActionGroup(ProjectBundle.message("add.action.name"), true);
  group.getTemplatePresentation().setIcon(IconUtil.getAddIcon());
  mySdksModel.createAddActions(group, myTree, projectJdk -> {
    addNode(new MyNode(new SdkConfigurable(((SdkImpl)projectJdk), mySdksModel, TREE_UPDATER, myHistory, myProject), false), myRoot);
    selectNodeInTree(findNodeByObject(myRoot, projectJdk));
  }, SdkListConfigurable.ADD_SDK_FILTER);
  actions.add(new MyActionGroupWrapper(group));
  actions.add(new MyDeleteAction(forAll(Conditions.alwaysTrue())));
  return actions;
}
 
Example #15
Source File: ShortcutStartupActivity.java    From StringManipulation with Apache License 2.0 5 votes vote down vote up
private static void unRegisterAction(ActionManager instance, String actionId, DefaultActionGroup group) {
	AnAction action = instance.getActionOrStub(actionId);
	if (action != null) {
		LOG.info("Unregistering " + action + " id:" + actionId);
		group.remove(action);
		instance.unregisterAction(actionId);
	}
}
 
Example #16
Source File: ShortcutStartupActivity.java    From StringManipulation with Apache License 2.0 5 votes vote down vote up
public static void unRegisterActions(List<CustomActionModel> customActionModels) {
	ActionManager instance = ActionManager.getInstance();
	DefaultActionGroup group = (DefaultActionGroup) instance.getAction("StringManipulation.Group.SwitchCase");
	for (CustomActionModel actionModel : customActionModels) {
		String id = actionModel.getId();
		if (StringUtils.isNotBlank(id)) {
			unRegisterAction(instance, id, group);
			unRegisterAction(instance, id + CustomActionModel.REVERSE, group);
		}
	}
}
 
Example #17
Source File: RunAndroidDevicesAction.java    From react-native-console with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private DefaultActionGroup createDevicesPopupGroup(Collection<Device> devices) {
        DefaultActionGroup group = new DefaultActionGroup();
        devices.forEach(iosDeviceInfo -> {
            if (iosDeviceInfo != null) {
                String deviceName = iosDeviceInfo.getName();// + " " + (iosDeviceInfo.isConnected() ? "Connected" : "Disconnected");
                group.add(new BaseRNConsoleAction(super.terminal, "Debug on " + deviceName, "Debug on Android device: '" + deviceName + "'",
                    PluginIcons.Android
                        //iosDeviceInfo.isConnected() ? PluginIcons.Android : PluginIcons.Error
                ) {
                    @Override
                    public void doAction(AnActionEvent anActionEvent) {
//                        if(!iosDeviceInfo.isConnected()) {
//                            NotificationUtils.errorNotification(iosDeviceInfo.getName() + " is disconnected");
//                            return;
//                        }

                        RNConsole consoleView = terminal.getRNConsole(getText(), getIcon());
                        consoleView.runRawNPMCI(
                                RNPathUtil.getExecuteFullPathSingle("react-native"),
                                "run-android",
                                "--deviceId",
                                iosDeviceInfo.getId());
                    }
                });
            }
        });


        return group;
    }
 
Example #18
Source File: RunIOSDevicesAction.java    From react-native-console with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
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 #19
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 #20
Source File: MainWindowBase.java    From KodeBeagle with Apache License 2.0 5 votes vote down vote up
@NotNull
private JComponent setUpToolBar() {
    DefaultActionGroup group = getActionGroup();
    final JComponent toolBar = ActionManager.getInstance().
            createActionToolbar(KODEBEAGLE, group, true).
            getComponent();
    toolBar.setBorder(BorderFactory.createCompoundBorder());
    toolBar.setMaximumSize(new Dimension(Integer.MAX_VALUE, toolBar.getMinimumSize().height));
    return toolBar;
}
 
Example #21
Source File: BuckToolWindowFactory.java    From Buck-IntelliJ-Plugin with Apache License 2.0 5 votes vote down vote up
@NotNull
public ActionGroup getLeftToolbarActions(final Project project) {
  ActionManager actionManager = ActionManager.getInstance();

  DefaultActionGroup group = new DefaultActionGroup();
  group.add(actionManager.getAction("buck.ChooseTarget"));
  group.addSeparator();
  group.add(actionManager.getAction("buck.Install"));
  group.add(actionManager.getAction("buck.Build"));
  group.add(actionManager.getAction("buck.Kill"));
  group.add(actionManager.getAction("buck.Uninstall"));
  group.add(actionManager.getAction("buck.Project"));
  return group;
}
 
Example #22
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 #23
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 #24
Source File: IMChatConsole.java    From SmartIM4IntelliJ with Apache License 2.0 5 votes vote down vote up
protected void initToolBar() {
    DefaultActionGroup group = new DefaultActionGroup();
    ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar("SmartQQ", group, false);
    // toolbar.getComponent().addFocusListener(createFocusListener());
    toolbar.setTargetComponent(this);
    setToolbar(toolbar.getComponent());

    initToolBar(group);
}
 
Example #25
Source File: ConsoleLogConsole.java    From aem-ide-tooling-4-intellij with Apache License 2.0 5 votes vote down vote up
private DefaultActionGroup createPopupActions(ActionManager actionManager, ClearLogAction action) {
    AnAction[] children = ((ActionGroup)actionManager.getAction(IdeActions.GROUP_CONSOLE_EDITOR_POPUP)).getChildren(null);
    DefaultActionGroup group = new DefaultActionGroup(children);
    group.addSeparator();
    group.add(action);
    return group;
}
 
Example #26
Source File: SlingServerTreeManager.java    From aem-ide-tooling-4-intellij with Apache License 2.0 5 votes vote down vote up
public void adjustToolbar(DefaultActionGroup group) {
    AnAction action = CommonActionsManager.getInstance().createExpandAllAction(myTreeExpander, tree);
    action.getTemplatePresentation().setDescription(AEMBundle.message("action.expand.all.nodes.description"));
    group.add(action);
    action = CommonActionsManager.getInstance().createCollapseAllAction(myTreeExpander, tree);
    action.getTemplatePresentation().setDescription(AEMBundle.message("action.collapse.all.nodes.description"));
    group.add(action);
}
 
Example #27
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 #28
Source File: ScopeViewPane.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void addToolbarActions(DefaultActionGroup actionGroup) {
  actionGroup.add(ActionManager.getInstance().getAction("ScopeView.EditScopes"));
  actionGroup.addAction(new ShowModulesAction(myProject) {
    @Override
    protected String getId() {
      return ScopeViewPane.this.getId();
    }
  }).setAsSecondary(true);
}
 
Example #29
Source File: VcsLogGearActionGroup.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void actionPerformed(@Nonnull AnActionEvent e) {
  DefaultActionGroup group = new DefaultActionGroup(ActionManager.getInstance().getAction(myActionGroup));

  ListPopup popup = JBPopupFactory.getInstance().createActionGroupPopup(null, group, e.getDataContext(), JBPopupFactory.ActionSelectionAid.MNEMONICS, true, ToolWindowContentUI.POPUP_PLACE);
  Component component = e.getInputEvent().getComponent();
  if (component instanceof ActionButtonComponent) {
    popup.showUnderneathOf(component);
  }
  else {
    popup.showInCenterOf(component);
  }
}
 
Example #30
Source File: TemplateConfigurable.java    From android-codegenerator-plugin-intellij with Apache License 2.0 5 votes vote down vote up
@Nullable
@Override
public JComponent createComponent() {
    templateSettings = TemplateSettings.getInstance();
    editor = createEditorInPanel(templateSettings.provideTemplateForName(templateName));

    JPanel panel = new JPanel(new BorderLayout());
    panel.setPreferredSize(new Dimension(400, 300));
    panel.add(SeparatorFactory.createSeparator(templateHeaderText, null), BorderLayout.PAGE_START);
    panel.add(new ToolbarPanel(editorPanel, new DefaultActionGroup(new ResetToDefaultAction())), BorderLayout.CENTER);
    return panel;
}