本文整理汇总了Java中com.intellij.openapi.actionSystem.DefaultActionGroup类的典型用法代码示例。如果您正苦于以下问题:Java DefaultActionGroup类的具体用法?Java DefaultActionGroup怎么用?Java DefaultActionGroup使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DefaultActionGroup类属于com.intellij.openapi.actionSystem包,在下文中一共展示了DefaultActionGroup类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initBPMNModelMenu
import com.intellij.openapi.actionSystem.DefaultActionGroup; //导入依赖的package包/类
public void initBPMNModelMenu() {
DefaultActionGroup modelMenu = (DefaultActionGroup) ActionManager.getInstance().getAction("yaoqiang.actions.BPMNModelMenu");
AppMenu model = new ModelMenu();
for (int i = 0; i < model.getItemCount(); i++) {
JMenuItem item = model.getItem(i);
if (item == null) {
modelMenu.addSeparator();
} else {
AnAction action = new AnAction(item.getText()) {
@Override
public void actionPerformed(AnActionEvent e) {
item.getAction().actionPerformed(new ActionEvent(e, 0, ""));
}
};
modelMenu.add(action);
}
}
}
示例2: createList
import com.intellij.openapi.actionSystem.DefaultActionGroup; //导入依赖的package包/类
/**
* create ListPop
*
* @param title
* @param data
* @param listener
*/
public void createList(String title, String[] data, OnItemClickListener listener) {
DefaultActionGroup group = new DefaultActionGroup();
if (data != null && data.length > 0) {
for (int i = 0; i < data.length; i++) {
if (!Utils.isEmpty(data[i])) {
if (data[i].contains("-")) {
group.add(new ListItemAction(i, data[i], listener));
} else {
group.addSeparator(data[i]);
}
}
}
}
listPopup = JBPopupFactory.getInstance().createActionGroupPopup(title, group,
anActionEvent.getDataContext(), aid, true, null, -1, null, "unknown");
show();
}
示例3: getTaskDescriptionActionGroup
import com.intellij.openapi.actionSystem.DefaultActionGroup; //导入依赖的package包/类
@NotNull
default DefaultActionGroup getTaskDescriptionActionGroup() {
final DefaultActionGroup group = new DefaultActionGroup();
String[] ids = new String[]{
StudyCheckAction.ACTION_ID,
StudyPreviousTaskAction.ACTION_ID,
StudyNextTaskAction.ACTION_ID,
StudyRefreshTaskFileAction.ACTION_ID,
StudyShowHintAction.ACTION_ID
};
ActionManager actionManager = ActionManager.getInstance();
Arrays.stream(ids)
.map(actionManager::getAction)
.filter(Objects::nonNull)
.forEach(group::add);
group.add(new StudyEditInputAction());
return group;
}
示例4: run
import com.intellij.openapi.actionSystem.DefaultActionGroup; //导入依赖的package包/类
@Override
public void run(AnActionButton button) {
// 获取选中节点
final DefaultMutableTreeNode selectedNode = getSelectedNode();
if (selectedNode == null) {
return;
}
List<AnAction> actions = getMultipleActions(selectedNode);
if (actions == null || actions.isEmpty()) {
return;
}
// 显示新增按钮
final DefaultActionGroup group = new DefaultActionGroup(actions);
JBPopupFactory.getInstance()
.createActionGroupPopup(null, group, DataManager.getInstance().getDataContext(button.getContextComponent()),
JBPopupFactory.ActionSelectionAid.SPEEDSEARCH, true).show(button.getPreferredPopupPoint());
}
示例5: setUpToolWindow
import com.intellij.openapi.actionSystem.DefaultActionGroup; //导入依赖的package包/类
private Content setUpToolWindow() {
//Create runner UI layout
final RunnerLayoutUi.Factory factory = RunnerLayoutUi.Factory.getInstance(myProject);
final RunnerLayoutUi layoutUi = factory.create("", "", "session", myProject);
// Adding actions
DefaultActionGroup group = new DefaultActionGroup();
group.add(myKillAction);
group.addSeparator();
layoutUi.getOptions().setLeftToolbar(group, ActionPlaces.UNKNOWN);
final Content console = layoutUi.createContent(CONSOLE_ID, myConsole.getComponent(), "", null, null);
layoutUi.addContent(console, 0, PlaceInGrid.right, false);
final JComponent uiComponent = layoutUi.getComponent();
myPanel.add(uiComponent, BorderLayout.CENTER);
final ContentManager manager = myToolWindow.getContentManager();
final ContentFactory contentFactory = ContentFactory.SERVICE.getInstance();
final Content content = contentFactory.createContent(uiComponent, null, true);
manager.addContent(content);
return content;
}
示例6: createPopupActionGroup
import com.intellij.openapi.actionSystem.DefaultActionGroup; //导入依赖的package包/类
@NotNull
protected DefaultActionGroup createPopupActionGroup(JComponent button) {
DefaultActionGroup group = new DefaultActionGroup();
GuiEditor editor = myLastEditor;
if (editor != null) {
Locale[] locales = FormEditingUtil.collectUsedLocales(editor.getModule(), editor.getRootContainer());
if (locales.length > 1 || (locales.length == 1 && locales [0].getDisplayName().length() > 0)) {
Arrays.sort(locales, new Comparator<Locale>() {
public int compare(final Locale o1, final Locale o2) {
return o1.getDisplayName().compareTo(o2.getDisplayName());
}
});
for(Locale locale: locales) {
group.add(new SetLocaleAction(editor, locale, true));
}
}
else {
group.add(new SetLocaleAction(editor, new Locale(""), false));
}
}
return group;
}
示例7: disposeComponent
import com.intellij.openapi.actionSystem.DefaultActionGroup; //导入依赖的package包/类
@Override
public void disposeComponent() {
ActionManager am = ActionManager.getInstance();
// Gets an instance of the WindowMenu action group.
DefaultActionGroup menuManager = (DefaultActionGroup) am.getAction(COMPONENT_GROUP); //(IdeActions.GROUP_EDITOR_POPUP); //"EditorPopupMenu");
for (AnAction a : menuManager.getChildActionsOrStubs()) {
if (a.getClass() == LaunchSearchAction.class) {
am.unregisterAction(getActionId((LaunchSearchAction) a));
}
}
// Adds a separator and a new menu command to the WindowMenu group on the main menu.
menuManager.removeAll();
}
示例8: createAddAction
import com.intellij.openapi.actionSystem.DefaultActionGroup; //导入依赖的package包/类
@Override
public AbstractAddGroup createAddAction() {
return new AbstractAddGroup(ProjectBundle.message("add.new.jdk.text")) {
@NotNull
@Override
public AnAction[] getChildren(@Nullable final AnActionEvent e) {
DefaultActionGroup group = new DefaultActionGroup(ProjectBundle.message("add.new.jdk.text"), true);
myJdksTreeModel.createAddActions(group, myTree, new Consumer<Sdk>() {
@Override
public void consume(final Sdk projectJdk) {
addJdkNode(projectJdk, true);
}
});
return group.getChildren(null);
}
};
}
示例9: createActions
import com.intellij.openapi.actionSystem.DefaultActionGroup; //导入依赖的package包/类
@Override
@Nullable
protected ArrayList<AnAction> createActions(final boolean fromPopup) {
if (myProjectJdksModel == null) {
return null;
}
final ArrayList<AnAction> actions = new ArrayList<AnAction>();
DefaultActionGroup group = new DefaultActionGroup(ProjectBundle.message("add.new.jdk.text"), true);
group.getTemplatePresentation().setIcon(IconUtil.getAddIcon());
myProjectJdksModel.createAddActions(group, myTree, new Consumer<Sdk>() {
@Override
public void consume(final Sdk projectJdk) {
addNode(new MyNode(new JdkConfigurable(((ProjectJdkImpl)projectJdk), myProjectJdksModel, TREE_UPDATER, myHistory, myProject), false), myRoot);
selectNodeInTree(findNodeByObject(myRoot, projectJdk));
}
});
actions.add(new MyActionGroupWrapper(group));
actions.add(new MyDeleteAction(Conditions.<Object[]>alwaysTrue()));
return actions;
}
示例10: onNewButton
import com.intellij.openapi.actionSystem.DefaultActionGroup; //导入依赖的package包/类
private void onNewButton() {
if (myCloudTypes.size() == 1) {
createAccount(ContainerUtil.getFirstItem(myCloudTypes));
return;
}
DefaultActionGroup group = new DefaultActionGroup();
for (final ServerType<?> cloudType : myCloudTypes) {
group.add(new AnAction(cloudType.getPresentableName(), cloudType.getPresentableName(), cloudType.getIcon()) {
@Override
public void actionPerformed(AnActionEvent e) {
createAccount(cloudType);
}
});
}
JBPopupFactory.getInstance().createActionGroupPopup("New Account", group, DataManager.getInstance().getDataContext(myMainPanel),
JBPopupFactory.ActionSelectionAid.SPEEDSEARCH, false)
.showUnderneathOf(myNewButton);
}
示例11: createDefaultFileSystemActions
import com.intellij.openapi.actionSystem.DefaultActionGroup; //导入依赖的package包/类
public DefaultActionGroup createDefaultFileSystemActions(FileSystemTree fileSystemTree) {
DefaultActionGroup group = new DefaultActionGroup();
final ActionManager actionManager = ActionManager.getInstance();
group.add(actionManager.getAction("FileChooser.GotoHome"));
group.add(actionManager.getAction("FileChooser.GotoProject"));
group.addSeparator();
group.add(actionManager.getAction("FileChooser.NewFolder"));
group.add(actionManager.getAction("FileChooser.Delete"));
group.addSeparator();
SynchronizeAction action1 = new SynchronizeAction();
AnAction original = actionManager.getAction(IdeActions.ACTION_SYNCHRONIZE);
action1.copyFrom(original);
action1.registerCustomShortcutSet(original.getShortcutSet(), fileSystemTree.getTree());
group.add(action1);
group.addSeparator();
group.add(actionManager.getAction("FileChooser.ShowHiddens"));
return group;
}
示例12: selectionChanged
import com.intellij.openapi.actionSystem.DefaultActionGroup; //导入依赖的package包/类
protected void selectionChanged(RadComponent component, boolean selected) {
ListenerNavigateButton btn = myNavigateButtons.get(component);
if (selected) {
DefaultActionGroup group = component.getBinding() != null ? ListenerNavigateButton.prepareActionGroup(component) : null;
if (group != null && group.getChildrenCount() > 0) {
if (btn == null) {
btn = new ListenerNavigateButton(component);
myNavigateButtons.put(component, btn);
}
add(btn);
btn.setVisible(true);
}
else {
if (btn != null) {
btn.setVisible(false);
}
}
}
else {
if (btn != null) {
btn.setVisible(false);
}
}
}
示例13: getChildrenCountRecursive
import com.intellij.openapi.actionSystem.DefaultActionGroup; //导入依赖的package包/类
private static int getChildrenCountRecursive(ActionGroup group) {
AnAction[] children;
if (group instanceof DefaultActionGroup) {
children = ((DefaultActionGroup) group).getChildActionsOrStubs();
}
else {
children = group.getChildren(null);
}
int count = 0;
for (AnAction child : children) {
if (child instanceof ActionGroup) {
count += getChildrenCountRecursive((ActionGroup) child);
}
else {
count++;
}
}
return count;
}
示例14: createToolWindowContent
import com.intellij.openapi.actionSystem.DefaultActionGroup; //导入依赖的package包/类
public void createToolWindowContent(@NotNull ToolWindow toolWindow) {
//Create runner UI layout
RunnerLayoutUi.Factory factory = RunnerLayoutUi.Factory.getInstance(myProject);
RunnerLayoutUi layoutUi = factory.create("", "", "session", myProject);
// Adding actions
DefaultActionGroup group = new DefaultActionGroup();
layoutUi.getOptions().setLeftToolbar(group, ActionPlaces.UNKNOWN);
Content console = layoutUi.createContent(GradleConsoleToolWindowFactory.ID, myConsoleView.getComponent(), "", null, null);
AnAction[] consoleActions = myConsoleView.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);
//noinspection ConstantConditions
Content content = ContentFactory.SERVICE.getInstance().createContent(layoutComponent, null, true);
toolWindow.getContentManager().addContent(content);
}
示例15: createToolbar
import com.intellij.openapi.actionSystem.DefaultActionGroup; //导入依赖的package包/类
private ActionToolbarImpl createToolbar() {
final DefaultActionGroup framesGroup = new DefaultActionGroup();
CommonActionsManager actionsManager = CommonActionsManager.getInstance();
framesGroup.add(actionsManager.createPrevOccurenceAction(getFramesList()));
framesGroup.add(actionsManager.createNextOccurenceAction(getFramesList()));
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.setAddSeparatorFirst(true);
toolbar.getComponent().setBorder(new EmptyBorder(1, 0, 0, 0));
return toolbar;
}