From 46061a034bcbf8302d29a1764325bce7363222d9 Mon Sep 17 00:00:00 2001 From: "Maxim.Mossienko" Date: Mon, 24 Feb 2014 11:16:52 +0100 Subject: [PATCH] introduced REFORMAT_BLOCK_ON_RBRACE property --- .../editor/EditorSmartKeysConfigurable.form | 25 +++++++++++++------ .../editor/EditorSmartKeysConfigurable.java | 4 +++ .../codeInsight/CodeInsightSettings.java | 1 + .../editorActions/TypedHandler.java | 3 +-- .../src/messages/ApplicationBundle.properties | 3 ++- .../src/misc/registry.properties | 1 - 6 files changed, 25 insertions(+), 12 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/application/options/editor/EditorSmartKeysConfigurable.form b/platform/lang-impl/src/com/intellij/application/options/editor/EditorSmartKeysConfigurable.form index 4dc3d103cc51..9c73a83ed92a 100644 --- a/platform/lang-impl/src/com/intellij/application/options/editor/EditorSmartKeysConfigurable.form +++ b/platform/lang-impl/src/com/intellij/application/options/editor/EditorSmartKeysConfigurable.form @@ -1,6 +1,6 @@
- + @@ -10,7 +10,7 @@ - + @@ -51,7 +51,7 @@ - + @@ -60,7 +60,7 @@ - + @@ -88,7 +88,7 @@ - + @@ -97,7 +97,7 @@ - + @@ -135,17 +135,26 @@ - + - + + + + + + + + + + diff --git a/platform/lang-impl/src/com/intellij/application/options/editor/EditorSmartKeysConfigurable.java b/platform/lang-impl/src/com/intellij/application/options/editor/EditorSmartKeysConfigurable.java index 37408febc6bb..daada36ed175 100644 --- a/platform/lang-impl/src/com/intellij/application/options/editor/EditorSmartKeysConfigurable.java +++ b/platform/lang-impl/src/com/intellij/application/options/editor/EditorSmartKeysConfigurable.java @@ -62,6 +62,7 @@ public class EditorSmartKeysConfigurable extends CompositeConfigurable, 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; diff --git a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/TypedHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/TypedHandler.java index 044e621edf34..73fece700a27 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/TypedHandler.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/TypedHandler.java @@ -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( diff --git a/platform/platform-resources-en/src/messages/ApplicationBundle.properties b/platform/platform-resources-en/src/messages/ApplicationBundle.properties index 89e0f4e99ca0..a7c02e6cba90 100644 --- a/platform/platform-resources-en/src/messages/ApplicationBundle.properties +++ b/platform/platform-resources-en/src/messages/ApplicationBundle.properties @@ -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\: \ No newline at end of file +import.scheme.chooser.destination=To\: +checkbox.reformat.on.typing.rbrace=Reformat block on typing '}' \ No newline at end of file diff --git a/platform/platform-resources-en/src/misc/registry.properties b/platform/platform-resources-en/src/misc/registry.properties index ead490913d66..46bc20de8193 100644 --- a/platform/platform-resources-en/src/misc/registry.properties +++ b/platform/platform-resources-en/src/misc/registry.properties @@ -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