introduced REFORMAT_BLOCK_ON_RBRACE property

This commit is contained in:
Maxim.Mossienko
2014-02-24 11:18:37 +01:00
parent 2d4efe722c
commit 46061a034b
6 changed files with 25 additions and 12 deletions
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.application.options.editor.EditorSmartKeysConfigurable">
<grid id="27dc6" binding="myRootPanel" layout-manager="GridLayoutManager" row-count="10" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="0">
<grid id="27dc6" binding="myRootPanel" layout-manager="GridLayoutManager" row-count="11" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="0">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<xy x="20" y="20" width="500" height="400"/>
@@ -10,7 +10,7 @@
<children>
<vspacer id="a9cd">
<constraints>
<grid row="9" 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="10" 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="18e81" class="javax.swing.JCheckBox" binding="myCbSmartHome">
@@ -51,7 +51,7 @@
</component>
<component id="278d0" class="javax.swing.JCheckBox" binding="myCbCamelWords">
<constraints>
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="messages/ApplicationBundle" key="checkbox.use.camelhumps.words"/>
@@ -60,7 +60,7 @@
<grid id="6ebf" layout-manager="GridLayoutManager" row-count="1" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="5" right="5"/>
<constraints>
<grid row="7" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="3" anchor="1" fill="3" indent="0" use-parent-layout="false"/>
<grid row="8" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="3" anchor="1" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
@@ -88,7 +88,7 @@
</grid>
<grid id="b08a8" binding="myAddonPanel" layout-manager="GridBagLayout">
<constraints>
<grid row="8" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="8" fill="2" indent="0" use-parent-layout="false"/>
<grid row="9" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="8" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
@@ -97,7 +97,7 @@
<grid id="5344e" layout-manager="GridLayoutManager" row-count="3" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="6" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
<grid row="7" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<clientProperties>
@@ -135,17 +135,26 @@
</grid>
<hspacer id="6cc57">
<constraints>
<grid row="6" column="1" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
<grid row="7" column="1" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
<component id="158ea" class="javax.swing.JCheckBox" binding="myCbSurroundSelectionOnTyping" default-binding="true">
<constraints>
<grid row="5" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="6" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Surround selection on typing quote or brace"/>
</properties>
</component>
<component id="a64de" class="javax.swing.JCheckBox" binding="myCbReformatBlockOnTypingRBrace">
<constraints>
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<selected value="true"/>
<text resource-bundle="messages/ApplicationBundle" key="checkbox.reformat.on.typing.rbrace"/>
</properties>
</component>
</children>
</grid>
</form>
@@ -62,6 +62,7 @@ public class EditorSmartKeysConfigurable extends CompositeConfigurable<UnnamedCo
private JCheckBox myCbInsertPairCurlyBraceOnEnter;
private JCheckBox myCbInsertJavadocStubOnEnter;
private JCheckBox myCbSurroundSelectionOnTyping;
private JCheckBox myCbReformatBlockOnTypingRBrace;
private boolean myAddonsInitialized = false;
private static final String NO_REFORMAT = ApplicationBundle.message("combobox.paste.reformat.none");
@@ -154,6 +155,7 @@ public class EditorSmartKeysConfigurable extends CompositeConfigurable<UnnamedCo
myCbInsertPairBracket.setSelected(codeInsightSettings.AUTOINSERT_PAIR_BRACKET);
myCbInsertPairQuote.setSelected(codeInsightSettings.AUTOINSERT_PAIR_QUOTE);
myCbReformatBlockOnTypingRBrace.setSelected(codeInsightSettings.REFORMAT_BLOCK_ON_RBRACE);
myCbCamelWords.setSelected(editorSettings.isCamelWords());
myCbSurroundSelectionOnTyping.setSelected(codeInsightSettings.SURROUND_SELECTION_ON_QUOTE_TYPED);
@@ -173,6 +175,7 @@ public class EditorSmartKeysConfigurable extends CompositeConfigurable<UnnamedCo
codeInsightSettings.JAVADOC_STUB_ON_ENTER = myCbInsertJavadocStubOnEnter.isSelected();
codeInsightSettings.AUTOINSERT_PAIR_BRACKET = myCbInsertPairBracket.isSelected();
codeInsightSettings.AUTOINSERT_PAIR_QUOTE = myCbInsertPairQuote.isSelected();
codeInsightSettings.REFORMAT_BLOCK_ON_RBRACE = myCbReformatBlockOnTypingRBrace.isSelected();
codeInsightSettings.SURROUND_SELECTION_ON_QUOTE_TYPED = myCbSurroundSelectionOnTyping.isSelected();
editorSettings.setCamelWords(myCbCamelWords.isSelected());
codeInsightSettings.REFORMAT_ON_PASTE = getReformatPastedBlockValue();
@@ -196,6 +199,7 @@ public class EditorSmartKeysConfigurable extends CompositeConfigurable<UnnamedCo
isModified |= isModified(myCbInsertPairBracket, codeInsightSettings.AUTOINSERT_PAIR_BRACKET);
isModified |= isModified(myCbInsertPairQuote, codeInsightSettings.AUTOINSERT_PAIR_QUOTE);
isModified |= isModified(myCbReformatBlockOnTypingRBrace, codeInsightSettings.REFORMAT_BLOCK_ON_RBRACE);
isModified |= isModified(myCbCamelWords, editorSettings.isCamelWords());
isModified |= isModified(myCbSurroundSelectionOnTyping, codeInsightSettings.SURROUND_SELECTION_ON_QUOTE_TYPED);
@@ -111,6 +111,7 @@ public class CodeInsightSettings implements PersistentStateComponent<Element>, C
public boolean AUTOINSERT_PAIR_BRACKET = true;
public boolean AUTOINSERT_PAIR_QUOTE = true;
public boolean REFORMAT_BLOCK_ON_RBRACE = true;
public int REFORMAT_ON_PASTE = INDENT_EACH_LINE;
public static final int NO_REFORMAT = 1;
@@ -45,7 +45,6 @@ import com.intellij.openapi.fileTypes.FileTypes;
import com.intellij.openapi.fileTypes.LanguageFileType;
import com.intellij.openapi.fileTypes.PlainTextLanguage;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.psi.PsiDocumentManager;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
@@ -584,7 +583,7 @@ public class TypedHandler extends TypedActionHandlerBase {
final boolean isBrace = braceMatcher.isLBraceToken(iterator, chars, fileType) || rBraceToken;
int lBraceOffset = -1;
if (Registry.is("typing.rbrace.reformats.block") &&
if (CodeInsightSettings.getInstance().REFORMAT_BLOCK_ON_RBRACE &&
rBraceToken &&
braceMatcher.isStructuralBrace(iterator, chars, fileType) && offset > 0) {
lBraceOffset = BraceMatchingUtil.findLeftLParen(
@@ -629,4 +629,5 @@ settings.code.style.general.formatter.marker.invalid.regexp=Invalid regular expr
settings.code.style.general.formatter.marker.title=Markers
settings.code.style.general.formatter.marker.options.title=Options
import.scheme.chooser.source=From\:
import.scheme.chooser.destination=To\:
import.scheme.chooser.destination=To\:
checkbox.reformat.on.typing.rbrace=Reformat block on typing '}'
@@ -365,7 +365,6 @@ ide.open.file.in.temp.project.dir.description=Enables opening file in temp proje
editor.allow.multiple.carets=false
embed.scene.builder=false
typing.rbrace.reformats.block=true
dsm.retina.darcula.legend=false
dsm.retina.darcula.legend.description=Experimental DSM legend component