IDEA-103215 Add automatic word wrap to conditional breakpoint expression modification popup - added a toggle button to the toolbar

This commit is contained in:
Egor.Ushakov
2016-09-29 20:39:44 +03:00
parent 68ca420467
commit bd56c78434
2 changed files with 34 additions and 0 deletions
@@ -55,6 +55,7 @@ public class CodeFragmentInputComponent extends EvaluationInputComponent {
DefaultActionGroup group = new DefaultActionGroup();
group.add(new HistoryNavigationAction(false, IdeActions.ACTION_PREVIOUS_OCCURENCE, parentDisposable));
group.add(new HistoryNavigationAction(true, IdeActions.ACTION_NEXT_OCCURENCE, parentDisposable));
group.add(new ToggleSoftWrapAction());
editorPanel.add(ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, group, false).getComponent(), BorderLayout.EAST);
//myMainPanel.add(new JLabel(XDebuggerBundle.message("xdebugger.label.text.code.fragment")), BorderLayout.NORTH);
myMainPanel.add(editorPanel, BorderLayout.CENTER);
@@ -83,6 +84,22 @@ public class CodeFragmentInputComponent extends EvaluationInputComponent {
splitter.setSecondComponent(resultPanel);
}
private class ToggleSoftWrapAction extends ToggleAction {
public ToggleSoftWrapAction() {
copyFrom(ActionManager.getInstance().getAction(IdeActions.ACTION_EDITOR_USE_SOFT_WRAPS));
}
@Override
public boolean isSelected(AnActionEvent e) {
return myMultilineEditor.isUseSoftWraps();
}
@Override
public void setSelected(AnActionEvent e, boolean state) {
myMultilineEditor.setUseSoftWraps(state);
}
}
private class HistoryNavigationAction extends AnAction {
private final boolean myForward;
@@ -15,6 +15,7 @@
*/
package com.intellij.xdebugger.impl.ui;
import com.intellij.ide.util.PropertiesComponent;
import com.intellij.lang.Language;
import com.intellij.openapi.actionSystem.CommonDataKeys;
import com.intellij.openapi.actionSystem.LangDataKeys;
@@ -59,7 +60,9 @@ public class XDebuggerExpressionEditor extends XDebuggerEditorBase {
@Override
protected EditorEx createEditor() {
final EditorEx editor = super.createEditor();
editor.setHorizontalScrollbarVisible(multiline);
editor.setVerticalScrollbarVisible(multiline);
editor.getSettings().setUseSoftWraps(isUseSoftWraps());
editor.getColorsScheme().setEditorFontName(getFont().getFontName());
editor.getColorsScheme().setEditorFontSize(getFont().getSize());
return editor;
@@ -125,4 +128,18 @@ public class XDebuggerExpressionEditor extends XDebuggerEditorBase {
public void selectAll() {
myEditorTextField.selectAll();
}
private static final String SOFT_WRAPS_KEY = "XDebuggerExpressionEditor_Use_Soft_Wraps";
public boolean isUseSoftWraps() {
return PropertiesComponent.getInstance().getBoolean(SOFT_WRAPS_KEY);
}
public void setUseSoftWraps(boolean use) {
PropertiesComponent.getInstance().setValue(SOFT_WRAPS_KEY, use);
Editor editor = getEditor();
if (editor != null) {
editor.getSettings().setUseSoftWraps(use);
}
}
}