@Nonnull private List<AnAction> mergeConsoleActions(@Nonnull List<AnAction> actions1, @Nonnull Collection<AnAction> actions2) { return ContainerUtil.map(actions1, action1 -> { final AnAction action2 = ContainerUtil.find(actions2, action -> action1.getClass() == action.getClass() && StringUtil.equals(action1.getTemplatePresentation().getText(), action.getTemplatePresentation().getText())); if (action2 instanceof ToggleUseSoftWrapsToolbarAction) { return new MergedWrapTextAction(((ToggleUseSoftWrapsToolbarAction)action1), (ToggleUseSoftWrapsToolbarAction)action2); } else if (action2 instanceof ScrollToTheEndToolbarAction) { return new MergedToggleAction(((ToggleAction)action1), (ToggleAction)action2); } else if (action2 instanceof ConsoleViewImpl.ClearAllAction) { return new MergedAction(action1, action2); } else { return action1; } }); }
public ActionToolbar createToolbar() { DefaultActionGroup group = new DefaultActionGroup(); group.add(new ScrollToTheEndToolbarAction(this.getEditor())); group.add(new ClearLogAction(this)); group.add(new StartAction(this, getProject())); ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar("left", group, false); toolbar.setTargetComponent(this.getComponent()); return toolbar; }
private static ActionToolbar createToolbar(Project project, Editor editor, EventLogConsole console) { DefaultActionGroup group = new DefaultActionGroup(); group.add(new EditNotificationSettings(project)); group.add(new DisplayBalloons()); group.add(new ToggleSoftWraps(editor)); group.add(new ScrollToTheEndToolbarAction(editor)); group.add(ActionManager.getInstance().getAction(IdeActions.ACTION_MARK_ALL_NOTIFICATIONS_AS_READ)); group.add(new EventLogConsole.ClearLogAction(console)); group.add(new ContextHelpAction(EventLog.HELP_ID)); return ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, group, false); }
/** * Moves "clear all" and "Scroll to End" actions to the toolbar start. * * @see <a href="http://b.android.com/66626">Bug 66626</a>. */ private AnAction[] processActions(AndroidLogcatView.AndroidLogConsole console, AnAction[] actions) { List<AnAction> actionList = new ArrayList<AnAction>(actions.length); AnAction scrollToEndAction = null; // remove actions that don't make sense for logcat for (AnAction a : actions) { // remove the existing clear all action if (a instanceof ConsoleViewImpl.ClearAllAction) { continue; } // remove the scroll to end action, we'll add it back at the top if (a instanceof ScrollToTheEndToolbarAction) { String message = "Scroll to the end. Clicking on a particular line stops scrolling and keeps that line visible."; a.getTemplatePresentation().setDescription(message); a.getTemplatePresentation().setText(message); scrollToEndAction = a; continue; } actionList.add(a); } if (scrollToEndAction != null) { actionList.add(0, scrollToEndAction); } // add logcat specific actions actionList.add(0, new ClearLogCatAction(console)); return actionList.toArray(new AnAction[actionList.size()]); }
private static ActionToolbar createToolbar(Project project, Editor editor, ConsoleLogConsole console) { DefaultActionGroup group = new DefaultActionGroup(); group.add(new EditNotificationSettings(project)); group.add(new DisplayBalloons()); group.add(new ToggleSoftWraps(editor)); group.add(new ScrollToTheEndToolbarAction(editor)); group.add(ActionManager.getInstance().getAction(IdeActions.ACTION_MARK_ALL_NOTIFICATIONS_AS_READ)); group.add(new ConsoleLogConsole.ClearLogAction(console)); group.add(new ContextHelpAction(ConsoleLog.HELP_ID)); return ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, group, false); }
private static ActionToolbar createToolbar(Project project, Editor editor) { DefaultActionGroup group = new DefaultActionGroup(); group.add(new EditNotificationSettings(project)); group.add(new DisplayBalloons()); group.add(new ToggleSoftWraps(editor)); group.add(new ScrollToTheEndToolbarAction(editor)); group.add(new MarkAllAsRead(project)); group.add(new ContextHelpAction(EventLog.HELP_ID)); return ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, group, false); }