mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Per language wrap on typing reverted
This commit is contained in:
@@ -72,7 +72,6 @@ public class JavaLanguageCodeStyleSettingsProvider extends LanguageCodeStyleSett
|
||||
}
|
||||
else if (settingsType == SettingsType.WRAPPING_AND_BRACES_SETTINGS) {
|
||||
consumer.showStandardOptions("RIGHT_MARGIN",
|
||||
"WRAP_ON_TYPING",
|
||||
"KEEP_CONTROL_STATEMENT_IN_ONE_LINE",
|
||||
"LINE_COMMENT_AT_FIRST_COLUMN",
|
||||
"BLOCK_COMMENT_AT_FIRST_COLUMN",
|
||||
|
||||
@@ -266,11 +266,6 @@ public class CodeStyleSettings extends CommonCodeStyleSettings implements Clonea
|
||||
*/
|
||||
@Deprecated
|
||||
public int RIGHT_MARGIN = 120;
|
||||
/**
|
||||
* @deprecated Use isWrapOnTyping(Language) instead or setWrapOnTyping(Language,boolean) for testing purposes.
|
||||
* @see #isWrapOnTyping(Language)
|
||||
* @see #setWrapOnTyping(Language, boolean)
|
||||
*/
|
||||
public boolean WRAP_WHEN_TYPING_REACHES_RIGHT_MARGIN = false;
|
||||
|
||||
|
||||
@@ -962,35 +957,4 @@ public class CodeStyleSettings extends CommonCodeStyleSettings implements Clonea
|
||||
public void setDefaultRightMargin(int rightMargin) {
|
||||
RIGHT_MARGIN = rightMargin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines whether or not wrapping should occur when typing reaches right margin.
|
||||
* @param language The language to check the option for or null for a global option.
|
||||
* @return True if wrapping on right margin is enabled.
|
||||
*/
|
||||
public boolean isWrapOnTyping(@Nullable Language language) {
|
||||
if (language != null) {
|
||||
CommonCodeStyleSettings langSettings = getCommonSettings(language);
|
||||
if (langSettings != null) {
|
||||
if (langSettings.WRAP_ON_TYPING != WrapOnTyping.UNDEFINED.intValue) {
|
||||
return langSettings.WRAP_ON_TYPING == WrapOnTyping.WRAP.intValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
//noinspection deprecation
|
||||
return WRAP_WHEN_TYPING_REACHES_RIGHT_MARGIN;
|
||||
}
|
||||
|
||||
@TestOnly
|
||||
public void setWrapOnTyping(@Nullable Language language, boolean wrapOnTyping) {
|
||||
if (language != null) {
|
||||
CommonCodeStyleSettings langSettings = getCommonSettings(language);
|
||||
if (langSettings != null) {
|
||||
langSettings.WRAP_ON_TYPING = wrapOnTyping ? WrapOnTyping.WRAP.intValue : WrapOnTyping.NO_WRAP.intValue;
|
||||
return;
|
||||
}
|
||||
}
|
||||
//noinspection deprecation
|
||||
WRAP_WHEN_TYPING_REACHES_RIGHT_MARGIN = wrapOnTyping;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,7 +113,6 @@ public interface CodeStyleSettingsCustomizable {
|
||||
|
||||
enum WrappingOrBraceOption {
|
||||
RIGHT_MARGIN,
|
||||
WRAP_ON_TYPING,
|
||||
KEEP_CONTROL_STATEMENT_IN_ONE_LINE,
|
||||
LINE_COMMENT_AT_FIRST_COLUMN,
|
||||
BLOCK_COMMENT_AT_FIRST_COLUMN,
|
||||
|
||||
@@ -890,24 +890,6 @@ public class CommonCodeStyleSettings {
|
||||
|
||||
public int FORCE_REARRANGE_MODE = REARRANGE_ACCORDIND_TO_DIALOG;
|
||||
|
||||
public enum WrapOnTyping {
|
||||
UNDEFINED (-1),
|
||||
NO_WRAP (0),
|
||||
WRAP (1);
|
||||
|
||||
public int intValue;
|
||||
|
||||
WrapOnTyping(int i) {
|
||||
this.intValue = i;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines if wrapping should occur when typing reaches right margin. <b>Do not refer to this field directly, use
|
||||
* <code>CodeStyleSettings.isWrapOnTyping(Language)</code> method instead</b>.
|
||||
* @see CodeStyleSettings#isWrapOnTyping(Language)
|
||||
*/
|
||||
public int WRAP_ON_TYPING = WrapOnTyping.UNDEFINED.intValue;
|
||||
|
||||
//-------------------------Indent options-------------------------------------------------
|
||||
public static class IndentOptions implements JDOMExternalizable, Cloneable {
|
||||
|
||||
@@ -158,7 +158,6 @@ public class GeneralCodeStylePanel extends CodeStyleAbstractPanel {
|
||||
settings.LINE_SEPARATOR = getSelectedLineSeparator();
|
||||
|
||||
settings.setDefaultRightMargin(((Number) myRightMarginSpinner.getValue()).intValue());
|
||||
//noinspection deprecation
|
||||
settings.WRAP_WHEN_TYPING_REACHES_RIGHT_MARGIN = myCbWrapWhenTypingReachesRightMargin.isSelected();
|
||||
myIndentOptionsEditor.setEnabled(true);
|
||||
myIndentOptionsEditor.apply(settings, settings.OTHER_INDENT_OPTIONS);
|
||||
@@ -224,7 +223,6 @@ public class GeneralCodeStylePanel extends CodeStyleAbstractPanel {
|
||||
return true;
|
||||
}
|
||||
|
||||
//noinspection deprecation
|
||||
if (settings.WRAP_WHEN_TYPING_REACHES_RIGHT_MARGIN ^ myCbWrapWhenTypingReachesRightMargin.isSelected()) {
|
||||
return true;
|
||||
}
|
||||
@@ -281,7 +279,6 @@ public class GeneralCodeStylePanel extends CodeStyleAbstractPanel {
|
||||
}
|
||||
|
||||
myRightMarginSpinner.setValue(settings.getDefaultRightMargin());
|
||||
//noinspection deprecation
|
||||
myCbWrapWhenTypingReachesRightMargin.setSelected(settings.WRAP_WHEN_TYPING_REACHES_RIGHT_MARGIN);
|
||||
myIndentOptionsEditor.reset(settings, settings.OTHER_INDENT_OPTIONS);
|
||||
myIndentOptionsEditor.setEnabled(true);
|
||||
|
||||
-76
@@ -31,7 +31,6 @@ import com.intellij.ui.treeStructure.treetable.TreeTableModel;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.ui.AbstractTableCellEditor;
|
||||
import com.intellij.util.ui.ColumnInfo;
|
||||
import com.intellij.util.ui.ThreeStateCheckBox;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import gnu.trove.THashMap;
|
||||
import gnu.trove.THashSet;
|
||||
@@ -352,11 +351,6 @@ public abstract class OptionTableWithPreviewPanel extends CustomizableLanguageCo
|
||||
myOptions.add(new BooleanOption(null, fieldName, title, groupName, null, null));
|
||||
}
|
||||
|
||||
protected void addOption(
|
||||
@NotNull String filedName, @NotNull String title, @Nullable String groupName, int undefinedValue, int falseValue, int trueValue) {
|
||||
myOptions.add(new TriStateOption(null, filedName, title, groupName, null, null, undefinedValue, falseValue, trueValue));
|
||||
}
|
||||
|
||||
protected void addOption(@NotNull String fieldName, @NotNull String title, @Nullable String groupName,
|
||||
@NotNull String[] options, @NotNull int[] values) {
|
||||
myOptions.add(new SelectionOption(null, fieldName, title, groupName, null, null, options, values));
|
||||
@@ -437,61 +431,6 @@ public abstract class OptionTableWithPreviewPanel extends CustomizableLanguageCo
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private class TriStateOption extends Option {
|
||||
|
||||
private int myUndefinedValue;
|
||||
private int myFalseValue;
|
||||
private int myTrueValue;
|
||||
|
||||
public TriStateOption(@Nullable Class<? extends CustomCodeStyleSettings> clazz,
|
||||
@NotNull String fieldName,
|
||||
@NotNull String title,
|
||||
@Nullable String groupName,
|
||||
@Nullable OptionAnchor anchor,
|
||||
@Nullable String anchorFiledName,
|
||||
int undefinedValue,
|
||||
int falseValue,
|
||||
int trueValue) {
|
||||
super(clazz, fieldName, title, groupName, anchor, anchorFiledName);
|
||||
myUndefinedValue = undefinedValue;
|
||||
myFalseValue = falseValue;
|
||||
myTrueValue = trueValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getValue(CodeStyleSettings settings) {
|
||||
try {
|
||||
int value = field.getInt(getSettings(settings));
|
||||
return getState(value);
|
||||
}
|
||||
catch (IllegalAccessException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(Object value, CodeStyleSettings settings) {
|
||||
try {
|
||||
int intValue =
|
||||
ThreeStateCheckBox.State.DONT_CARE.equals(value) ? myUndefinedValue :
|
||||
ThreeStateCheckBox.State.SELECTED.equals(value) ? myTrueValue : myFalseValue;
|
||||
field.setInt(getSettings(settings), intValue);
|
||||
}
|
||||
catch (IllegalAccessException ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
public ThreeStateCheckBox.State getState(Object value) {
|
||||
if (value instanceof Integer) {
|
||||
if (value.equals(myTrueValue)) return ThreeStateCheckBox.State.SELECTED;
|
||||
if (value.equals(myFalseValue)) return ThreeStateCheckBox.State.NOT_SELECTED;
|
||||
}
|
||||
return ThreeStateCheckBox.State.DONT_CARE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private class SelectionOption extends Option {
|
||||
@NotNull final String[] options;
|
||||
@NotNull final int[] values;
|
||||
@@ -746,7 +685,6 @@ public abstract class OptionTableWithPreviewPanel extends CustomizableLanguageCo
|
||||
private final JCheckBox myCheckBox = new JBCheckBox();
|
||||
private final JPanel myEmptyLabel = new JPanel();
|
||||
private final JLabel myIntLabel = new JLabel();
|
||||
private final ThreeStateCheckBox myTriStateCheckBox = new ThreeStateCheckBox();
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
@@ -787,10 +725,6 @@ public abstract class OptionTableWithPreviewPanel extends CustomizableLanguageCo
|
||||
myIntLabel.setText(value.toString());
|
||||
return myIntLabel;
|
||||
}
|
||||
else if (value instanceof ThreeStateCheckBox.State) {
|
||||
myTriStateCheckBox.setState((ThreeStateCheckBox.State)value);
|
||||
return myTriStateCheckBox;
|
||||
}
|
||||
|
||||
myCheckBox.putClientProperty("JComponent.sizeVariant", "small");
|
||||
myComboBox.putClientProperty("JComponent.sizeVariant", "small");
|
||||
@@ -849,7 +783,6 @@ public abstract class OptionTableWithPreviewPanel extends CustomizableLanguageCo
|
||||
private final JCheckBox myBooleanEditor = new JBCheckBox();
|
||||
private JBComboBoxTableCellEditorComponent myOptionsEditor = new JBComboBoxTableCellEditorComponent();
|
||||
private MyIntOptionEditor myIntOptionsEditor = new MyIntOptionEditor();
|
||||
private ThreeStateCheckBox myTriStateOptionsEditor = new ThreeStateCheckBox();
|
||||
private Component myCurrentEditor = null;
|
||||
private MyTreeNode myCurrentNode = null;
|
||||
|
||||
@@ -865,7 +798,6 @@ public abstract class OptionTableWithPreviewPanel extends CustomizableLanguageCo
|
||||
};
|
||||
myBooleanEditor.addActionListener(itemChoosen);
|
||||
myOptionsEditor.addActionListener(itemChoosen);
|
||||
myTriStateOptionsEditor.addActionListener(itemChoosen);
|
||||
myBooleanEditor.putClientProperty("JComponent.sizeVariant", "small");
|
||||
myOptionsEditor.putClientProperty("JComponent.sizeVariant", "small");
|
||||
}
|
||||
@@ -887,9 +819,6 @@ public abstract class OptionTableWithPreviewPanel extends CustomizableLanguageCo
|
||||
else if (myCurrentEditor == myIntOptionsEditor) {
|
||||
return myIntOptionsEditor.getPresentableValue();
|
||||
}
|
||||
else if (myCurrentEditor == myTriStateOptionsEditor) {
|
||||
return myTriStateOptionsEditor.getState();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -917,11 +846,6 @@ public abstract class OptionTableWithPreviewPanel extends CustomizableLanguageCo
|
||||
myIntOptionsEditor.setDefaultValue(intOption.getDefaultValue());
|
||||
myIntOptionsEditor.setDefaultValueText(intOption.getDefaultValueText());
|
||||
}
|
||||
else if (node.getKey() instanceof TriStateOption) {
|
||||
TriStateOption triStateOption = (TriStateOption)node.getKey();
|
||||
myCurrentEditor = myTriStateOptionsEditor;
|
||||
myTriStateOptionsEditor.setState(triStateOption.getState(node.getValue()));
|
||||
}
|
||||
else {
|
||||
myCurrentEditor = myOptionsEditor;
|
||||
myOptionsEditor.setCell(table, row, column);
|
||||
|
||||
+3
-11
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.application.options.codeStyle.RightMarginForm">
|
||||
<grid id="27dc6" binding="myTopPanel" layout-manager="GridLayoutManager" row-count="3" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="10" left="0" bottom="10" right="10"/>
|
||||
<grid id="27dc6" binding="myTopPanel" layout-manager="GridLayoutManager" row-count="2" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="10" left="10" bottom="10" right="10"/>
|
||||
<constraints>
|
||||
<xy x="20" y="20" width="500" height="400"/>
|
||||
</constraints>
|
||||
@@ -18,7 +18,7 @@
|
||||
</component>
|
||||
<vspacer id="1265c">
|
||||
<constraints>
|
||||
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</vspacer>
|
||||
<component id="78fe" class="javax.swing.JTextField" binding="myRightMarginField">
|
||||
@@ -39,14 +39,6 @@
|
||||
<text resource-bundle="messages/ApplicationBundle" key="settings.code.style.default.general"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="7701d" class="javax.swing.JCheckBox" binding="myWrapOnTypingCheckBox" custom-create="true" default-binding="true">
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="3" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Wrap on typing"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
</form>
|
||||
|
||||
+6
-38
@@ -16,10 +16,8 @@
|
||||
package com.intellij.application.options.codeStyle;
|
||||
|
||||
import com.intellij.lang.Language;
|
||||
import com.intellij.openapi.application.ApplicationBundle;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettings;
|
||||
import com.intellij.psi.codeStyle.CommonCodeStyleSettings;
|
||||
import com.intellij.util.ui.ThreeStateCheckBox;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -45,7 +43,6 @@ public class RightMarginForm {
|
||||
private JTextField myRightMarginField;
|
||||
private JCheckBox myDefaultGeneralCheckBox;
|
||||
private JPanel myTopPanel;
|
||||
private JCheckBox myWrapOnTypingCheckBox;
|
||||
private final Language myLanguage;
|
||||
private final int myDefaultRightMargin;
|
||||
|
||||
@@ -80,22 +77,6 @@ public class RightMarginForm {
|
||||
myRightMarginField.setEnabled(false);
|
||||
}
|
||||
}
|
||||
if (langSettings != settings) {
|
||||
if (CommonCodeStyleSettings.WrapOnTyping.WRAP.intValue == langSettings.WRAP_ON_TYPING) {
|
||||
((ThreeStateCheckBox)myWrapOnTypingCheckBox).setState(ThreeStateCheckBox.State.SELECTED);
|
||||
}
|
||||
else if (CommonCodeStyleSettings.WrapOnTyping.NO_WRAP.intValue == langSettings.WRAP_ON_TYPING) {
|
||||
((ThreeStateCheckBox)myWrapOnTypingCheckBox).setState(ThreeStateCheckBox.State.NOT_SELECTED);
|
||||
}
|
||||
else {
|
||||
((ThreeStateCheckBox)myWrapOnTypingCheckBox).setState(ThreeStateCheckBox.State.DONT_CARE);
|
||||
}
|
||||
}
|
||||
else {
|
||||
((ThreeStateCheckBox)myWrapOnTypingCheckBox)
|
||||
.setState(settings.isWrapOnTyping(myLanguage) ? ThreeStateCheckBox.State.SELECTED : ThreeStateCheckBox.State.NOT_SELECTED);
|
||||
myWrapOnTypingCheckBox.setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
public void apply(@NotNull CodeStyleSettings settings) {
|
||||
@@ -107,26 +88,17 @@ public class RightMarginForm {
|
||||
else {
|
||||
langSettings.RIGHT_MARGIN = getFieldRightMargin(settings.getDefaultRightMargin());
|
||||
}
|
||||
langSettings.WRAP_ON_TYPING = getWrapOnTypingIntValue();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isModified(@NotNull CodeStyleSettings settings) {
|
||||
CommonCodeStyleSettings langSettings = settings.getCommonSettings(myLanguage);
|
||||
boolean isRightMarginChanged =
|
||||
myDefaultGeneralCheckBox.isSelected() ?
|
||||
langSettings.RIGHT_MARGIN >= 0 :
|
||||
langSettings.RIGHT_MARGIN != getFieldRightMargin(settings.getDefaultRightMargin());
|
||||
return isRightMarginChanged || getWrapOnTypingIntValue() != langSettings.WRAP_ON_TYPING;
|
||||
}
|
||||
|
||||
private int getWrapOnTypingIntValue() {
|
||||
ThreeStateCheckBox.State state = ((ThreeStateCheckBox)myWrapOnTypingCheckBox).getState();
|
||||
return
|
||||
ThreeStateCheckBox.State.SELECTED.equals(state) ? CommonCodeStyleSettings.WrapOnTyping.WRAP.intValue :
|
||||
ThreeStateCheckBox.State.NOT_SELECTED.equals(state) ? CommonCodeStyleSettings.WrapOnTyping.NO_WRAP.intValue :
|
||||
CommonCodeStyleSettings.WrapOnTyping.UNDEFINED.intValue;
|
||||
|
||||
if (myDefaultGeneralCheckBox.isSelected()) {
|
||||
return langSettings.RIGHT_MARGIN >= 0;
|
||||
}
|
||||
else {
|
||||
return langSettings.RIGHT_MARGIN != getFieldRightMargin(settings.getDefaultRightMargin());
|
||||
}
|
||||
}
|
||||
|
||||
private int getFieldRightMargin(int fallBackValue) {
|
||||
@@ -145,8 +117,4 @@ public class RightMarginForm {
|
||||
public JPanel getTopPanel() {
|
||||
return myTopPanel;
|
||||
}
|
||||
|
||||
private void createUIComponents() {
|
||||
myWrapOnTypingCheckBox = new ThreeStateCheckBox(ApplicationBundle.message("wrapping.wrap.on.typing"));
|
||||
}
|
||||
}
|
||||
|
||||
-19
@@ -17,7 +17,6 @@ package com.intellij.application.options.codeStyle;
|
||||
|
||||
import com.intellij.openapi.application.ApplicationBundle;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettings;
|
||||
import com.intellij.psi.codeStyle.CommonCodeStyleSettings;
|
||||
import com.intellij.psi.codeStyle.LanguageCodeStyleSettingsProvider;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.containers.MultiMap;
|
||||
@@ -59,27 +58,9 @@ public class WrappingAndBracesPanel extends OptionTableWithPreviewPanel {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addOption(@NotNull String fieldName,
|
||||
@NotNull String title,
|
||||
@Nullable String groupName,
|
||||
int minValue,
|
||||
int maxValue,
|
||||
int defaultValue,
|
||||
String defaultValueText) {
|
||||
super.addOption(fieldName, title, groupName, minValue, maxValue, defaultValue, defaultValueText);
|
||||
if (groupName != null) {
|
||||
myGroupToFields.putValue(groupName, fieldName);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initTables() {
|
||||
addOption("RIGHT_MARGIN", ApplicationBundle.message("editbox.right.margin.columns"), null, 0, 999, -1, ApplicationBundle.message("settings.code.style.default.general"));
|
||||
addOption("WRAP_ON_TYPING", ApplicationBundle.message("wrapping.wrap.on.typing"), null,
|
||||
CommonCodeStyleSettings.WrapOnTyping.UNDEFINED.intValue,
|
||||
CommonCodeStyleSettings.WrapOnTyping.NO_WRAP.intValue,
|
||||
CommonCodeStyleSettings.WrapOnTyping.WRAP.intValue);
|
||||
|
||||
addOption("KEEP_LINE_BREAKS", ApplicationBundle.message("wrapping.keep.line.breaks"), WRAPPING_KEEP);
|
||||
addOption("KEEP_FIRST_COLUMN_COMMENT", ApplicationBundle.message("wrapping.keep.comment.at.first.column"), WRAPPING_KEEP);
|
||||
|
||||
+1
-2
@@ -17,7 +17,6 @@ package com.intellij.codeInsight.editorActions;
|
||||
|
||||
import com.intellij.codeInsight.template.TemplateManager;
|
||||
import com.intellij.formatting.FormatConstants;
|
||||
import com.intellij.lang.Language;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.formatter.WhiteSpaceFormattingStrategy;
|
||||
import com.intellij.ide.DataManager;
|
||||
@@ -48,7 +47,7 @@ public class AutoHardWrapHandler {
|
||||
/**
|
||||
* This key is used as a flag that indicates if <code>'auto wrap line on typing'</code> activity is performed now.
|
||||
*
|
||||
* @see CodeStyleSettings#isWrapOnTyping(Language)
|
||||
* @see CodeStyleSettings#WRAP_WHEN_TYPING_REACHES_RIGHT_MARGIN
|
||||
*/
|
||||
public static final Key<Boolean> AUTO_WRAP_LINE_IN_PROGRESS_KEY = new Key<Boolean>("AUTO_WRAP_LINE_IN_PROGRESS");
|
||||
|
||||
|
||||
@@ -74,17 +74,10 @@ public class CodeStyleFacadeImpl extends CodeStyleFacade {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public boolean isWrapWhenTypingReachesRightMargin() {
|
||||
//noinspection deprecation
|
||||
return CodeStyleSettingsManager.getSettings(myProject).WRAP_WHEN_TYPING_REACHES_RIGHT_MARGIN;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWrapOnTyping(@Nullable Language language) {
|
||||
return CodeStyleSettingsManager.getSettings(myProject).isWrapOnTyping(language);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTabSize(final FileType fileType) {
|
||||
return CodeStyleSettingsManager.getSettings(myProject).getTabSize(fileType);
|
||||
|
||||
@@ -56,17 +56,8 @@ public abstract class CodeStyleFacade {
|
||||
|
||||
public abstract int getRightMargin(Language language);
|
||||
|
||||
/**
|
||||
* @return True if wrap on typing is enabled
|
||||
* @deprecated Use isWrapOnTyping(language) instead
|
||||
*/
|
||||
public abstract boolean isWrapWhenTypingReachesRightMargin();
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public boolean isWrapOnTyping(@Nullable Language language) {
|
||||
return isWrapWhenTypingReachesRightMargin();
|
||||
}
|
||||
|
||||
public abstract int getTabSize(final FileType fileType);
|
||||
|
||||
public abstract boolean useTabCharacter(final FileType fileType);
|
||||
|
||||
@@ -213,7 +213,7 @@ public class SettingsImpl implements EditorSettings {
|
||||
public boolean isWrapWhenTypingReachesRightMargin(Project project) {
|
||||
return myWrapWhenTypingReachesRightMargin != null ?
|
||||
myWrapWhenTypingReachesRightMargin.booleanValue() :
|
||||
CodeStyleFacade.getInstance(project).isWrapOnTyping(myLanguage);
|
||||
CodeStyleFacade.getInstance(project).isWrapWhenTypingReachesRightMargin();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -223,7 +223,6 @@ wrapping.long.lines=Ensure right margin is not exceeded
|
||||
wrapping.comments=Comments
|
||||
wrapping.comments.wrap.at.right.margin=Wrap at right margin
|
||||
wrapping.annotation.parameters=Annotation parameters
|
||||
wrapping.wrap.on.typing=Wrap on typing
|
||||
|
||||
checkbox.align.multiline.chained.methods=Chained methods
|
||||
checkbox.align.multiline.method.parameters=Method parameters
|
||||
|
||||
@@ -32,9 +32,9 @@ public class PyWrapTest extends PyTestCase {
|
||||
super.setUp();
|
||||
final CodeStyleSettings settings = CodeStyleSettingsManager.getInstance(myFixture.getProject()).getCurrentSettings();
|
||||
final CommonCodeStyleSettings pythonSettings = settings.getCommonSettings(PythonLanguage.getInstance());
|
||||
myOldWrap = settings.isWrapOnTyping(PythonLanguage.getInstance());
|
||||
myOldWrap = settings.WRAP_WHEN_TYPING_REACHES_RIGHT_MARGIN;
|
||||
myOldMargin = pythonSettings.RIGHT_MARGIN;
|
||||
settings.setWrapOnTyping(PythonLanguage.getInstance(), true);
|
||||
settings.WRAP_WHEN_TYPING_REACHES_RIGHT_MARGIN = true;
|
||||
pythonSettings.RIGHT_MARGIN = 80;
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ public class PyWrapTest extends PyTestCase {
|
||||
protected void tearDown() throws Exception {
|
||||
final CodeStyleSettings settings = CodeStyleSettingsManager.getInstance(myFixture.getProject()).getCurrentSettings();
|
||||
final CommonCodeStyleSettings pythonSettings = settings.getCommonSettings(PythonLanguage.getInstance());
|
||||
settings.setWrapOnTyping(PythonLanguage.getInstance(), myOldWrap);
|
||||
settings.WRAP_WHEN_TYPING_REACHES_RIGHT_MARGIN = myOldWrap;
|
||||
pythonSettings.RIGHT_MARGIN = myOldMargin;
|
||||
super.tearDown();
|
||||
}
|
||||
@@ -76,9 +76,9 @@ public class PyWrapTest extends PyTestCase {
|
||||
final CodeStyleSettings settings = CodeStyleSettingsManager.getInstance(myFixture.getProject()).getCurrentSettings();
|
||||
final CommonCodeStyleSettings pythonSettings = settings.getCommonSettings(PythonLanguage.getInstance());
|
||||
int oldValue = pythonSettings.RIGHT_MARGIN;
|
||||
boolean oldMarginValue = settings.isWrapOnTyping(PythonLanguage.getInstance());
|
||||
boolean oldMarginValue = settings.WRAP_WHEN_TYPING_REACHES_RIGHT_MARGIN;
|
||||
pythonSettings.RIGHT_MARGIN = 100;
|
||||
settings.setWrapOnTyping(PythonLanguage.getInstance(), true);
|
||||
settings.WRAP_WHEN_TYPING_REACHES_RIGHT_MARGIN = true;
|
||||
try {
|
||||
final String testName = "wrap/" + getTestName(true);
|
||||
myFixture.configureByFile(testName + ".py");
|
||||
@@ -89,7 +89,7 @@ public class PyWrapTest extends PyTestCase {
|
||||
}
|
||||
finally {
|
||||
pythonSettings.RIGHT_MARGIN = oldValue;
|
||||
settings.setWrapOnTyping(PythonLanguage.getInstance(), oldMarginValue);
|
||||
settings.WRAP_WHEN_TYPING_REACHES_RIGHT_MARGIN = oldMarginValue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,6 @@ public class HtmlLanguageCodeStyleSettings extends LanguageCodeStyleSettingsProv
|
||||
@NotNull SettingsType settingsType) {
|
||||
if (settingsType == SettingsType.WRAPPING_AND_BRACES_SETTINGS) {
|
||||
consumer.showStandardOptions("RIGHT_MARGIN");
|
||||
consumer.showStandardOptions("WRAP_ON_TYPING");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
-1
@@ -46,7 +46,6 @@ public class XmlLanguageCodeStyleSettingsProvider extends LanguageCodeStyleSetti
|
||||
@NotNull SettingsType settingsType) {
|
||||
if (settingsType == SettingsType.WRAPPING_AND_BRACES_SETTINGS) {
|
||||
consumer.showStandardOptions("RIGHT_MARGIN");
|
||||
consumer.showStandardOptions("WRAP_ON_TYPING");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ public class XmlEditorTest extends LightCodeInsightTestCase {
|
||||
"</svg>");
|
||||
|
||||
CodeStyleSettings clone = CodeStyleSettingsManager.getInstance(getProject()).getCurrentSettings().clone();
|
||||
clone.setWrapOnTyping(null, true);
|
||||
clone.WRAP_WHEN_TYPING_REACHES_RIGHT_MARGIN = true;
|
||||
try {
|
||||
CodeStyleSettingsManager.getInstance(getProject()).setTemporarySettings(clone);
|
||||
EditorTestUtil.performTypingAction(getEditor(), 'x');
|
||||
@@ -77,7 +77,7 @@ public class XmlEditorTest extends LightCodeInsightTestCase {
|
||||
"<!-- Some very long and informative xml comment to trigger hard wrapping indeed. Too short? Dave, let me ask you something. Are hard wraps working? What do we live for? What ice-cream do you like? Who am I?????????????????????????????????????????????????????????????????????????????????????????????????<caret>-->");
|
||||
|
||||
CodeStyleSettings clone = CodeStyleSettingsManager.getInstance(getProject()).getCurrentSettings().clone();
|
||||
clone.setWrapOnTyping(null, true);
|
||||
clone.WRAP_WHEN_TYPING_REACHES_RIGHT_MARGIN = true;
|
||||
try {
|
||||
CodeStyleSettingsManager.getInstance(getProject()).setTemporarySettings(clone);
|
||||
EditorTestUtil.performTypingAction(getEditor(), '?');
|
||||
|
||||
Reference in New Issue
Block a user