deprecate addCurrentToHistory, cleanup

This commit is contained in:
Vladimir Krivosheev
2014-02-18 14:07:15 +01:00
parent b22e89b3e7
commit 3e991eb8b2
3 changed files with 25 additions and 10 deletions
@@ -135,7 +135,7 @@ public class ConsoleExecuteAction extends DumbAwareAction {
console.getCurrentEditor().getSelectionModel().setSelection(range.getStartOffset(), range.getEndOffset());
if (addCurrentToHistory) {
console.addCurrentToHistory(range, false, preserveMarkup);
console.addCurrentToHistory(range, preserveMarkup);
}
if (clear) {
@@ -419,10 +419,23 @@ public class LanguageConsoleImpl implements Disposable, TypeSafeDataProvider {
markupModel.addRangeHighlighter(offset, offset + text.length(), HighlighterLayer.SYNTAX, attributes, HighlighterTargetArea.EXACT_RANGE);
}
@SuppressWarnings("UnusedDeclaration")
@Deprecated
/**
* @deprecated Use {@link LanguageConsoleBuilder},
* {@link LanguageConsoleBuilder#registerExecuteAction)} or
* {@link ConsoleExecuteAction#prepareRunExecuteAction)}
*
* to remove in IDEA 15
*/
public String addCurrentToHistory(@NotNull TextRange textRange, boolean erase, boolean preserveMarkup) {
return addToHistoryInner(textRange, myConsoleEditor, erase, preserveMarkup);
}
String addCurrentToHistory(@NotNull TextRange textRange, boolean preserveMarkup) {
return addToHistoryInner(textRange, myConsoleEditor, false, preserveMarkup);
}
public String addToHistory(@NotNull TextRange textRange, @NotNull EditorEx editor, boolean preserveMarkup) {
return addToHistoryInner(textRange, editor, false, preserveMarkup);
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2014 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.
@@ -19,33 +19,35 @@ package com.intellij.execution.ui.layout.actions;
import com.intellij.execution.ui.layout.impl.RunnerContentUi;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.ToggleAction;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class ToggleToolbarLayoutAction extends ToggleAction {
@Override
public void update(final AnActionEvent e) {
if (getRunnerUi(e) == null) {
e.getPresentation().setEnabled(false);
} else {
}
else {
super.update(e);
}
}
@Override
public boolean isSelected(final AnActionEvent e) {
final RunnerContentUi ui = getRunnerUi(e);
public boolean isSelected(@NotNull AnActionEvent e) {
RunnerContentUi ui = getRunnerUi(e);
return ui != null && ui.isHorizontalToolbar();
}
@Override
public void setSelected(final AnActionEvent e, final boolean state) {
getRunnerUi(e).setHorizontalToolbar(state);
public void setSelected(@NotNull AnActionEvent e, boolean state) {
RunnerContentUi ui = getRunnerUi(e);
assert ui != null;
ui.setHorizontalToolbar(state);
}
@Nullable
public static RunnerContentUi getRunnerUi(final AnActionEvent e) {
public static RunnerContentUi getRunnerUi(@NotNull AnActionEvent e) {
return RunnerContentUi.KEY.getData(e.getDataContext());
}
}