From 8ff07078dbbc26b178b54df09ebd6d2e75c1a228 Mon Sep 17 00:00:00 2001 From: Oleg Shpynov Date: Thu, 23 Sep 2010 17:22:21 +0400 Subject: [PATCH] Cosmetics --- .../execution/impl/ConsoleViewImpl.java | 4 ++ ...ToggleAutoScrollToTheEndToolbarAction.java | 57 +++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 platform/platform-impl/src/com/intellij/openapi/editor/actions/ToggleAutoScrollToTheEndToolbarAction.java diff --git a/platform/lang-impl/src/com/intellij/execution/impl/ConsoleViewImpl.java b/platform/lang-impl/src/com/intellij/execution/impl/ConsoleViewImpl.java index e7dca1cf1eb4..65bcee824258 100644 --- a/platform/lang-impl/src/com/intellij/execution/impl/ConsoleViewImpl.java +++ b/platform/lang-impl/src/com/intellij/execution/impl/ConsoleViewImpl.java @@ -34,7 +34,11 @@ import com.intellij.openapi.command.CommandProcessor; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.editor.*; import com.intellij.openapi.editor.actionSystem.*; +<<<<<<< HEAD import com.intellij.openapi.editor.actions.ScrollToTheEndToolbarAction; +======= +import com.intellij.openapi.editor.actions.ToggleAutoScrollToTheEndToolbarAction; +>>>>>>> 6f09e97... Cosmetics import com.intellij.openapi.editor.actions.ToggleUseSoftWrapsToolbarAction; import com.intellij.openapi.editor.colors.CodeInsightColors; import com.intellij.openapi.editor.colors.EditorColors; diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/actions/ToggleAutoScrollToTheEndToolbarAction.java b/platform/platform-impl/src/com/intellij/openapi/editor/actions/ToggleAutoScrollToTheEndToolbarAction.java new file mode 100644 index 000000000000..ccbf79b47d29 --- /dev/null +++ b/platform/platform-impl/src/com/intellij/openapi/editor/actions/ToggleAutoScrollToTheEndToolbarAction.java @@ -0,0 +1,57 @@ +/* + * Copyright 2000-2010 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.openapi.editor.actions; + +import com.intellij.idea.ActionsBundle; +import com.intellij.openapi.actionSystem.AnActionEvent; +import com.intellij.openapi.actionSystem.PlatformDataKeys; +import com.intellij.openapi.actionSystem.ToggleAction; +import com.intellij.openapi.editor.Editor; +import com.intellij.openapi.util.IconLoader; +import org.jetbrains.annotations.Nullable; + +/** + * @author oleg + */ +public class ToggleAutoScrollToTheEndToolbarAction extends ToggleAction { + + public ToggleAutoScrollToTheEndToolbarAction() { + super(); + final String message = ActionsBundle.message("action.EditorConsoleAutoScrollToTheEnd.text"); + getTemplatePresentation().setDescription(message); + getTemplatePresentation().setText(message); + getTemplatePresentation().setIcon(IconLoader.getIcon("/runConfigurations/scroll_down.png")); + } + + @Override + public boolean isSelected(final AnActionEvent e) { + final Editor editor = getEditor(e); + return editor != null && editor.getSettings().isForceScrollToEnd(); + } + + @Nullable + protected Editor getEditor(final AnActionEvent e) { + return e.getData(PlatformDataKeys.EDITOR); + } + + @Override + public void setSelected(AnActionEvent e, boolean state) { + final Editor editor = getEditor(e); + if (editor != null) { + editor.getSettings().setForceScrollToEnd(state); + } + } +} \ No newline at end of file