List of usage examples for com.intellij.openapi.actionSystem Anchor LAST
Anchor LAST
To view the source code for com.intellij.openapi.actionSystem Anchor LAST.
Click Source Link
From source file:com.intellij.spellchecker.actions.SpellingPopupActionGroup.java
License:Apache License
@NotNull private static AnAction[] findActions(@NotNull AnActionEvent e) { PsiFile psiFile = e.getData(LangDataKeys.PSI_FILE); Project project = e.getData(LangDataKeys.PROJECT); Editor editor = e.getData(LangDataKeys.EDITOR); if (psiFile != null && project != null && editor != null) { List<HighlightInfo.IntentionActionDescriptor> quickFixes = QuickFixAction.getAvailableActions(editor, psiFile, -1);/*from ww w .j a v a2 s .com*/ Map<Anchor, List<AnAction>> children = new HashMap<Anchor, List<AnAction>>(); ArrayList<AnAction> first = new ArrayList<AnAction>(); children.put(Anchor.FIRST, first); ArrayList<AnAction> last = new ArrayList<AnAction>(); children.put(Anchor.LAST, last); extractActions(quickFixes, children); if (first.size() > 0 && last.size() > 0) { first.add(new Separator()); } first.addAll(last); if (first.size() > 0) { return first.toArray(new AnAction[first.size()]); } } return AnAction.EMPTY_ARRAY; }
From source file:com.intellij.spellchecker.quickfixes.AcceptWordAsCorrect.java
License:Apache License
@NotNull public Anchor getPopupActionAnchor() { return Anchor.LAST; }
From source file:com.r4intellij.actions.CodeEvalActionRegistry.java
License:Apache License
public CodeEvalActionRegistry(Project project) { super(project); DefaultActionGroup actionMenu = (DefaultActionGroup) ActionManager.getInstance() .getAction("RCodeSnippetActionMenu"); // DefaultActionGroup myActionGroup = new DefaultActionGroup("R Code Evaluation", true); // ActionManager.getInstance().registerAction("MyMenuID", myActionGroup); ///*from ww w.j a v a 2 s . c o m*/ // actionMenu.add(myActionGroup); // KeyStroke keyStroke = KeyStroke.getKeyStroke("control shift S"); // KeyboardShortcut shortcut = new KeyboardShortcut(keyStroke, null); // // CustomShortcutSet shortcuts = new CustomShortcutSet(shortcut); // AnAction action = new ConfigurableEvalAction("mein haus", "blabal", shortcuts); // myActionGroup.add(action, new Constraints(Anchor.LAST, "after")); // ActionManager.getInstance().registerAction("customREval1", action); RSettings instance = RSettings.getInstance(); if (instance != null) { for (EvalActionPref actionPref : instance.getEvalActionPrefs()) { String actionID = "customRAction" + instance.getEvalActionPrefs().indexOf(actionPref); if (ActionManager.getInstance().getAction(actionID) != null) continue; AnAction action = new ConfigurableEvalAction(actionPref.getName(), actionPref.getCode(), CustomShortcutSet.fromString(actionPref.getDefShortCut())); actionMenu.add(action, new Constraints(Anchor.LAST, "after")); ActionManager.getInstance().registerAction(actionID, action); } } }
From source file:io.github.holgerbrandl.send2terminal.actions.CodeEvalActionRegistry.java
License:Apache License
public CodeEvalActionRegistry(Project project) { super(project); DefaultActionGroup actionMenu = (DefaultActionGroup) ActionManager.getInstance() .getAction("CodeSnippetActionMenu"); // DefaultActionGroup myActionGroup = new DefaultActionGroup("R Code Evaluation", true); // ActionManager.getInstance().registerAction("MyMenuID", myActionGroup); ////from w w w . ja v a 2 s. com // actionMenu.add(myActionGroup); // KeyStroke keyStroke = KeyStroke.getKeyStroke("control shift S"); // KeyboardShortcut shortcut = new KeyboardShortcut(keyStroke, null); // // CustomShortcutSet shortcuts = new CustomShortcutSet(shortcut); // AnAction action = new ConfigurableEvalAction("mein haus", "blabal", shortcuts); // myActionGroup.add(action, new Constraints(Anchor.LAST, "after")); // ActionManager.getInstance().registerAction("customREval1", action); S2TSettings instance = S2TSettings.getInstance(); if (instance != null) { for (EvalActionPref actionPref : instance.getEvalActionPrefs()) { String actionID = "send2terminal_action_" + instance.getEvalActionPrefs().indexOf(actionPref); if (ActionManager.getInstance().getAction(actionID) != null) continue; AnAction action = new ConfigurableEvalAction(actionPref.getName(), actionPref.getCode(), CustomShortcutSet.fromString(actionPref.getDefShortCut())); actionMenu.add(action, new Constraints(Anchor.LAST, "after")); ActionManager.getInstance().registerAction(actionID, action); } } }
From source file:org.intellij.spellChecker.actions.SpellingPopupActionGroup.java
License:Apache License
@NotNull private static AnAction[] findActions(@NotNull AnActionEvent e) { PsiFile psiFile = e.getData(DataKeys.PSI_FILE); Project project = e.getData(DataKeys.PROJECT); Editor editor = e.getData(DataKeys.EDITOR); if (psiFile != null && project != null && editor != null) { List<HighlightInfo.IntentionActionDescriptor> quickFixes = QuickFixAction.getAvailableActions(editor, psiFile, -1);/*from w ww .j a va 2 s . co m*/ Map<Anchor, List<AnAction>> children = new HashMap<Anchor, List<AnAction>>(); ArrayList<AnAction> first = new ArrayList<AnAction>(); children.put(Anchor.FIRST, first); ArrayList<AnAction> last = new ArrayList<AnAction>(); children.put(Anchor.LAST, last); extractActions(quickFixes, children); if (first.size() > 0 && last.size() > 0) { first.add(new Separator()); } first.addAll(last); if (first.size() > 0) { return first.toArray(new AnAction[first.size()]); } } return AnAction.EMPTY_ARRAY; }
From source file:org.qi4j.chronos.ChronosProjectComponent.java
License:Open Source License
private void registerChronosComponents() { SwingUtilities.invokeLater(new Runnable() { public void run() { toolWindow = new ChronosToolWindow(toolWindowManager, actionManager, project); toolWindow.register();/* www . j a v a2s . co m*/ taskAssociationAction = new TaskAssociationAction(project); DefaultActionGroup actionGroup = (DefaultActionGroup) ActionManager.getInstance() .getAction("MainToolBar"); actionGroup.add(taskAssociationAction, new Constraints(Anchor.LAST, "after")); } }); }