void () { SwitchTaskAction combo = null; ActionGroup group = (ActionGroup)CustomActionsSchema.getInstance().getCorrectedAction(IdeActions.GROUP_MAIN_TOOLBAR); ActionToolbarImpl toolbar = (ActionToolbarImpl)ActionManager.getInstance().createActionToolbar(ActionPlaces.MAIN_TOOLBAR, group, true); AnAction[] children = group.getChildren(TestActionEvent.createTestEvent()); for (AnAction child : children) { if (child instanceof ActionGroup) { AnAction[] actions = ((ActionGroup)child).getChildren(TestActionEvent.createTestEvent()); for (AnAction action : actions) { if (action instanceof SwitchTaskAction) { combo = (SwitchTaskAction)action; } } } } List<AnAction> actions = Utils.expandActionGroup( group, new PresentationFactory(), DataContext.EMPTY_CONTEXT, ActionPlaces.MAIN_TOOLBAR); assertFalse(actions.contains(combo)); TaskManager manager = TaskManager.getManager(getProject()); LocalTask defaultTask = manager.getActiveTask(); assertTrue(defaultTask.isDefault()); assertEquals(defaultTask.getCreated(), defaultTask.getUpdated()); toolbar.updateActionsImmediately(); Presentation presentation = doTest(combo, toolbar); assertFalse(presentation.isVisible()); assertNull(presentation.getClientProperty(CustomComponentAction.COMPONENT_KEY)); try { TaskSettings.getInstance().ALWAYS_DISPLAY_COMBO = true; presentation = doTest(combo, toolbar); assertTrue(presentation.isVisible()); } finally { TaskSettings.getInstance().ALWAYS_DISPLAY_COMBO = false; } LocalTask task = manager.createLocalTask("test"); manager.activateTask(task, false); TaskSettings.getInstance().ALWAYS_DISPLAY_COMBO = true; presentation = doTest(combo, toolbar); assertTrue(presentation.isVisible()); assertTrue(presentation.isEnabled()); PlatformTestUtil.waitForFuture(toolbar.updateActionsAsync()); JComponent component = presentation.getClientProperty(CustomComponentAction.COMPONENT_KEY); assertNotNull(component); assertTrue(component.isVisible()); assertTrue(component.isEnabled()); manager.activateTask(defaultTask, false); task = manager.getActiveTask(); assertTrue(task.isDefault()); presentation = doTest(combo, toolbar); if (!presentation.isVisible()) { LocalTask activeTask = manager.getActiveTask(); System.out.println(activeTask); System.out.println(activeTask.getCreated()); System.out.println(activeTask.getUpdated()); fail(); } }