use of com.intellij.openapi.actionSystem.ActionGroup in project intellij-community by JetBrains.
the class GridCellImpl method createTabInfoFor.
private TabInfo createTabInfoFor(Content content) {
final TabInfo tabInfo = updatePresentation(new TabInfo(new ProviderWrapper(content, myContext)), content).setObject(content).setPreferredFocusableComponent(content.getPreferredFocusableComponent()).setActionsContextComponent(content.getActionsContextComponent());
myContents.remove(content);
myContents.put(content, tabInfo);
ActionGroup group = (ActionGroup) myContext.getActionManager().getAction(RunnerContentUi.VIEW_TOOLBAR);
tabInfo.setTabLabelActions(group, ViewContext.CELL_TOOLBAR_PLACE);
tabInfo.setDragOutDelegate(((RunnerContentUi) myContext).myDragOutDelegate);
return tabInfo;
}
use of com.intellij.openapi.actionSystem.ActionGroup in project intellij-community by JetBrains.
the class RunLineMarkerTest method testTestClassWithMain.
public void testTestClassWithMain() throws Exception {
myFixture.addClass("package junit.framework; public class TestCase {}");
myFixture.configureByText("MainTest.java", "public class <caret>MainTest extends junit.framework.TestCase {\n" + " public static void main(String[] args) {\n" + " }\n" + " public void testFoo() {\n" + " }\n" + "}");
List<GutterMark> marks = myFixture.findGuttersAtCaret();
assertEquals(1, marks.size());
GutterIconRenderer mark = (GutterIconRenderer) marks.get(0);
ActionGroup group = mark.getPopupMenuActions();
assertNotNull(group);
TestActionEvent event = new TestActionEvent();
List<AnAction> list = ContainerUtil.findAll(group.getChildren(event), action -> {
TestActionEvent actionEvent = new TestActionEvent();
action.update(actionEvent);
String text = actionEvent.getPresentation().getText();
return text != null && text.startsWith("Run ") && text.endsWith("'");
});
assertEquals(list.toString(), 2, list.size());
list.get(0).update(event);
assertEquals("Run 'MainTest.main()'", event.getPresentation().getText());
list.get(1).update(event);
assertEquals("Run 'MainTest'", event.getPresentation().getText());
}
use of com.intellij.openapi.actionSystem.ActionGroup in project kotlin by JetBrains.
the class KotlinCallHierarchyBrowser method createTrees.
@Override
protected void createTrees(@NotNull Map<String, JTree> type2TreeMap) {
ActionGroup group = (ActionGroup) ActionManager.getInstance().getAction(IdeActions.GROUP_CALL_HIERARCHY_POPUP);
JTree tree1 = createTree(false);
PopupHandler.installPopupHandler(tree1, group, ActionPlaces.CALL_HIERARCHY_VIEW_POPUP, ActionManager.getInstance());
BaseOnThisMethodAction baseOnThisMethodAction = new BaseOnThisMethodAction();
baseOnThisMethodAction.registerCustomShortcutSet(ActionManager.getInstance().getAction(IdeActions.ACTION_CALL_HIERARCHY).getShortcutSet(), tree1);
type2TreeMap.put(CALLEE_TYPE, tree1);
JTree tree2 = createTree(false);
PopupHandler.installPopupHandler(tree2, group, ActionPlaces.CALL_HIERARCHY_VIEW_POPUP, ActionManager.getInstance());
baseOnThisMethodAction.registerCustomShortcutSet(ActionManager.getInstance().getAction(IdeActions.ACTION_CALL_HIERARCHY).getShortcutSet(), tree2);
type2TreeMap.put(CALLER_TYPE, tree2);
}
use of com.intellij.openapi.actionSystem.ActionGroup in project intellij-plugins by JetBrains.
the class BaseEditorPopup method getChildren.
@NotNull
public AnAction[] getChildren(AnActionEvent e) {
if (e == null)
return EMPTY_ARRAY;
final Editor editor = getEditor(e);
final VirtualFile file = getFile(e);
if (file == null || editor == null)
return EMPTY_ARRAY;
List<AnAction> result = new ArrayList<>();
final UserModel userModel = getUserModel();
String[] groups = userModel.getGroups();
List<String> groupsWithUsers = new ArrayList<>();
for (String group : groups) {
if (userModel.getUsers(group).length > 0) {
groupsWithUsers.add(group);
}
}
if (groupsWithUsers.size() == 1) {
User[] users = userModel.getUsers(groupsWithUsers.get(0));
fillWithUserActions(users, result, file, editor);
} else {
for (String groupsWithUser : groupsWithUsers) {
ActionGroup actionGroup = createGroupWithUsersActionGroup(groupsWithUser, userModel, file, editor);
result.add(actionGroup);
}
}
return result.toArray(new AnAction[result.size()]);
}
use of com.intellij.openapi.actionSystem.ActionGroup in project intellij-plugins by JetBrains.
the class IDEtalkToolWindow method createToolWindowComponent.
@Override
protected void createToolWindowComponent() {
StartupManager.getInstance(myProject).registerPostStartupActivity(() -> initializeTransports(myProject.getName()));
StatusToolbar statusToolbar = ((StatusToolbar) myContainer.getComponentInstanceOfType(StatusToolbar.class));
DefaultActionGroup toolbarActions = new DefaultActionGroup();
ActionGroup actions = (ActionGroup) myActionManager.getAction("IDEtalk");
if (actions != null) {
toolbarActions.addAll(actions);
}
toolbarActions.add(new ContextHelpAction("reference.toolWindows.idetalk"));
ActionGroup treeActions = (ActionGroup) myActionManager.getAction("IDEtalk_Tree");
JPanel toolbarPanel = new JPanel();
toolbarPanel.setLayout(new BoxLayout(toolbarPanel, BoxLayout.X_AXIS));
toolbarPanel.add(DropDownButton.wrap(new DropDownButton(new FindUsersAction(), IconUtil.getAddIcon())));
toolbarPanel.add(createToolbar(toolbarActions).getComponent());
toolbarPanel.add(Box.createHorizontalStrut(10));
toolbarPanel.add(new SeparatorComponent(JBColor.LIGHT_GRAY, SeparatorOrientation.VERTICAL));
toolbarPanel.add(Box.createHorizontalStrut(3));
toolbarPanel.add(DropDownButton.wrap(new OptionsButton()));
toolbarPanel.add(statusToolbar.createComponent());
toolbarPanel.add(new JPanel() {
@Override
public Dimension getPreferredSize() {
return new Dimension(Short.MAX_VALUE, 10);
}
});
if (treeActions != null) {
JComponent component = createToolbar(treeActions).getComponent();
component.setMinimumSize(component.getPreferredSize());
toolbarPanel.add(component);
}
toolbarPanel.setAlignmentX(0);
myTopPanel.add(toolbarPanel);
myPanel.add(myTopPanel, BorderLayout.NORTH);
myPanel.add(ScrollPaneFactory.createScrollPane(myUserListComponent.getComponent()));
ActionGroup group = (ActionGroup) myActionManager.getAction("IDEtalkPopup");
if (group != null) {
IDEAFacade.installPopupMenu(group, myUserListComponent.getTree(), myActionManager);
}
}
Aggregations