use of com.intellij.openapi.editor.actions.ScrollToTheEndToolbarAction in project intellij-community by JetBrains.
the class EventLogToolWindowFactory method createToolbar.
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);
}
use of com.intellij.openapi.editor.actions.ScrollToTheEndToolbarAction in project intellij-community by JetBrains.
the class ConsoleViewImpl method createConsoleActions.
@Override
@NotNull
public AnAction[] createConsoleActions() {
//Initializing prev and next occurrences actions
final CommonActionsManager actionsManager = CommonActionsManager.getInstance();
final AnAction prevAction = actionsManager.createPrevOccurenceAction(this);
prevAction.getTemplatePresentation().setText(getPreviousOccurenceActionName());
final AnAction nextAction = actionsManager.createNextOccurenceAction(this);
nextAction.getTemplatePresentation().setText(getNextOccurenceActionName());
final AnAction switchSoftWrapsAction = new ToggleUseSoftWrapsToolbarAction(SoftWrapAppliancePlaces.CONSOLE) {
@Override
protected Editor getEditor(AnActionEvent e) {
return myEditor;
}
@Override
public void setSelected(AnActionEvent e, final boolean state) {
super.setSelected(e, state);
if (myEditor == null) {
return;
}
final String placeholder = myCommandLineFolding.getPlaceholder(0);
final FoldingModel foldingModel = myEditor.getFoldingModel();
final int firstLineEnd = myEditor.getDocument().getLineEndOffset(0);
foldingModel.runBatchFoldingOperation(() -> {
FoldRegion[] regions = foldingModel.getAllFoldRegions();
if (regions.length > 0 && regions[0].getStartOffset() == 0 && regions[0].getEndOffset() == firstLineEnd) {
foldingModel.removeFoldRegion(regions[0]);
}
if (placeholder != null) {
FoldRegion foldRegion = foldingModel.addFoldRegion(0, firstLineEnd, placeholder);
if (foldRegion != null) {
foldRegion.setExpanded(false);
}
}
});
}
};
final AnAction autoScrollToTheEndAction = new ScrollToTheEndToolbarAction(myEditor);
//Initializing custom actions
final AnAction[] consoleActions = new AnAction[6 + customActions.size()];
consoleActions[0] = prevAction;
consoleActions[1] = nextAction;
consoleActions[2] = switchSoftWrapsAction;
consoleActions[3] = autoScrollToTheEndAction;
consoleActions[4] = ActionManager.getInstance().getAction("Print");
consoleActions[5] = new ClearAllAction(this);
for (int i = 0; i < customActions.size(); ++i) {
consoleActions[i + 6] = customActions.get(i);
}
ConsoleActionsPostProcessor[] postProcessors = Extensions.getExtensions(ConsoleActionsPostProcessor.EP_NAME);
AnAction[] result = consoleActions;
for (ConsoleActionsPostProcessor postProcessor : postProcessors) {
result = postProcessor.postProcess(this, result);
}
return result;
}
use of com.intellij.openapi.editor.actions.ScrollToTheEndToolbarAction in project android by JetBrains.
the class LogcatConsoleActionsPostProcessor method processActions.
/**
* 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()]);
}
Aggregations