本文整理匯總了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;
}