Merge commit 'origin/master' into changeSignature
authorMaxim Medvedev <maxim.medvedev@jetbrains.com>
Thu, 22 Apr 2010 12:47:15 +0000 (16:47 +0400)
committerMaxim Medvedev <maxim.medvedev@jetbrains.com>
Thu, 22 Apr 2010 12:47:15 +0000 (16:47 +0400)
Conflicts:
java/java-impl/src/com/intellij/refactoring/changeSignature/ChangeSignatureTargetUtil.java
plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/changeSignature/GrChangeSignatureHandler.java

34 files changed:
1  2 
java/java-impl/src/com/intellij/codeInsight/editorActions/JavaTypedHandler.java
java/java-impl/src/com/intellij/psi/impl/source/codeStyle/JavaCodeStyleManagerImpl.java
java/java-impl/src/com/intellij/refactoring/changeSignature/ChangeSignatureDialog.java
java/java-impl/src/com/intellij/refactoring/introduceField/IntroduceConstantHandler.java
java/java-tests/testData/codeInsight/javadocIG/ideadev2326.java
java/java-tests/testData/inspection/redundantTypeArgs/ReturnPrimitiveTypes.java
java/java-tests/testData/psi/formatter/java/SCR11799.java
java/java-tests/testData/psi/formatter/java/SCR11799_after.java
java/java-tests/testData/refactoring/changeSignatureTarget/inTypeArguments.java
java/java-tests/testSrc/com/intellij/psi/formatter/JavaFormatterTest.java
java/java-tests/testSrc/com/intellij/refactoring/MakeClassStaticTest.java
platform/lang-api/src/com/intellij/psi/impl/ElementBase.java
platform/lang-impl/src/com/intellij/execution/console/LanguageConsoleImpl.java
platform/lvcs-impl/src/com/intellij/history/core/storage/StreamUtil.java
platform/lvcs-impl/testSrc/com/intellij/historyIntegrTests/FileListeningTest.java
platform/platform-api/src/com/intellij/ui/content/ContentManager.java
platform/platform-api/src/com/intellij/util/ui/EmptyTextHelper.java
platform/platform-impl/src/com/intellij/openapi/diff/ex/DiffStatusBar.java
platform/platform-impl/src/com/intellij/openapi/diff/impl/DiffPanelImpl.java
platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorTabbedContainer.java
platform/platform-impl/src/com/intellij/openapi/wm/impl/FocusManagerImpl.java
platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowHeadlessManagerImpl.java
platform/platform-resources/src/META-INF/LangExtensionPoints.xml
plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/MavenDomUtil.java
plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/generate/GenerateAddManagedDependencyAction.java
plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/inspections/MavenModelInspection.java
plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/refactorings/extract/ExtractDependenciesAction.java
plugins/maven/src/main/java/org/jetbrains/idea/maven/embedder/MavenEmbedderUtilEx.java
plugins/maven/src/main/java/org/jetbrains/idea/maven/indices/MavenIndicesManager.java
plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenArtifact.java
plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenEnvironmentForm.java
plugins/maven/src/test/java/org/jetbrains/idea/maven/embedder/MavenEmbedderWrapperTest.java
resources/src/META-INF/IdeaPlugin.xml
xml/dom-impl/src/com/intellij/util/xml/impl/DomCompletionContributor.java

index b0480784f5e396ea060290f9ae8a8f158cad2820,c2fc297644942ac8da0ddf889fe6661181491d63..ed973012cfdf7c6528bb40a041bf1e8f6acb56cc
@@@ -22,8 -22,8 +22,8 @@@ import com.intellij.openapi.application
  import com.intellij.openapi.command.CommandProcessor;
  import com.intellij.openapi.command.UndoConfirmationPolicy;
  import com.intellij.openapi.editor.Editor;
--import com.intellij.openapi.editor.ScrollType;
  import com.intellij.openapi.editor.EditorModificationUtil;
++import com.intellij.openapi.editor.ScrollType;
  import com.intellij.openapi.editor.ex.EditorEx;
  import com.intellij.openapi.editor.highlighter.HighlighterIterator;
  import com.intellij.openapi.fileTypes.FileType;
index 4b57acbde0282dd2b127f7103564e7d14e050f86,2649502498b26ed97191be363067aa8711c0232b..c2fee31d935a65a752366256aca1c19a63630d91
@@@ -37,6 -37,6 +37,7 @@@ import com.intellij.refactoring.util.oc
  import com.intellij.refactoring.util.occurences.OccurenceManager;
  import org.jetbrains.annotations.NotNull;
  import org.jetbrains.annotations.Nullable;
++
  import java.util.ArrayList;
  
  public class IntroduceConstantHandler extends BaseExpressionToFieldHandler {
index 0000000000000000000000000000000000000000,ba8b065e36f8191e695bac348052bddbe3b5875c..fc2f6099dab5a58481291d0f5dd9d79564a1779d
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,12 +1,14 @@@
 -import java.io.*;
++import java.io.EOFException;
++import java.io.IOException;
++import java.io.InterruptedIOException;
+ public interface Idea4780 {
+     /**
+      * @throws IOException if an I/O error occurs while reading.
+      * @throws EOFException if this source is already closed when the <code>read()</code> is called,
+      * or is closed during the <code>read()</code>.
+      * @throws InterruptedIOException if the reading thread is interrupted.
+      */
+     public Object read()
+         throws IOException;
+ }
index 0000000000000000000000000000000000000000,d05c729a67283cf90ee9bb16562b978952b9050b..77c3b52c6e5ea618ba336567ea3bc93658619909
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,12 +1,12 @@@
 -import java.util.*;
++import java.util.Map;
+ class Test {
+   Map someMap;
+   public int getGetBar() {
+     return this.<Integer>getFoo("numberOfConfigurations");
+   }
+   protected <T> T getFoo(String key) {
+     return (T)someMap.get(key);
+   }
+ }
index 0000000000000000000000000000000000000000,e03ec173791d980a8f26ecce7d6aae3dd25172af..5d1f3536ece2d8a8665cf1269c3753e3ec7ae0d6
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,72 +1,73 @@@
 -import javax.sql.DataSource;
 -import org.springframework.jdbc.core.JdbcTemplate;
+ package br.com.vivo.torpedeiro.pull.impl;
+ import br.com.vivo.torpedeiro.pull.MensagemPull;
+ import br.com.vivo.torpedeiro.pull.PullDAO;
++import org.springframework.jdbc.core.JdbcTemplate;
++
++import javax.sql.DataSource;
+ /**
+  * Implementa? padr?de {@link PullDAO} que realiza todas as opera?s utilizando SQL atrav?de um {@link
+  * JdbcTemplate} do Spring Framework.
+  *
+  * @author Marcus Brito
+  */
+ public class PullDAOJdbcTemplate implements PullDAO
+ {
+     private static final int STATUS_INICIAL = -7;
+     private JdbcTemplate template;
+     public String buscarURLProvedor(String provedor)
+     {
+         String sql = "SELECT url FROM pull_url WHERE provedor = ?";
+         return (String) template.queryForObject(sql, new Object[]{provedor}, String.class);
+     }
+     public Long inserirMensagemHistorico(MensagemPull mensagem)
+     {
+         String sql = "" +
+             "INSERT INTO pull_historico (\n" +
+             "    id_log,\n" +
+             "    provedor,\n" +
+             "    origem,\n" +
+             "    destino,\n" +
+             "    msg_originada,\n" +
+             "    cod_erro,\n" +
+             "    dt_recepcao\n" +
+             ") VALUES (?, ?, ?, ?, ?, ?, sysdate)";
+         Long id = buscarProximoID();
+         template.update(sql, new Object[]{id, mensagem.getCodigoProvedor(),
+                 mensagem.getMensagemOriginal().getOrigem(), mensagem.getMensagemOriginal().getDestino(),
+                 mensagem.getMensagemOriginal().getMensagem(), STATUS_INICIAL});
+         return id;
+     }
+     public void atualizarMensagemHistorico(Long id, int status, String mensagem)
+     {
+         String sql = "" +
+             "UPDATE pull_historico\n" +
+             "   SET cod_erro     = ?,\n" +
+             "       msg_recebida = ?,\n" +
+             "       dt_resposta  = SYSDATE\n" +
+             " WHERE id_log       = ?";
+         template.update(sql, new Object[]{status, mensagem, id});
+     }
+     private long buscarProximoID()
+     {
+         return template.queryForLong("SELECT seq_id_log.nextval FROM dual");
+     }
+     /**
+      * @param ds O DataSource utilizado para acesso ao banco de dados.
+      */
+     public void setDataSource(DataSource ds)
+     {
+         this.template = new JdbcTemplate(ds);
+     }
+ }
index 0000000000000000000000000000000000000000,f1bafa68a6880db3bf55aca578c2f3624ce972e5..1dfffd11b964bc8daa3fe74532d7cf1a782dc8de
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,73 +1,73 @@@
 -import javax.sql.DataSource;
 -
 -import org.springframework.jdbc.core.JdbcTemplate;
+ package br.com.vivo.torpedeiro.pull.impl;
+ import br.com.vivo.torpedeiro.pull.MensagemPull;
+ import br.com.vivo.torpedeiro.pull.PullDAO;
++import org.springframework.jdbc.core.JdbcTemplate;
++
++import javax.sql.DataSource;
+ /**
+  * Implementa? padr?de {@link PullDAO} que realiza todas as opera?s utilizando SQL atrav?de um {@link
+  * JdbcTemplate} do Spring Framework.
+  *
+  * @author Marcus Brito
+  */
+ public class PullDAOJdbcTemplate implements PullDAO
+ {
+     private static final int STATUS_INICIAL = -7;
+     private JdbcTemplate template;
+     public String buscarURLProvedor(String provedor)
+     {
+         String sql = "SELECT url FROM pull_url WHERE provedor = ?";
+         return (String) template.queryForObject(sql, new Object[]{provedor}, String.class);
+     }
+     public Long inserirMensagemHistorico(MensagemPull mensagem)
+     {
+         String sql = "" +
+             "INSERT INTO pull_historico (\n" +
+             "    id_log,\n" +
+             "    provedor,\n" +
+             "    origem,\n" +
+             "    destino,\n" +
+             "    msg_originada,\n" +
+             "    cod_erro,\n" +
+             "    dt_recepcao\n" +
+             ") VALUES (?, ?, ?, ?, ?, ?, sysdate)";
+         Long id = buscarProximoID();
+         template.update(sql, new Object[]{id, mensagem.getCodigoProvedor(),
+             mensagem.getMensagemOriginal().getOrigem(), mensagem.getMensagemOriginal().getDestino(),
+             mensagem.getMensagemOriginal().getMensagem(), STATUS_INICIAL});
+         return id;
+     }
+     public void atualizarMensagemHistorico(Long id, int status, String mensagem)
+     {
+         String sql = "" +
+             "UPDATE pull_historico\n" +
+             "   SET cod_erro     = ?,\n" +
+             "       msg_recebida = ?,\n" +
+             "       dt_resposta  = SYSDATE\n" +
+             " WHERE id_log       = ?";
+         template.update(sql, new Object[]{status, mensagem, id});
+     }
+     private long buscarProximoID()
+     {
+         return template.queryForLong("SELECT seq_id_log.nextval FROM dual");
+     }
+     /**
+      * @param ds O DataSource utilizado para acesso ao banco de dados.
+      */
+     public void setDataSource(DataSource ds)
+     {
+         this.template = new JdbcTemplate(ds);
+     }
+ }
index d0fb0a13392e8fe36e3d3ffbf0fe9bb30ebc67d8,088e9bbcc97dab0f19f68b5bcc5ce017f22634d7..b7332ce8e2a782bd7c8e49a7e7d4a662dbf380e8
@@@ -1,5 -1,7 +1,6 @@@
--import java.util.*;
  class A1<T> {
+   A1(){}
    public static void main(String[] args) {
  
      Callable<Object> callable = new Callable<Object>() {
index 0000000000000000000000000000000000000000,170bee46703c59ff0a3d09c3f0f47965dabf737c..2408a6d3c9e21e7063bb749dde4f331ae15ff6df
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,3391 +1,3390 @@@
 -import com.intellij.openapi.application.ex.PathManagerEx;
+ package com.intellij.psi.formatter;
+ import com.intellij.JavaTestUtil;
+ import com.intellij.openapi.application.ApplicationManager;
+ import com.intellij.openapi.command.CommandProcessor;
+ import com.intellij.openapi.editor.Document;
+ import com.intellij.openapi.editor.EditorFactory;
+ import com.intellij.openapi.editor.ex.DocumentEx;
+ import com.intellij.openapi.editor.impl.DocumentImpl;
+ import com.intellij.openapi.fileTypes.StdFileTypes;
+ import com.intellij.openapi.roots.LanguageLevelProjectExtension;
+ import com.intellij.openapi.util.TextRange;
+ import com.intellij.openapi.util.io.FileUtil;
+ import com.intellij.openapi.util.text.StringUtil;
+ import com.intellij.pom.java.LanguageLevel;
+ import com.intellij.psi.*;
+ import com.intellij.psi.codeStyle.CodeStyleManager;
+ import com.intellij.psi.codeStyle.CodeStyleSettings;
+ import com.intellij.psi.codeStyle.CodeStyleSettingsManager;
+ import com.intellij.testFramework.LightIdeaTestCase;
+ import com.intellij.util.IncorrectOperationException;
+ import java.io.File;
+ @SuppressWarnings({"Deprecation"})
+ public class JavaFormatterTest extends LightIdeaTestCase {
+   private TextRange myTextRange;
+   private TextRange myLineRange;
+   private static final String BASE_PATH = JavaTestUtil.getJavaTestDataPath() + "/psi/formatter/java";
+   public void testSCR915() throws Exception {
+     getSettings().SPACE_AROUND_ADDITIVE_OPERATORS = false;
+     doTest("SCR915.java", "SCR915_after.java");
+   }
+   public void testForEach() throws Exception {
+     doTest("ForEach.java", "ForEach_after.java");
+   }
+   public void testDoubleCast() throws Exception {
+     doTest("DoubleCast.java", "DoubleCast_after.java");
+   }
+   public void test1() throws Exception {
+     myTextRange = new TextRange(35, 46);
+     doTest("1.java", "1_after.java");
+   }
+   public void testLabel1() throws Exception {
+     CodeStyleSettings settings = getSettings();
+     settings.LABELED_STATEMENT_WRAP = CodeStyleSettings.WRAP_ALWAYS;
+     settings.getIndentOptions(StdFileTypes.JAVA).LABEL_INDENT_ABSOLUTE = true;
+     settings.getIndentOptions(StdFileTypes.JAVA).LABEL_INDENT_SIZE = 0;
+     doTest("Label.java", "Label_after1.java");
+   }
+   public void testTryCatch() throws Exception {
+     myTextRange = new TextRange(38, 72);
+     doTest("TryCatch.java", "TryCatch_after.java");
+   }
+   public void testNullMethodParameter() throws Exception {
+     final CodeStyleSettings settings = getSettings();
+     settings.CALL_PARAMETERS_WRAP = CodeStyleSettings.WRAP_ALWAYS;
+     settings.ALIGN_MULTILINE_PARAMETERS_IN_CALLS = true;
+     doTest("NullMethodParameter.java", "NullMethodParameter_after.java");
+   }
+   public void testNew() throws Exception {
+     final CodeStyleSettings settings = getSettings();
+     settings.getIndentOptions(StdFileTypes.JAVA).CONTINUATION_INDENT_SIZE = 8;
+     doTest("New.java", "New_after.java");
+   }
+   public void testJavaDoc() throws Exception {
+     final CodeStyleSettings settings = getSettings();
+     settings.BLANK_LINES_AROUND_FIELD = 1;
+     doTest("JavaDoc.java", "JavaDoc_after.java");
+   }
+   public void testBreakInsideIf() throws Exception {
+     doTest("BreakInsideIf.java", "BreakInsideIf_after.java");
+   }
+   public void testAssert() throws Exception {
+     LanguageLevelProjectExtension.getInstance(getProject()).setLanguageLevel(LanguageLevel.HIGHEST);
+     doTest();
+   }
+   public void testCastInsideElse() throws Exception {
+     final CodeStyleSettings settings = getSettings();
+     final CodeStyleSettings.IndentOptions indentOptions = settings.getIndentOptions(StdFileTypes.JAVA);
+     indentOptions.CONTINUATION_INDENT_SIZE = 2;
+     indentOptions.INDENT_SIZE = 2;
+     indentOptions.LABEL_INDENT_SIZE = 0;
+     indentOptions.TAB_SIZE = 8;
+     settings.SPACE_WITHIN_CAST_PARENTHESES = false;
+     settings.SPACE_AFTER_TYPE_CAST = true;
+     settings.ALIGN_MULTILINE_PARENTHESIZED_EXPRESSION = true;
+     doTest();
+   }
+   public void testAlignMultiLine() throws Exception {
+     final CodeStyleSettings settings = getSettings();
+     settings.ALIGN_MULTILINE_PARENTHESIZED_EXPRESSION = true;
+     settings.ALIGN_MULTILINE_BINARY_OPERATION = true;
+     doTest();
+   }
+   public void testInnerClassAsParameter() throws Exception {
+     doTest();
+   }
+   public void testSynchronizedBlock() throws Exception {
+     final CodeStyleSettings settings = getSettings();
+     settings.SPACE_BEFORE_SYNCHRONIZED_PARENTHESES = false;
+     settings.SPACE_WITHIN_SYNCHRONIZED_PARENTHESES = false;
+     settings.SPACE_BEFORE_SYNCHRONIZED_LBRACE = false;
+     doTest();
+   }
+   public void testMethodCallInAssignment() throws Exception {
+     final CodeStyleSettings settings = getSettings();
+     settings.getIndentOptions(StdFileTypes.JAVA).CONTINUATION_INDENT_SIZE = 8;
+     doTest();
+   }
+   public void testAnonymousInnerClasses() throws Exception {
+     doTest();
+   }
+   public void testAnonymousInner2() throws Exception {
+     doTest();
+   }
+   public void testWrapAssertion() throws Exception {
+     doTest();
+   }
+   public void testIfElse() throws Exception {
+     final CodeStyleSettings settings = getSettings();
+     settings.IF_BRACE_FORCE = CodeStyleSettings.DO_NOT_FORCE;
+     settings.FOR_BRACE_FORCE = CodeStyleSettings.FORCE_BRACES_IF_MULTILINE;
+     settings.WHILE_BRACE_FORCE = CodeStyleSettings.FORCE_BRACES_IF_MULTILINE;
+     settings.DOWHILE_BRACE_FORCE = CodeStyleSettings.FORCE_BRACES_IF_MULTILINE;
+     settings.ELSE_ON_NEW_LINE = true;
+     settings.SPECIAL_ELSE_IF_TREATMENT = false;
+     settings.WHILE_ON_NEW_LINE = true;
+     settings.CATCH_ON_NEW_LINE = true;
+     settings.FINALLY_ON_NEW_LINE = true;
+     settings.ALIGN_MULTILINE_BINARY_OPERATION = true;
+     settings.ALIGN_MULTILINE_TERNARY_OPERATION = true;
+     settings.ALIGN_MULTILINE_ASSIGNMENT = true;
+     settings.ALIGN_MULTILINE_EXTENDS_LIST = true;
+     settings.ALIGN_MULTILINE_THROWS_LIST = true;
+     settings.ALIGN_MULTILINE_PARENTHESIZED_EXPRESSION = true;
+     settings.ALIGN_MULTILINE_FOR = true;
+     settings.ALIGN_MULTILINE_PARAMETERS_IN_CALLS = true;
+     settings.ALIGN_MULTILINE_PARAMETERS = true;
+     settings.KEEP_SIMPLE_BLOCKS_IN_ONE_LINE = true;
+     settings.WHILE_ON_NEW_LINE = true;
+     settings.BRACE_STYLE = CodeStyleSettings.END_OF_LINE;
+     doTest();
+   }
+   public void testIfBraces() throws Exception {
+     final CodeStyleSettings settings = getSettings();
+     settings.IF_BRACE_FORCE = CodeStyleSettings.FORCE_BRACES_ALWAYS;
+     settings.BRACE_STYLE = CodeStyleSettings.END_OF_LINE;
+     settings.KEEP_LINE_BREAKS = false;
+     doTest();
+   }
+   public void testTernaryExpression() throws Exception {
+     final CodeStyleSettings settings = getSettings();
+     settings.ALIGN_MULTILINE_TERNARY_OPERATION = true;
+     doTest();
+     settings.ALIGN_MULTILINE_TERNARY_OPERATION = false;
+     doTest("TernaryExpression.java", "TernaryExpression_DoNotAlign_after.java");
+   }
+   public void testAlignAssignment() throws Exception {
+     final CodeStyleSettings settings = getSettings();
+     settings.ALIGN_MULTILINE_ASSIGNMENT = true;
+     settings.ALIGN_MULTILINE_BINARY_OPERATION = true;
+     doTest();
+   }
+   public void testAlignFor() throws Exception {
+     final CodeStyleSettings settings = getSettings();
+     settings.ALIGN_MULTILINE_BINARY_OPERATION = true;
+     settings.ALIGN_MULTILINE_FOR = true;
+     doTest();
+   }
+   public void testChainedMethodsAlignment() throws Exception {
+     getSettings().ALIGN_MULTILINE_CHAINED_METHODS = true;
+     getSettings().METHOD_CALL_CHAIN_WRAP = CodeStyleSettings.WRAP_AS_NEEDED;
+     getSettings().getIndentOptions(StdFileTypes.JAVA).CONTINUATION_INDENT_SIZE = 8;
+     doTest();
+   }
+   public void testSwitch() throws Exception {
+     doTest();
+   }
+   public void testContinue() throws Exception {
+     doTest();
+   }
+   public void testIf() throws Exception {
+     final CodeStyleSettings settings = getSettings();
+     settings.BRACE_STYLE = CodeStyleSettings.NEXT_LINE;
+     doTest();
+     settings.BRACE_STYLE = CodeStyleSettings.END_OF_LINE;
+     doTest("If.java", "If.java");
+     settings.BRACE_STYLE = CodeStyleSettings.END_OF_LINE;
+     settings.KEEP_LINE_BREAKS = false;
+     doTest("If_after.java", "If.java");
+   }
+   public void test2() throws Exception {
+     final CodeStyleSettings settings = getSettings();
+     settings.ALIGN_MULTILINE_PARAMETERS_IN_CALLS = true;
+     doTest();
+   }
+   public void testBlocks() throws Exception {
+     final CodeStyleSettings settings = getSettings();
+     settings.KEEP_LINE_BREAKS = false;
+     doTest();
+   }
+   public void testSCR260() throws Exception {
+     final CodeStyleSettings settings = getSettings();
+     settings.IF_BRACE_FORCE = CodeStyleSettings.FORCE_BRACES_ALWAYS;
+     settings.BRACE_STYLE = CodeStyleSettings.END_OF_LINE;
+     settings.KEEP_LINE_BREAKS = false;
+     doTest();
+   }
+   public void testSCR114() throws Exception {
+     final CodeStyleSettings settings = getSettings();
+     settings.BRACE_STYLE = CodeStyleSettings.NEXT_LINE;
+     settings.CATCH_ON_NEW_LINE = true;
+     doTest();
+   }
+   public void testSCR259() throws Exception {
+     myTextRange = new TextRange(36, 60);
+     final CodeStyleSettings settings = getSettings();
+     settings.IF_BRACE_FORCE = CodeStyleSettings.FORCE_BRACES_ALWAYS;
+     settings.KEEP_LINE_BREAKS = false;
+     doTest();
+   }
+   public void testSCR279() throws Exception {
+     final CodeStyleSettings settings = getSettings();
+     settings.ALIGN_MULTILINE_BINARY_OPERATION = true;
+     doTest();
+   }
+   public void testBinaryOperation() throws IncorrectOperationException {
+     final CodeStyleSettings settings = getSettings();
+     String text = "class Foo {\n" + "    void foo () {\n" + "        xxx = aaa + bbb \n" + "        + ccc + eee + ddd;\n" + "    }\n" + "}";
+     settings.ALIGN_MULTILINE_BINARY_OPERATION = true;
+     settings.ALIGN_MULTILINE_ASSIGNMENT = true;
+     doTextTest(text, "\n" +
+                      "class Foo {\n" +
+                      "    void foo() {\n" +
+                      "        xxx = aaa + bbb\n" +
+                      "              + ccc + eee + ddd;\n" +
+                      "    }\n" +
+                      "}");
+     settings.ALIGN_MULTILINE_BINARY_OPERATION = true;
+     settings.ALIGN_MULTILINE_ASSIGNMENT = false;
+     doTextTest(text, "\n" +
+                      "class Foo {\n" +
+                      "    void foo() {\n" +
+                      "        xxx = aaa + bbb\n" +
+                      "              + ccc + eee + ddd;\n" +
+                      "    }\n" +
+                      "}");
+     settings.ALIGN_MULTILINE_BINARY_OPERATION = false;
+     settings.ALIGN_MULTILINE_ASSIGNMENT = true;
+     doTextTest(text, "\n" +
+                      "class Foo {\n" +
+                      "    void foo() {\n" +
+                      "        xxx = aaa + bbb\n" +
+                      "                + ccc + eee + ddd;\n" +
+                      "    }\n" +
+                      "}");
+     settings.ALIGN_MULTILINE_ASSIGNMENT = false;
+     settings.ALIGN_MULTILINE_BINARY_OPERATION = false;
+     doTextTest(text, "\n" +
+                      "class Foo {\n" +
+                      "    void foo() {\n" +
+                      "        xxx = aaa + bbb\n" +
+                      "                + ccc + eee + ddd;\n" +
+                      "    }\n" +
+                      "}");
+     settings.ALIGN_MULTILINE_ASSIGNMENT = false;
+     settings.ALIGN_MULTILINE_BINARY_OPERATION = false;
+     doTextTest(text, "\n" +
+                      "class Foo {\n" +
+                      "    void foo() {\n" +
+                      "        xxx = aaa + bbb\n" +
+                      "                + ccc + eee + ddd;\n" +
+                      "    }\n" +
+                      "}");
+     settings.ALIGN_MULTILINE_BINARY_OPERATION = true;
+     doTextTest("class Foo {\n" + "    void foo () {\n" + "        xxx = aaa + bbb \n" + "        - ccc + eee + ddd;\n" + "    }\n" + "}",
+                "\nclass Foo {\n" +
+                "    void foo() {\n" +
+                "        xxx = aaa + bbb\n" +
+                "              - ccc + eee + ddd;\n" +
+                "    }\n" +
+                "}");
+     doTextTest("class Foo {\n" + "    void foo () {\n" + "        xxx = aaa + bbb \n" + "        * ccc + eee + ddd;\n" + "    }\n" + "}",
+                "\nclass Foo {\n" +
+                "    void foo() {\n" +
+                "        xxx = aaa + bbb\n" +
+                "                    * ccc + eee + ddd;\n" +
+                "    }\n" +
+                "}");
+   }
+   public void testWhile() throws Exception {
+     doTextTest("class A{\n" + "void a(){\n" + "do x++ while (b);\n" + "}\n}",
+                "class A {\n" + "    void a() {\n" + "        do x++ while (b);\n" + "    }\n" + "}");
+   }
+   public void testFor() throws Exception {
+     doTextTest("class A{\n" + "void b(){\n" + "for (c) {\n" + "d();\n" + "}\n" + "}\n" + "}",
+                "class A {\n" + "    void b() {\n" + "        for (c) {\n" + "            d();\n" + "        }\n" + "    }\n" + "}");
+   }
+   public void testStringBinaryOperation() throws Exception {
+     final CodeStyleSettings settings = getSettings();
+     settings.ALIGN_MULTILINE_ASSIGNMENT = false;
+     settings.ALIGN_MULTILINE_BINARY_OPERATION = false;
+     doTextTest("class Foo {\n" + "    void foo () {\n" + "String s = \"abc\" +\n" + "\"def\";" + "    }\n" + "}",
+                "\nclass Foo {\n" +
+                "    void foo() {\n" +
+                "        String s = \"abc\" +\n" +
+                "                \"def\";\n" +
+                "    }\n" +
+                "}");
+   }
+   public void test3() throws Exception {
+     doTest();
+   }
+   public void test4() throws Exception {
+     myLineRange = new TextRange(2, 8);
+     doTest();
+   }
+   public void testSCR395() throws Exception {
+     final CodeStyleSettings settings = getSettings();
+     settings.METHOD_BRACE_STYLE = CodeStyleSettings.END_OF_LINE;
+     doTest();
+   }
+   public void testBraces() throws Exception {
+     final CodeStyleSettings settings = getSettings();
+     final String text = "class Foo {\n" + "void foo () {\n" + "if (a) {\n" + "int i = 0;\n" + "}\n" + "}\n" + "}";
+     settings.BRACE_STYLE = CodeStyleSettings.END_OF_LINE;
+     settings.METHOD_BRACE_STYLE = CodeStyleSettings.END_OF_LINE;
+     doTextTest(text, "\n" +
+                      "class Foo {\n" +
+                      "    void foo() {\n" +
+                      "        if (a) {\n" +
+                      "            int i = 0;\n" +
+                      "        }\n" +
+                      "    }\n" +
+                      "}");
+     settings.BRACE_STYLE = CodeStyleSettings.NEXT_LINE;
+     settings.METHOD_BRACE_STYLE = CodeStyleSettings.NEXT_LINE;
+     doTextTest(text, "\n" +
+                      "class Foo {\n" +
+                      "    void foo()\n" +
+                      "    {\n" +
+                      "        if (a)\n" +
+                      "        {\n" +
+                      "            int i = 0;\n" +
+                      "        }\n" +
+                      "    }\n" +
+                      "}");
+     settings.METHOD_BRACE_STYLE = CodeStyleSettings.NEXT_LINE_SHIFTED;
+     settings.BRACE_STYLE = CodeStyleSettings.NEXT_LINE_SHIFTED;
+     doTextTest(text, "\n" +
+                      "class Foo {\n" +
+                      "    void foo()\n" +
+                      "        {\n" +
+                      "        if (a)\n" +
+                      "            {\n" +
+                      "            int i = 0;\n" +
+                      "            }\n" +
+                      "        }\n" +
+                      "}");
+     settings.METHOD_BRACE_STYLE = CodeStyleSettings.NEXT_LINE_SHIFTED;
+     settings.BRACE_STYLE = CodeStyleSettings.END_OF_LINE;
+     doTextTest(text, "\n" +
+                      "class Foo {\n" +
+                      "    void foo()\n" +
+                      "        {\n" +
+                      "        if (a) {\n" +
+                      "            int i = 0;\n" +
+                      "        }\n" +
+                      "        }\n" +
+                      "}");
+     settings.METHOD_BRACE_STYLE = CodeStyleSettings.NEXT_LINE_SHIFTED2;
+     settings.BRACE_STYLE = CodeStyleSettings.NEXT_LINE_SHIFTED2;
+     doTextTest(text, "\n" +
+                      "class Foo {\n" +
+                      "    void foo()\n" +
+                      "        {\n" +
+                      "            if (a)\n" +
+                      "                {\n" +
+                      "                    int i = 0;\n" +
+                      "                }\n" +
+                      "        }\n" +
+                      "}");
+     settings.BRACE_STYLE = CodeStyleSettings.NEXT_LINE;
+     doTextTest("class Foo {\n" + "    static{\n" + "foo();\n" + "}" + "}",
+                "class Foo {\n" + "    static\n" + "    {\n" + "        foo();\n" + "    }\n" + "}");
+   }
+   public void testSCR429() throws Exception {
+     final CodeStyleSettings settings = getSettings();
+     settings.KEEP_BLANK_LINES_IN_CODE = 2;
+     settings.KEEP_BLANK_LINES_BEFORE_RBRACE = 2;
+     settings.KEEP_BLANK_LINES_IN_DECLARATIONS = 2;
+     doTest();
+   }
+   public void testSCR548() throws Exception {
+     final CodeStyleSettings settings = getSettings();
+     settings.getIndentOptions(StdFileTypes.JAVA).INDENT_SIZE = 4;
+     settings.getIndentOptions(StdFileTypes.JAVA).CONTINUATION_INDENT_SIZE = 2;
+     doTest();
+   }
+   public void testExtendsList() throws Exception {
+     final CodeStyleSettings settings = getSettings();
+     settings.ALIGN_MULTILINE_EXTENDS_LIST = true;
+     doTextTest("class A extends B, \n" + "C {}", "class A extends B,\n" + "                C {\n}");
+   }
+   public void testBlockWithoutBraces() throws Exception {
+     doTextTest("class A {\n" + "void foo(){\n" + "if(a)\n" + "return;\n" + "}\n" + "}",
+                "class A {\n" + "    void foo() {\n" + "        if (a)\n" + "            return;\n" + "    }\n" + "}");
+   }
+   public void testNestedCalls() throws Exception {
+     doTextTest("class A {\n" + "void foo(){\n" + "foo(\nfoo(\nfoo()\n)\n);\n" + "}\n" + "}", "class A {\n" +
+                                                                                              "    void foo() {\n" +
+                                                                                              "        foo(\n" +
+                                                                                              "                foo(\n" +
+                                                                                              "                        foo()\n" +
+                                                                                              "                )\n" +
+                                                                                              "        );\n" +
+                                                                                              "    }\n" +
+                                                                                              "}");
+   }
+   public void testSpacesAroundMethod() throws Exception {
+     doTextTest("class Foo {\n" + "    abstract void a();\n" + "    {\n" + "        a();\n" + "    }\n" + "}",
+                "class Foo {\n" + "    abstract void a();\n" + "\n" + "    {\n" + "        a();\n" + "    }\n" + "}");
+   }
+   public void testSpaceInIf() throws Exception {
+     doTextTest("class foo {\n" +
+                "    {\n" +
+                "        if (a) {\n" +
+                "            if(a) {\n" +
+                "\n" +
+                "            }\n" +
+                "        }\n" +
+                "    }\n" +
+ "}", "class foo {\n" +
+      "    {\n" +
+      "        if (a) {\n" +
+      "            if (a) {\n" +
+      "\n" +
+      "            }\n" +
+      "        }\n" +
+      "    }\n" +
+      "}");
+   }
+   public void testIf2() throws Exception {
+     doTextTest(
+       "public class Test {\n" + "    public boolean equals(Object o) {\n" + "        if(this == o)return true;\n" + "    }\n" + "}",
+       "public class Test {\n" + "    public boolean equals(Object o) {\n" + "        if (this == o) return true;\n" + "    }\n" + "}");
+   }
+   public void testSpaceAroundField() throws Exception {
+     final CodeStyleSettings settings = getSettings();
+     settings.BLANK_LINES_AROUND_FIELD = 1;
+     doTextTest("class Foo {\n" +
+                "    boolean a;\n" +
+                "    {\n" +
+                "        if (a) {\n" +
+                "        } else {\n" +
+                "\n" +
+                "        }\n" +
+                "        a = 2;\n" +
+                "    }\n" +
+ "}", "class Foo {\n" +
+      "    boolean a;\n" +
+      "\n" +
+      "    {\n" +
+      "        if (a) {\n" +
+      "        } else {\n" +
+      "\n" +
+      "        }\n" +
+      "        a = 2;\n" +
+      "    }\n" +
+      "}");
+   }
+   public void testArray() throws Exception {
+     final CodeStyleSettings settings = getSettings();
+     settings.SPACE_WITHIN_ARRAY_INITIALIZER_BRACES = true;
+     settings.SPACE_BEFORE_ARRAY_INITIALIZER_LBRACE = true;
+     doTextTest("class a {\n" + " void f() {\n" + "   final int[] i = new int[]{0};\n" + " }\n" + "}",
+                "class a {\n" + "    void f() {\n" + "        final int[] i = new int[] { 0 };\n" + "    }\n" + "}");
+   }
+   public void testTwoJavaDocs() throws Exception {
+     doTextTest("/**\n" + " * \n" + " */\n" + "        class Test {\n" + "    /**\n" + "     */\n" + "     public void foo();\n" + "}",
+                "/**\n" + " * \n" + " */\n" + "class Test {\n" + "    /**\n" + "     */\n" + "    public void foo();\n" + "}");
+   }
+   public void testJavaDocLinksWithParameterNames() throws Exception {
+     // See IDEADEV-8332
+     doTextTest("/**\n" +
+                "* @return if ( x1 == x1 ) then retrun {@link #cmp(String y1,int y2)}\n" +
+                "*         otherwise return {@link #cmp(int x1,int x2)}\n" +
+                "*/\n" +
+                "class X {\n" +
+                "}\n", "/**\n" +
+                       " * @return if ( x1 == x1 ) then retrun {@link #cmp(String y1,int y2)}\n" +
+                       " * otherwise return {@link #cmp(int x1,int x2)}\n" +
+                       " */\n" +
+                       "class X {\n" +
+                       "}\n");
+   }
+   public void testIncompleteField() throws Exception {
+     doTextTest("public class Test {\n" + "    String s =;\n" + "}", "public class Test {\n" + "    String s = ;\n" + "}");
+   }
+   public void testIf3() throws Exception {
+     getSettings().KEEP_CONTROL_STATEMENT_IN_ONE_LINE = false;
+     doTextTest("public abstract class A {\n" +
+                "    abstract void f(boolean b);\n" +
+                "\n" +
+                "    A IMPL = new A() {\n" +
+                "        void f(boolean b) {\n" +
+                "            if (b)\n" +
+                "                f(true); else {\n" +
+                "                f(false);\n" +
+                "                f(false);\n" +
+                "            }\n" +
+                "            for (int i = 0; i < 5; i++) f(true);\n" +
+                "        }\n" +
+                "    };\n" +
+ "}", "public abstract class A {\n" +
+      "    abstract void f(boolean b);\n" +
+      "\n" +
+      "    A IMPL = new A() {\n" +
+      "        void f(boolean b) {\n" +
+      "            if (b)\n" +
+      "                f(true);\n" +
+      "            else {\n" +
+      "                f(false);\n" +
+      "                f(false);\n" +
+      "            }\n" +
+      "            for (int i = 0; i < 5; i++)\n" +
+      "                f(true);\n" +
+      "        }\n" +
+      "    };\n" +
+      "}");
+   }
+   public void testDocComment() throws Exception {
+     doTextTest("public class TestClass {\n" + "/**\n" + "* \n" + "*/\n" + "    public void f1() {\n" + "    }\n" + "}",
+                "public class TestClass {\n" + "    /**\n" + "     * \n" + "     */\n" + "    public void f1() {\n" + "    }\n" + "}");
+   }
+   public void testDocComment2() throws Exception {
+     getSettings().KEEP_SIMPLE_METHODS_IN_ONE_LINE = true;
+     doTextTest("class Test {\n" +
+                "/**\n" +
+                "*\n" +
+                "* @param a\n" +
+                "* @param param\n" +
+                "* @param ddd\n" +
+                "*/\n" +
+                "    public void foo(int a, String param, double ddd) {}\n" +
+ "}", "class Test {\n" +
+      "    /**\n" +
+      "     * @param a\n" +
+      "     * @param param\n" +
+      "     * @param ddd\n" +
+      "     */\n" +
+      "    public void foo(int a, String param, double ddd) {}\n" +
+      "}");
+   }
+   public void testSpaceBeforeFieldName() throws Exception {
+     doTextTest("class A{\n" + "public   A    myA ;\n" + "}", "class A {\n" + "    public A myA;\n" + "}");
+   }
+   public void testClass() throws Exception {
+     doTextTest("    class A {\n" +
+                "        Logger LOG;\n" +
+                "        class C {}\n" +
+                "\n" +
+                "        public void b() {\n" +
+                "        }\n" +
+                "\n" +
+                "        int f;\n" +
+ "    }", "class A {\n" +
+          "    Logger LOG;\n" +
+          "\n" +
+          "    class C {\n" +
+          "    }\n" +
+          "\n" +
+          "    public void b() {\n" +
+          "    }\n" +
+          "\n" +
+          "    int f;\n" +
+          "}");
+   }
+   public void testSCR11799() throws Exception {
+     final CodeStyleSettings settings = getSettings();
+     settings.getIndentOptions(StdFileTypes.JAVA).CONTINUATION_INDENT_SIZE = 4;
+     settings.CLASS_BRACE_STYLE = CodeStyleSettings.NEXT_LINE;
+     settings.METHOD_BRACE_STYLE = CodeStyleSettings.NEXT_LINE;
+     doTest();
+   }
+   public void testSCR501() throws Exception {
+     final CodeStyleSettings settings = getSettings();
+     settings.KEEP_FIRST_COLUMN_COMMENT = true;
+     doTest();
+   }
+   public void testSCR879() throws Exception {
+     final CodeStyleSettings settings = getSettings();
+     settings.BRACE_STYLE = CodeStyleSettings.NEXT_LINE;
+     doTest();
+   }
+   public void testDoNotIndentCaseFromSwitch() throws Exception {
+     final CodeStyleSettings settings = getSettings();
+     settings.INDENT_CASE_FROM_SWITCH = false;
+     doTextTest("class A {\n" + "void foo() {\n" + "switch(a){\n" + "case 1: \n" + "break;\n" + "}\n" + "}\n" + "}", "class A {\n" +
+                                                                                                                     "    void foo() {\n" +
+                                                                                                                     "        switch (a) {\n" +
+                                                                                                                     "        case 1:\n" +
+                                                                                                                     "            break;\n" +
+                                                                                                                     "        }\n" +
+                                                                                                                     "    }\n" +
+                                                                                                                     "}");
+   }
+   public void testSCR547() throws Exception {
+     doTextTest("class Foo { \n" +
+                "    Object[] objs = { \n" +
+                "            new Object() { \n" +
+                "        public String toString() { \n" +
+                "            return \"x\"; \n" +
+                "        } \n" +
+                "    } \n" +
+                "    }; \n" +
+ "}", "class Foo {\n" +
+      "    Object[] objs = {\n" +
+      "            new Object() {\n" +
+      "                public String toString() {\n" +
+      "                    return \"x\";\n" +
+      "                }\n" +
+      "            }\n" +
+      "    };\n" +
+      "}");
+   }
+   public void testSCR11296() throws Exception {
+     final CodeStyleSettings settings = getSettings();
+     settings.RIGHT_MARGIN = 50;
+     settings.WRAP_COMMENTS = true;
+     settings.ENABLE_JAVADOC_FORMATTING = true;
+     settings.JD_P_AT_EMPTY_LINES = false;
+     settings.JD_KEEP_EMPTY_LINES = false;
+     doTest();
+   }
+   public void testClass2() throws Exception {
+     final CodeStyleSettings settings = getSettings();
+     settings.KEEP_FIRST_COLUMN_COMMENT = false;
+     doTextTest("class A {\n" + "// comment before\n" + "protected Object a;//  comment after\n" + "}",
+                "class A {\n" + "    // comment before\n" + "    protected Object a;//  comment after\n" + "}");
+   }
+   public void testSplitLiteral() throws Exception {
+     doTextTest("class A {\n" + "void foo() {\n" + "  String s = \"abc\" +\n" + "  \"def\";\n" + "}\n" + "}",
+                "class A {\n" + "    void foo() {\n" + "        String s = \"abc\" +\n" + "                \"def\";\n" + "    }\n" + "}");
+   }
+   public void testParametersAlignment() throws Exception {
+     final CodeStyleSettings settings = getSettings();
+     settings.ALIGN_MULTILINE_PARAMETERS_IN_CALLS = true;
+     settings.RIGHT_MARGIN = 140;
+     doTest();
+   }
+   public void testConditionalExpression() throws Exception {
+     final CodeStyleSettings settings = getSettings();
+     settings.SPACE_BEFORE_QUEST = true;
+     settings.SPACE_AFTER_QUEST = false;
+     settings.SPACE_BEFORE_COLON = true;
+     settings.SPACE_AFTER_COLON = false;
+     doTextTest("class Foo{\n" + "  void foo(){\n" + "  return name   !=   null   ?   1   :   2   ;" + "}\n" + "}",
+                "class Foo {\n" + "    void foo() {\n" + "        return name != null ?1 :2;\n" + "    }\n" + "}");
+   }
+   public void testSCR479() throws Exception {
+     final CodeStyleSettings settings = getSettings();
+     settings.RIGHT_MARGIN = 80;
+     settings.TERNARY_OPERATION_WRAP = CodeStyleSettings.WRAP_AS_NEEDED;
+     doTextTest("public class Foo {\n" +
+                "    public static void main(String[] args) {\n" +
+                "        if (name != null ?                !name.equals(that.name) : that.name !=                null)\n" +
+                "            return false;\n" +
+                "    }\n" +
+ "}", "public class Foo {\n" +
+      "    public static void main(String[] args) {\n" +
+      "        if (name != null ? !name.equals(that.name) : that.name != null)\n" +
+      "            return false;\n" +
+      "    }\n" +
+      "}");
+   }
+   public void testSCR190() throws Exception {
+     final CodeStyleSettings settings = getSettings();
+     settings.KEEP_LINE_BREAKS = false;
+     doTextTest("public class EntityObject \n" +
+                "{ \n" +
+                "    private Integer id; \n" +
+                "\n" +
+                "    public Integer getId() \n" +
+                "    { \n" +
+                "        return id; \n" +
+                "    } \n" +
+                "\n" +
+                "    public void setId(Integer id) \n" +
+                "    { \n" +
+                "        this.id = id; \n" +
+                "    } \n" +
+ "}", "public class EntityObject {\n" +
+      "    private Integer id;\n" +
+      "\n" +
+      "    public Integer getId() {\n" +
+      "        return id;\n" +
+      "    }\n" +
+      "\n" +
+      "    public void setId(Integer id) {\n" +
+      "        this.id = id;\n" +
+      "    }\n" +
+      "}");
+   }
+   public void testMethodCallChain() throws Exception {
+     doTextTest("class Foo{\n" +
+                "    void foo(){\n" +
+                "       configuration = new Configuration() \n" +
+                "                .setProperty(\"hibernate.dialect\", \n" +
+                "                \"au.com.sensis.wsearch.db.CustomHSQLDBDialect\");\n" +
+                "}\n" +
+ "}", "class Foo {\n" +
+      "    void foo() {\n" +
+      "        configuration = new Configuration()\n" +
+      "                .setProperty(\"hibernate.dialect\",\n" +
+      "                        \"au.com.sensis.wsearch.db.CustomHSQLDBDialect\");\n" +
+      "    }\n" +
+      "}");
+     doTextTest("class Foo{\n" +
+                "    void foo(){\n" +
+                "       configuration = new Configuration(). \n" +
+                "                setProperty(\"hibernate.dialect\", \n" +
+                "                \"au.com.sensis.wsearch.db.CustomHSQLDBDialect\");\n" +
+                "}\n" +
+ "}", "class Foo {\n" +
+      "    void foo() {\n" +
+      "        configuration = new Configuration().\n" +
+      "                setProperty(\"hibernate.dialect\",\n" +
+      "                        \"au.com.sensis.wsearch.db.CustomHSQLDBDialect\");\n" +
+      "    }\n" +
+      "}");
+     doTextTest("class Foo{\n" +
+                "    void foo(){\n" +
+                "       configuration = new Configuration() \n" +
+                "                .setProperty(\"hibernate.dialect\", \n" +
+                "                \"au.com.sensis.wsearch.db.CustomHSQLDBDialect\") \n" +
+                "                .setProperty(\"hibernate.connection.url\", \n" +
+                "                \"jdbc:hsqldb:mem:testdb\") \n" +
+                "                .setProperty(\"hibernate.connection.driver_class\", \n" +
+                "                \"org.hsqldb.jdbcDriver\") \n" +
+                "                .setProperty(\"hibernate.connection.username\", \"sa\") \n" +
+                "                .setProperty(\"hibernate.connection.password\", \"\") \n" +
+                "                .setProperty(\"hibernate.show_sql\", \"false\") \n" +
+                "                .setProperty(\"hibernate.order_updates\", \"true\") \n" +
+                "                .setProperty(\"hibernate.hbm2ddl.auto\", \"update\"); " +
+                "}\n" +
+ "}", "class Foo {\n" +
+      "    void foo() {\n" +
+      "        configuration = new Configuration()\n" +
+      "                .setProperty(\"hibernate.dialect\",\n" +
+      "                        \"au.com.sensis.wsearch.db.CustomHSQLDBDialect\")\n" +
+      "                .setProperty(\"hibernate.connection.url\",\n" +
+      "                        \"jdbc:hsqldb:mem:testdb\")\n" +
+      "                .setProperty(\"hibernate.connection.driver_class\",\n" +
+      "                        \"org.hsqldb.jdbcDriver\")\n" +
+      "                .setProperty(\"hibernate.connection.username\", \"sa\")\n" +
+      "                .setProperty(\"hibernate.connection.password\", \"\")\n" +
+      "                .setProperty(\"hibernate.show_sql\", \"false\")\n" +
+      "                .setProperty(\"hibernate.order_updates\", \"true\")\n" +
+      "                .setProperty(\"hibernate.hbm2ddl.auto\", \"update\");\n" +
+      "    }\n" +
+      "}");
+   }
+   public void testSCR1535() throws Exception {
+     final CodeStyleSettings settings = getSettings();
+     settings.BRACE_STYLE = CodeStyleSettings.NEXT_LINE;
+     settings.CLASS_BRACE_STYLE = CodeStyleSettings.NEXT_LINE;
+     settings.METHOD_BRACE_STYLE = CodeStyleSettings.NEXT_LINE;
+     doTextTest("public class Foo {\n" +
+                "    public int foo() {\n" +
+                "        if (a) {\n" +
+                "            return;\n" +
+                "        }\n" +
+                "    }\n" +
+ "}", "public class Foo\n" +
+      "{\n" +
+      "    public int foo()\n" +
+      "    {\n" +
+      "        if (a)\n" +
+      "        {\n" +
+      "            return;\n" +
+      "        }\n" +
+      "    }\n" +
+      "}");
+   }
+   public void testComment1() throws Exception {
+     doTextTest("class Foo {\n" +
+                "    public boolean mErrorFlage;\n" +
+                "    /**\n" +
+                "     * Reference to New Member Message Source\n" +
+                "     */\n" +
+                "    private NewMemberMessageSource newMemberMessageSource;" +
+                "\n" +
+ "}", "class Foo {\n" +
+      "    public boolean mErrorFlage;\n" +
+      "    /**\n" +
+      "     * Reference to New Member Message Source\n" +
+      "     */\n" +
+      "    private NewMemberMessageSource newMemberMessageSource;" +
+      "\n" +
+      "}");
+   }
+   public void testElseAfterComment() throws Exception {
+     doTextTest("public class Foo {\n" +
+                "    public int foo() {\n" +
+                "        if (a) {\n" +
+                "            return;\n" +
+                "        }//comment\n" +
+                "        else {\n" +
+                "        }\n" +
+                "    }\n" +
+ "}", "public class Foo {\n" +
+      "    public int foo() {\n" +
+      "        if (a) {\n" +
+      "            return;\n" +
+      "        }//comment\n" +
+      "        else {\n" +
+      "        }\n" +
+      "    }\n" +
+      "}");
+   }
+   public void testLBraceAfterComment() throws Exception {
+     final CodeStyleSettings settings = getSettings();
+     settings.KEEP_LINE_BREAKS = false;
+     doTextTest("public class Foo {\n" +
+                "    public int foo() {\n" +
+                "        if (a) \n" +
+                "  //comment\n" +
+                "{\n" +
+                "            return;\n" +
+                "        }\n" +
+                "    }\n" +
+ "}", "public class Foo {\n" +
+      "    public int foo() {\n" +
+      "        if (a)\n" +
+      "        //comment\n" +
+      "        {\n" +
+      "            return;\n" +
+      "        }\n" +
+      "    }\n" +
+      "}");
+   }
+   public void testSpaces() throws Exception {
+     final CodeStyleSettings settings = getSettings();
+     settings.SPACE_WITHIN_FOR_PARENTHESES = true;
+     settings.SPACE_WITHIN_IF_PARENTHESES = true;
+     settings.SPACE_WITHIN_METHOD_PARENTHESES = true;
+     settings.SPACE_WITHIN_METHOD_CALL_PARENTHESES = true;
+     settings.SPACE_BEFORE_METHOD_PARENTHESES = true;
+     settings.SPACE_BEFORE_METHOD_CALL_PARENTHESES = true;
+     doTest();
+   }
+   public void testSpacesBeforeLBrace() throws Exception {
+     final CodeStyleSettings settings = getSettings();
+     settings.SPACE_BEFORE_CLASS_LBRACE = true;
+     settings.SPACE_BEFORE_METHOD_LBRACE = true;
+     settings.SPACE_BEFORE_IF_LBRACE = true;
+     settings.SPACE_BEFORE_ELSE_LBRACE = true;
+     settings.SPACE_BEFORE_WHILE_LBRACE = true;
+     settings.SPACE_BEFORE_FOR_LBRACE = true;
+     settings.SPACE_BEFORE_DO_LBRACE = true;
+     settings.SPACE_BEFORE_SWITCH_LBRACE = true;
+     settings.SPACE_BEFORE_TRY_LBRACE = true;
+     settings.SPACE_BEFORE_CATCH_LBRACE = true;
+     settings.SPACE_BEFORE_FINALLY_LBRACE = true;
+     settings.SPACE_BEFORE_SYNCHRONIZED_LBRACE = true;
+     settings.SPACE_BEFORE_ARRAY_INITIALIZER_LBRACE = true;
+     doTest();
+     settings.SPACE_BEFORE_CLASS_LBRACE = false;
+     settings.SPACE_BEFORE_METHOD_LBRACE = false;
+     settings.SPACE_BEFORE_IF_LBRACE = false;
+     settings.SPACE_BEFORE_ELSE_LBRACE = false;
+     settings.SPACE_BEFORE_WHILE_LBRACE = false;
+     settings.SPACE_BEFORE_FOR_LBRACE = false;
+     settings.SPACE_BEFORE_DO_LBRACE = false;
+     settings.SPACE_BEFORE_SWITCH_LBRACE = false;
+     settings.SPACE_BEFORE_TRY_LBRACE = false;
+     settings.SPACE_BEFORE_CATCH_LBRACE = false;
+     settings.SPACE_BEFORE_FINALLY_LBRACE = false;
+     settings.SPACE_BEFORE_SYNCHRONIZED_LBRACE = false;
+     settings.SPACE_BEFORE_ARRAY_INITIALIZER_LBRACE = false;
+     doTest("SpacesBeforeLBrace.java", "SpacesBeforeLBrace.java");
+   }
+   public void testSCR970() throws Exception {
+     final CodeStyleSettings settings = getSettings();
+     settings.THROWS_KEYWORD_WRAP = CodeStyleSettings.WRAP_ALWAYS;
+     settings.THROWS_LIST_WRAP = CodeStyleSettings.WRAP_AS_NEEDED;
+     settings.METHOD_PARAMETERS_WRAP = CodeStyleSettings.WRAP_AS_NEEDED;
+     doTest();
+   }
+   public void testCommentBeforeField() throws Exception {
+     final CodeStyleSettings settings = getSettings();
+     settings.KEEP_LINE_BREAKS = false;
+     settings.KEEP_FIRST_COLUMN_COMMENT = false;
+     settings.KEEP_CONTROL_STATEMENT_IN_ONE_LINE = false;
+     settings.KEEP_SIMPLE_BLOCKS_IN_ONE_LINE = false;
+     settings.KEEP_SIMPLE_METHODS_IN_ONE_LINE = false;
+     doTextTest("class Foo{\n" + "    //Foo a\n" + "    Foo a; \n" + "}", "class Foo {\n" + "    //Foo a\n" + "    Foo a;\n" + "}");
+   }
+   public void testLabel() throws Exception {
+     final CodeStyleSettings settings = getSettings();
+     settings.getIndentOptions(StdFileTypes.JAVA).LABEL_INDENT_ABSOLUTE = true;
+     settings.SPECIAL_ELSE_IF_TREATMENT = true;
+     settings.FOR_BRACE_FORCE = CodeStyleSettings.FORCE_BRACES_ALWAYS;
+     myTextRange = new TextRange(59, 121);
+     doTextTest("public class Foo {\n" +
+                "    public void foo() {\n" +
+                "label2:\n" +
+                "        for (int i = 0; i < 5; i++)\n" +
+                "        {doSomething(i);\n" +
+                "        }\n" +
+                "    }\n" +
+ "}", "public class Foo {\n" +
+      "    public void foo() {\n" +
+      "label2:\n" +
+      "        for (int i = 0; i < 5; i++) {\n" +
+      "            doSomething(i);\n" +
+      "        }\n" +
+      "    }\n" +
+      "}");
+   }
+   public void testSpacesInsideEmptyParentheses() throws Exception {
+     final CodeStyleSettings settings = getSettings();
+     settings.SPACE_WITHIN_METHOD_PARENTHESES = true;
+     settings.SPACE_WITHIN_METHOD_CALL_PARENTHESES = true;
+     doTextTest("public class Foo {\n" + "    public void foo(   ) {\n" + "        foo(   );\n" + "    }\n" + "}",
+                "public class Foo {\n" + "    public void foo() {\n" + "        foo();\n" + "    }\n" + "}");
+   }
+   private static CodeStyleSettings getSettings() {
+     return CodeStyleSettingsManager.getSettings(getProject());
+   }
+   public void testElseOnNewLine() throws Exception {
+     doTextTest("class Foo{\n" + "void foo() {\n" + "if (a)\n" + "return;\n" + "else\n" + "return;\n" + "}\n" + "}", "class Foo {\n" +
+                                                                                                                     "    void foo() {\n" +
+                                                                                                                     "        if (a)\n" +
+                                                                                                                     "            return;\n" +
+                                                                                                                     "        else\n" +
+                                                                                                                     "            return;\n" +
+                                                                                                                     "    }\n" +
+                                                                                                                     "}");
+   }
+   public void testTwoClasses() throws Exception {
+     doTextTest("class A {}\n" + "class B {}", "class A {\n" + "}\n" + "\n" + "class B {\n" + "}");
+   }
+   public void testBraceOnNewLineIfWrapped() throws Exception {
+     getSettings().BINARY_OPERATION_WRAP = CodeStyleSettings.WRAP_AS_NEEDED;
+     getSettings().BRACE_STYLE = CodeStyleSettings.NEXT_LINE_IF_WRAPPED;
+     getSettings().RIGHT_MARGIN = 35;
+     getSettings().ALIGN_MULTILINE_BINARY_OPERATION = true;
+     doTextTest("class Foo {\n" +
+                "    void foo(){\n" +
+                "        if (veryLongCondition || veryVeryVeryVeryLongCondition) {\n" +
+                "            foo();\n" +
+                "        }\n" +
+                "        if (a) {\n" +
+                "        }" +
+                "    }\n" +
+ "}", "class Foo {\n" +
+      "    void foo() {\n" +
+      "        if (veryLongCondition ||\n" +
+      "            veryVeryVeryVeryLongCondition)\n" +
+      "        {\n" +
+      "            foo();\n" +
+      "        }\n" +
+      "        if (a) {\n" +
+      "        }\n" +
+      "    }\n" +
+      "}");
+   }
+   public void testSCR1047() throws Exception {
+     doTextTest("class Foo{\n" + "    void foo(){\n" + "        String field1, field2;\n" + "    }\n" + "}",
+                "class Foo {\n" + "    void foo() {\n" + "        String field1, field2;\n" + "    }\n" + "}");
+   }
+   public void testSCR524() throws Exception {
+     getSettings().METHOD_BRACE_STYLE = CodeStyleSettings.NEXT_LINE_SHIFTED;
+     getSettings().KEEP_SIMPLE_METHODS_IN_ONE_LINE = true;
+     getSettings().KEEP_SIMPLE_BLOCKS_IN_ONE_LINE = false;
+     doTextTest("class Foo {\n" + "    void foo() { return;}" + "}", "class Foo {\n" + "    void foo() { return;}\n" + "}");
+     getSettings().BRACE_STYLE = CodeStyleSettings.NEXT_LINE_SHIFTED2;
+     getSettings().KEEP_SIMPLE_METHODS_IN_ONE_LINE = false;
+     getSettings().KEEP_SIMPLE_BLOCKS_IN_ONE_LINE = true;
+     getSettings().METHOD_BRACE_STYLE = CodeStyleSettings.END_OF_LINE;
+     doTextTest("class Foo{\n" +
+                "void foo() {\n" +
+                "if(a) {return;}\n" +
+                "for(a = 0; a < 10; a++) {return;}\n" +
+                "switch(a) {case 1: return;}\n" +
+                "do{return;} while (a);\n" +
+                "while(a){return;}\n" +
+                "try{return;} catch(Ex e){return;} finally{return;}\n" +
+                "}\n" +
+ "}", "class Foo {\n" +
+      "    void foo() {\n" +
+      "        if (a) {return;}\n" +
+      "        for (a = 0; a < 10; a++) {return;}\n" +
+      "        switch (a)\n" +
+      "            {\n" +
+      "                case 1:\n" +
+      "                    return;\n" +
+      "            }\n" +
+      "        do {return;} while (a);\n" +
+      "        while (a) {return;}\n" +
+      "        try {return;} catch (Ex e) {return;} finally {return;}\n" +
+      "    }\n" +
+      "}");
+   }
+   public void testFirstArgumentWrapping() throws Exception {
+     getSettings().RIGHT_MARGIN = 20;
+     getSettings().CALL_PARAMETERS_WRAP = CodeStyleSettings.WRAP_AS_NEEDED;
+     doTextTest("class Foo {\n" + "    void foo() {\n" + "        fooFooFooFoo(1);" + "    }\n" + "}",
+                "class Foo {\n" + "    void foo() {\n" + "        fooFooFooFoo(\n" + "                1);\n" + "    }\n" + "}");
+     getSettings().CALL_PARAMETERS_WRAP = CodeStyleSettings.WRAP_ON_EVERY_ITEM;
+     doTextTest("class Foo {\n" + "    void foo() {\n" + "        fooFooFooFoo(1,2);" + "    }\n" + "}", "class Foo {\n" +
+                                                                                                         "    void foo() {\n" +
+                                                                                                         "        fooFooFooFoo(\n" +
+                                                                                                         "                1,\n" +
+                                                                                                         "                2);\n" +
+                                                                                                         "    }\n" +
+                                                                                                         "}");
+     doTextTest("class Foo {\n" + "    void foo() {\n" + "        fooFooFoo(1,2);" + "    }\n" + "}",
+                "class Foo {\n" + "    void foo() {\n" + "        fooFooFoo(1,\n" + "                2);\n" + "    }\n" + "}");
+   }
+   public void testSpacesInsideWhile() throws Exception {
+     getSettings().SPACE_WITHIN_WHILE_PARENTHESES = true;
+     doTextTest("class Foo{\n" + "    void foo() {\n" + "        while(x != y) {\n" + "        }\n" + "    }\n" + "}",
+                "class Foo {\n" + "    void foo() {\n" + "        while ( x != y ) {\n" + "        }\n" + "    }\n" + "}");
+   }
+   public void testAssertStatementWrapping() throws Exception {
+     getSettings().ASSERT_STATEMENT_WRAP = CodeStyleSettings.WRAP_AS_NEEDED;
+     getSettings().BINARY_OPERATION_WRAP = CodeStyleSettings.DO_NOT_WRAP;
+     getSettings().RIGHT_MARGIN = 40;
+     final JavaPsiFacade facade = getJavaFacade();
+     final LanguageLevel effectiveLanguageLevel = LanguageLevelProjectExtension.getInstance(facade.getProject()).getLanguageLevel();
+     try {
+       LanguageLevelProjectExtension.getInstance(facade.getProject()).setLanguageLevel(LanguageLevel.JDK_1_5);
+       getSettings().ASSERT_STATEMENT_COLON_ON_NEXT_LINE = false;
+       doTextTest("class Foo {\n" +
+                  "    void foo() {\n" +
+                  "        assert methodWithVeryVeryLongName() : foo;\n" +
+                  "        assert i + j + k + l + n + m <= 2 : \"assert description\";\n" +
+                  "    }\n" +
+ "}\n", "class Foo {\n" +
+        "    void foo() {\n" +
+        "        assert methodWithVeryVeryLongName() :\n" +
+        "                foo;\n" +
+        "        assert i + j + k + l + n + m <= 2 :\n" +
+        "                \"assert description\";\n" +
+        "    }\n" +
+        "}\n");
+       getSettings().ASSERT_STATEMENT_COLON_ON_NEXT_LINE = true;
+       doTextTest("class Foo {\n" +
+                  "    void foo() {\n" +
+                  "        assert methodWithVeryVeryLongName() : foo;\n" +
+                  "        assert i + j + k + l + n + m <= 2 : \"assert description\";\n" +
+                  "    }\n" +
+ "}\n", "class Foo {\n" +
+        "    void foo() {\n" +
+        "        assert methodWithVeryVeryLongName()\n" +
+        "                : foo;\n" +
+        "        assert i + j + k + l + n + m <= 2\n" +
+        "                : \"assert description\";\n" +
+        "    }\n" +
+        "}\n");
+     }
+     finally {
+       LanguageLevelProjectExtension.getInstance(facade.getProject()).setLanguageLevel(effectiveLanguageLevel);
+     }
+   }
+   public void testAssertStatementWrapping2() throws Exception {
+     getSettings().BINARY_OPERATION_WRAP = CodeStyleSettings.DO_NOT_WRAP;
+     getSettings().ASSERT_STATEMENT_WRAP = CodeStyleSettings.WRAP_AS_NEEDED;
+     getSettings().RIGHT_MARGIN = 37;
+     final CodeStyleSettings.IndentOptions options = getSettings().getIndentOptions(StdFileTypes.JAVA);
+     options.INDENT_SIZE = 2;
+     options.CONTINUATION_INDENT_SIZE = 2;
+     getSettings().ASSERT_STATEMENT_COLON_ON_NEXT_LINE = true;
+     final JavaPsiFacade facade = getJavaFacade();
+     final LanguageLevel effectiveLanguageLevel = LanguageLevelProjectExtension.getInstance(facade.getProject()).getLanguageLevel();
+     LanguageLevelProjectExtension.getInstance(facade.getProject()).setLanguageLevel(LanguageLevel.JDK_1_5);
+     try {
+       doTextTest(
+         "class Foo {\n" + "    void foo() {\n" + "        assert i + j + k + l + n + m <= 2 : \"assert description\";" + "    }\n" + "}",
+         "class Foo {\n" +
+         "  void foo() {\n" +
+         "    assert i + j + k + l + n + m <= 2\n" +
+         "      : \"assert description\";\n" +
+         "  }\n" +
+         "}");
+       getSettings().ASSERT_STATEMENT_COLON_ON_NEXT_LINE = false;
+       doTextTest(
+         "class Foo {\n" + "    void foo() {\n" + "        assert i + j + k + l + n + m <= 2 : \"assert description\";" + "    }\n" + "}",
+         "class Foo {\n" +
+         "  void foo() {\n" +
+         "    assert\n" +
+         "      i + j + k + l + n + m <= 2 :\n" +
+         "      \"assert description\";\n" +
+         "  }\n" +
+         "}");
+     }
+     finally {
+       LanguageLevelProjectExtension.getInstance(facade.getProject()).setLanguageLevel(effectiveLanguageLevel);
+     }
+   }
+   public void test() throws Exception {
+     getSettings().getIndentOptions(StdFileTypes.JAVA).INDENT_SIZE = 2;
+     getSettings().getIndentOptions(StdFileTypes.JAVA).CONTINUATION_INDENT_SIZE = 2;
+     getSettings().RIGHT_MARGIN = 37;
+     getSettings().ALIGN_MULTILINE_EXTENDS_LIST = true;
+     getSettings().EXTENDS_KEYWORD_WRAP = CodeStyleSettings.WRAP_AS_NEEDED;
+     getSettings().EXTENDS_LIST_WRAP = CodeStyleSettings.WRAP_AS_NEEDED;
+     getSettings().ASSERT_STATEMENT_WRAP = CodeStyleSettings.WRAP_AS_NEEDED;
+     getSettings().ASSERT_STATEMENT_COLON_ON_NEXT_LINE = false;
+     getSettings().ALIGN_MULTILINE_BINARY_OPERATION = true;
+     final JavaPsiFacade facade = getJavaFacade();
+     final LanguageLevel effectiveLanguageLevel = LanguageLevelProjectExtension.getInstance(facade.getProject()).getLanguageLevel();
+     LanguageLevelProjectExtension.getInstance(facade.getProject()).setLanguageLevel(LanguageLevel.JDK_1_5);
+     try {
+       doTextTest("public class ThisIsASampleClass extends C1 implements I1, I2, I3, I4, I5 {\n" +
+                  "  public void longerMethod() {\n" +
+                  "    assert i + j + k + l + n+ m <= 2 : \"assert description\";" +
+                  "  }\n" +
+ "}", "public class ThisIsASampleClass\n" +
+      "  extends C1\n" +
+      "  implements I1, I2, I3, I4, I5 {\n" +
+      "  public void longerMethod() {\n" +
+      "    assert\n" +
+      "      i + j + k + l + n + m <= 2 :\n" +
+      "      \"assert description\";\n" +
+      "  }\n" +
+      "}");
+     }
+     finally {
+       LanguageLevelProjectExtension.getInstance(facade.getProject()).setLanguageLevel(effectiveLanguageLevel);
+     }
+   }
+   public void testLBrace() throws Exception {
+     getSettings().METHOD_BRACE_STYLE = CodeStyleSettings.END_OF_LINE;
+     getSettings().RIGHT_MARGIN = 14;
+     doTextTest("class Foo {\n" + "    void foo() {\n" + "        \n" + "    }\n" + "}",
+                "class Foo {\n" + "    void foo() {\n" + "\n" + "    }\n" + "}");
+   }
+   public void testSCR2632() throws Exception {
+     getSettings().ENABLE_JAVADOC_FORMATTING = true;
+     getSettings().WRAP_COMMENTS = true;
+     getSettings().RIGHT_MARGIN = 20;
+     doTextTest("/**\n" + " * <p />\n" + " * Another paragraph of the description placed after blank line.\n" + " */\n" + "class A{}",
+                "/**\n" +
+                " * <p/>\n" +
+                " * Another paragraph\n" +
+                " * of the description\n" +
+                " * placed after\n" +
+                " * blank line.\n" +
+                " */\n" +
+                "class A {\n" +
+                "}");
+   }
+   public void testSCR1486() throws Exception {
+     doTextTest("public class Test {\n" + "  private BigDecimal\n" + "}", "public class Test {\n" + "    private BigDecimal\n" + "}");
+     doTextTest("public class Test {\n" + "  @NotNull private BigDecimal\n" + "}",
+                "public class Test {\n" + "    @NotNull\n" + "    private BigDecimal\n" + "}");
+   }
+   public void testJavaDocLeadingAsterisksAreDisabled() throws Exception {
+     getSettings().JD_LEADING_ASTERISKS_ARE_ENABLED = false;
+     doTextTest("class Foo {\n" +
+                "    /**\n" +
+                "     @param i\n" +
+                "     @param j\n" +
+                "    */\n" +
+                "    void foo(int i, int j) {\n" +
+                "    }\n" +
+ "}", "class Foo {\n" +
+      "    /**\n" +
+      "     @param i\n" +
+      "     @param j\n" +
+      "     */\n" +
+      "    void foo(int i, int j) {\n" +
+      "    }\n" +
+      "}");
+   }
+   public void testBinaryExpression() throws Exception {
+     getSettings().ALIGN_MULTILINE_BINARY_OPERATION = true;
+     doTextTest("class Foo {\n" +
+                "    void foo() {\n" +
+                "        if (event.isConsumed() &&\n" +
+                "condition2) {\n" +
+                "      return;\n" +
+                "    }\n" +
+                "    }\n" +
+ "}", "class Foo {\n" +
+      "    void foo() {\n" +
+      "        if (event.isConsumed() &&\n" +
+      "            condition2) {\n" +
+      "            return;\n" +
+      "        }\n" +
+      "    }\n" +
+      "}");
+   }
+   public void testCaseBraces() throws Exception {
+     doTextTest("class Foo{\n" +
+                "    void foo() {\n" +
+                "        switch (a) {\n" +
+                "            case 0: {\n" +
+                "            }\n" +
+                "        }\n" +
+                "    }\n" +
+ "}", "class Foo {\n" +
+      "    void foo() {\n" +
+      "        switch (a) {\n" +
+      "            case 0: {\n" +
+      "            }\n" +
+      "        }\n" +
+      "    }\n" +
+      "}");
+   }
+   public void testFormatCodeFragment() throws Exception {
+     final PsiElementFactory factory = JavaPsiFacade.getInstance(getProject()).getElementFactory();
+     final PsiCodeFragment fragment = factory.createCodeBlockCodeFragment("a=1;int b=2;", null, true);
+     final PsiElement[] result = new PsiElement[1];
+     CommandProcessor.getInstance().executeCommand(getProject(), new Runnable() {
+       public void run() {
+         ApplicationManager.getApplication().runWriteAction(new Runnable() {
+           public void run() {
+             try {
+               result[0] = CodeStyleManager.getInstance(getProject()).reformat(fragment);
+             }
+             catch (IncorrectOperationException e) {
+               assertTrue(e.getLocalizedMessage(), false);
+             }
+           }
+         });
+       }
+     }, null, null);
+     assertEquals("a = 1;\n" + "int b = 2;", result[0].getText());
+   }
+   public void test1607() throws Exception {
+     getSettings().RIGHT_MARGIN = 30;
+     getSettings().METHOD_BRACE_STYLE = CodeStyleSettings.NEXT_LINE;
+     getSettings().KEEP_SIMPLE_METHODS_IN_ONE_LINE = true;
+     getSettings().ALIGN_MULTILINE_PARAMETERS = true;
+     getSettings().METHOD_PARAMETERS_WRAP = CodeStyleSettings.WRAP_AS_NEEDED;
+     doTextTest("class TEst {\n" + "void foo(A a,B b){ /* compiled code */ }\n" + "}",
+                "class TEst {\n" + "    void foo(A a, B b)\n" + "    { /* compiled code */ }\n" + "}");
+   }
+   public void testSCR1615() throws Exception {
+     getSettings().CLASS_BRACE_STYLE = CodeStyleSettings.NEXT_LINE_SHIFTED;
+     getSettings().METHOD_BRACE_STYLE = CodeStyleSettings.NEXT_LINE_SHIFTED;
+     getSettings().BRACE_STYLE = CodeStyleSettings.NEXT_LINE_SHIFTED;
+     doTextTest(
+       "public class ZZZZ \n" + "   { \n" + "   public ZZZZ() \n" + "      { \n" + "      if (a){\n" + "foo();}\n" + "      } \n" + "   }",
+       "public class ZZZZ\n" +
+       "    {\n" +
+       "    public ZZZZ()\n" +
+       "        {\n" +
+       "        if (a)\n" +
+       "            {\n" +
+       "            foo();\n" +
+       "            }\n" +
+       "        }\n" +
+       "    }");
+   }
+   public void testNewLineAfterJavaDocs() throws Exception {
+     doTextTest("/** @noinspection InstanceVariableNamingConvention*/class Foo{\n" +
+                "/** @noinspection InstanceVariableNamingConvention*/int myFoo;\n" +
+ "/** @noinspection InstanceVariableNamingConvention*/ void foo(){}}", "/**\n" +
+                                                                       " * @noinspection InstanceVariableNamingConvention\n" +
+                                                                       " */\n" +
+                                                                       "class Foo {\n" +
+                                                                       "    /**\n" +
+                                                                       "     * @noinspection InstanceVariableNamingConvention\n" +
+                                                                       "     */\n" +
+                                                                       "    int myFoo;\n" +
+                                                                       "\n" +
+                                                                       "    /**\n" +
+                                                                       "     * @noinspection InstanceVariableNamingConvention\n" +
+                                                                       "     */\n" +
+                                                                       "    void foo() {\n" +
+                                                                       "    }\n" +
+                                                                       "}");
+   }
+   public void testArrayInitializerWrapping() throws Exception {
+     getSettings().ARRAY_INITIALIZER_WRAP = CodeStyleSettings.WRAP_AS_NEEDED;
+     getSettings().ALIGN_MULTILINE_ARRAY_INITIALIZER_EXPRESSION = false;
+     getSettings().RIGHT_MARGIN = 37;
+     doTextTest("class Foo{\n" +
+                "    public int[] i = new int[]{1,2,3,4,5,6,7,8,9};\n" +
+                "    void foo() {\n" +
+                "        foo(new int[]{1,2,3,4,5,6,7,8,9});\n" +
+                "    }" +
+ "}", "class Foo {\n" +
+      "    public int[] i = new int[]{1, 2,\n" +
+      "            3, 4, 5, 6, 7, 8, 9};\n" +
+      "\n" +
+      "    void foo() {\n" +
+      "        foo(new int[]{1, 2, 3, 4, 5,\n" +
+      "                6, 7, 8, 9});\n" +
+      "    }\n" +
+      "}");
+     getSettings().ALIGN_MULTILINE_ARRAY_INITIALIZER_EXPRESSION = true;
+     doTextTest("class Foo{\n" +
+                "    public int[] i = new int[]{1,2,3,4,5,6,7,8,9};\n" +
+                "    void foo() {\n" +
+                "        foo(new int[]{1,2,3,4,5,6,7,8,9});\n" +
+                "    }" +
+ "}", "class Foo {\n" +
+      "    public int[] i = new int[]{1, 2,\n" +
+      "                               3, 4,\n" +
+      "                               5, 6,\n" +
+      "                               7, 8,\n" +
+      "                               9};\n" +
+      "\n" +
+      "    void foo() {\n" +
+      "        foo(new int[]{1, 2, 3, 4, 5,\n" +
+      "                      6, 7, 8, 9});\n" +
+      "    }\n" +
+      "}");
+   }
+   public void testSCR3062() throws Exception {
+     getSettings().KEEP_LINE_BREAKS = false;
+     getSettings().METHOD_CALL_CHAIN_WRAP = CodeStyleSettings.WRAP_AS_NEEDED;
+     getSettings().CALL_PARAMETERS_WRAP = CodeStyleSettings.WRAP_AS_NEEDED;
+     getSettings().ALIGN_MULTILINE_PARAMETERS_IN_CALLS = true;
+     getSettings().RIGHT_MARGIN = 80;
+     getSettings().PREFER_PARAMETERS_WRAP = true;
+     doTextTest("public class Foo { \n" +
+                "    public static void main() { \n" +
+                "        foo.foobelize().foobelize().foobelize().bar(\"The quick brown\", \n" +
+                "                                                    \"fox jumped over\", \n" +
+                "                                                    \"the lazy\", \"dog\"); \n" +
+                "    } \n" +
+ "}", "public class Foo {\n" +
+      "    public static void main() {\n" +
+      "        foo.foobelize().foobelize().foobelize().bar(\"The quick brown\",\n" +
+      "                                                    \"fox jumped over\",\n" +
+      "                                                    \"the lazy\", \"dog\");\n" +
+      "    }\n" +
+      "}");
+     getSettings().PREFER_PARAMETERS_WRAP = false;
+     doTextTest("public class Foo { \n" +
+                "    public static void main() { \n" +
+                "        foo.foobelize().foobelize().foobelize().bar(\"The quick brown\", \n" +
+                "                                                    \"fox jumped over\", \n" +
+                "                                                    \"the lazy\", \"dog\"); \n" +
+                "    } \n" +
+ "}", "public class Foo {\n" +
+      "    public static void main() {\n" +
+      "        foo.foobelize().foobelize().foobelize()\n" +
+      "                .bar(\"The quick brown\", \"fox jumped over\", \"the lazy\", \"dog\");\n" +
+      "    }\n" +
+      "}");
+   }
+   public void testSCR1658() throws Exception {
+     doTextTest("/** \n" + " * @author\tMike\n" + " */\n" + "public class Foo {\n" + "}",
+                "/**\n" + " * @author Mike\n" + " */\n" + "public class Foo {\n" + "}");
+   }
+   public void testSCR1699() throws Exception {
+     doTextTest("class Test {\n" + "    Test(String t1 , String t2) {\n" + "    }\n" + "}",
+                "class Test {\n" + "    Test(String t1, String t2) {\n" + "    }\n" + "}");
+   }
+   public void testSCR1700() throws Exception {
+     doTextTest("class Test {\n" + "    Test(String      t1 , String      t2) {\n" + "    }\n" + "}",
+                "class Test {\n" + "    Test(String t1, String t2) {\n" + "    }\n" + "}");
+   }
+   public void testSCR1701() throws Exception {
+     getSettings().SPACE_WITHIN_METHOD_CALL_PARENTHESES = true;
+     getSettings().SPACE_WITHIN_METHOD_PARENTHESES = false;
+     getSettings().CALL_PARAMETERS_WRAP = CodeStyleSettings.DO_NOT_WRAP;
+     getSettings().CALL_PARAMETERS_LPAREN_ON_NEXT_LINE = true;
+     getSettings().CALL_PARAMETERS_RPAREN_ON_NEXT_LINE = true;
+     doTextTest("class Foo {\n" + "    void foo() {\n" + "        foo(a,b);" + "    }\n" + "}",
+                "class Foo {\n" + "    void foo() {\n" + "        foo( a, b );\n" + "    }\n" + "}");
+   }
+   public void testSCR1703() throws Exception {
+     getSettings().BRACE_STYLE = CodeStyleSettings.NEXT_LINE;
+     doTextTest("class Foo{\n" +
+                "    void foo() {\n" +
+                "        for (Object o : localizations) {\n" +
+                "            //do something \n" +
+                "        }\n" +
+                "    }\n" +
+ "}", "class Foo {\n" +
+      "    void foo() {\n" +
+      "        for (Object o : localizations)\n" +
+      "        {\n" +
+      "            //do something \n" +
+      "        }\n" +
+      "    }\n" +
+      "}");
+   }
+   public void testJavaDocIndentation() throws Exception {
+     getSettings().getIndentOptions(StdFileTypes.JAVA).INDENT_SIZE = 2;
+     getSettings().getIndentOptions(StdFileTypes.JAVA).CONTINUATION_INDENT_SIZE = 2;
+     getSettings().getIndentOptions(StdFileTypes.JAVA).TAB_SIZE = 4;
+     getSettings().ENABLE_JAVADOC_FORMATTING = false;
+     doTextTest("public interface PsiParser {\n" +
+                "  /**\n" +
+                "   * Parses the contents of the specified PSI builder and returns an AST tree with the\n" +
+                "   * specified type of root element. The PSI builder contents is the entire file\n" +
+                "   * or (if chameleon tokens are used) the text of a chameleon token which needs to\n" +
+                "   * be reparsed.\n" +
+                "   * @param root the type of the root element in the AST tree.\n" +
+                "   * @param builder the builder which is used to retrieve the original file tokens and build the AST tree.\n" +
+                "   * @return the root of the resulting AST tree.\n" +
+                "   */\n" +
+                "  ASTNode parse(IElementType root, PsiBuilder builder);\n" +
+ "}", "public interface PsiParser {\n" +
+      "  /**\n" +
+      "   * Parses the contents of the specified PSI builder and returns an AST tree with the\n" +
+      "   * specified type of root element. The PSI builder contents is the entire file\n" +
+      "   * or (if chameleon tokens are used) the text of a chameleon token which needs to\n" +
+      "   * be reparsed.\n" +
+      "   * @param root the type of the root element in the AST tree.\n" +
+      "   * @param builder the builder which is used to retrieve the original file tokens and build the AST tree.\n" +
+      "   * @return the root of the resulting AST tree.\n" +
+      "   */\n" +
+      "  ASTNode parse(IElementType root, PsiBuilder builder);\n" +
+      "}");
+   }
+   public void testSCR1804() throws Exception {
+     getSettings().ALIGN_MULTILINE_ASSIGNMENT = true;
+     doTextTest(
+       "class Foo {\n" + "    void foo() {\n" + "        int i;\n" + "        i = \n" + "                1 + 2;\n" + "    }\n" + "}",
+       "class Foo {\n" + "    void foo() {\n" + "        int i;\n" + "        i =\n" + "                1 + 2;\n" + "    }\n" + "}");
+     doTextTest("class Foo {\n" + "    void foo() {\n" + "        i = j =\n" + "        k = l = 1 + 2;\n" + "    }\n" + "}",
+                "class Foo {\n" + "    void foo() {\n" + "        i = j =\n" + "        k = l = 1 + 2;\n" + "    }\n" + "}");
+   }
+   public void testSCR1795() throws Exception {
+     getSettings().BRACE_STYLE = CodeStyleSettings.NEXT_LINE_IF_WRAPPED;
+     doTextTest("public class Test {\n" +
+                "    public static void main(String[] args) {\n" +
+                "        do {\n" +
+                "            // ...\n" +
+                "        } while (true);\n" +
+                "    }\n" +
+ "}", "public class Test {\n" +
+      "    public static void main(String[] args) {\n" +
+      "        do {\n" +
+      "            // ...\n" +
+      "        } while (true);\n" +
+      "    }\n" +
+      "}");
+   }
+   public void testSCR1936() throws Exception {
+     getSettings().BLANK_LINES_AFTER_CLASS_HEADER = 4;
+     doTextTest("/**\n" + " * Foo - test class\n" + " */\n" + "class Foo{\n" + "}",
+                "/**\n" + " * Foo - test class\n" + " */\n" + "class Foo {\n" + "\n" + "\n" + "\n" + "\n" + "}");
+     doTextTest("/**\n" + " * Foo - test class\n" + " */\n" + "class Foo{\n" + "    int myFoo;\n" + "}",
+                "/**\n" + " * Foo - test class\n" + " */\n" + "class Foo {\n" + "\n" + "\n" + "\n" + "\n" + "    int myFoo;\n" + "}");
+   }
+   public void testRemoveLineBreak() throws Exception {
+     getSettings().KEEP_LINE_BREAKS = true;
+     getSettings().CLASS_BRACE_STYLE = CodeStyleSettings.END_OF_LINE;
+     getSettings().METHOD_BRACE_STYLE = CodeStyleSettings.END_OF_LINE;
+     getSettings().BRACE_STYLE = CodeStyleSettings.END_OF_LINE;
+     doTextTest("class A\n" + "{\n" + "}", "class A {\n" + "}");
+     doTextTest("class A {\n" + "    void foo()\n" + "    {\n" + "    }\n" + "}", "class A {\n" + "    void foo() {\n" + "    }\n" + "}");
+     doTextTest("class A {\n" + "    void foo()\n" + "    {\n" + "        if (a)\n" + "        {\n" + "        }\n" + "    }\n" + "}",
+                "class A {\n" + "    void foo() {\n" + "        if (a) {\n" + "        }\n" + "    }\n" + "}");
+   }
+   public void testBlankLines() throws Exception {
+     getSettings().KEEP_BLANK_LINES_IN_DECLARATIONS = 0;
+     getSettings().KEEP_BLANK_LINES_IN_CODE = 0;
+     getSettings().KEEP_BLANK_LINES_BEFORE_RBRACE = 0;
+     getSettings().BLANK_LINES_AFTER_CLASS_HEADER = 0;
+     getSettings().BLANK_LINES_AFTER_IMPORTS = 0;
+     getSettings().BLANK_LINES_AFTER_PACKAGE = 0;
+     getSettings().BLANK_LINES_AROUND_CLASS = 0;
+     getSettings().BLANK_LINES_AROUND_FIELD = 0;
+     getSettings().BLANK_LINES_AROUND_METHOD = 0;
+     getSettings().BLANK_LINES_BEFORE_IMPORTS = 0;
+     getSettings().BLANK_LINES_BEFORE_PACKAGE = 0;
+     getSettings().BLANK_LINES_AROUND_FIELD_IN_INTERFACE = 2;
+     getSettings().BLANK_LINES_AROUND_METHOD_IN_INTERFACE = 3;
+     doTextTest("/*\n" +
+                " * This is a sample file.\n" +
+                " */\n" +
+                "package com.intellij.samples;\n" +
+                "\n" +
+                "import com.intellij.idea.Main;\n" +
+                "\n" +
+                "import javax.swing.*;\n" +
+                "import java.util.Vector;\n" +
+                "\n" +
+                "public class Foo {\n" +
+                "    private int field1;\n" +
+                "    private int field2;\n" +
+                "\n" +
+                "    public void foo1() {\n" +
+                "\n" +
+                "    }\n" +
+                "\n" +
+                "    public void foo2() {\n" +
+                "\n" +
+                "    }\n" +
+                "\n" +
+                "}",
+                "/*\n" +
+                " * This is a sample file.\n" +
+                " */\n" +
+                "package com.intellij.samples;\n" +
+                "import com.intellij.idea.Main;\n" +
+                "\n" +
+                "import javax.swing.*;\n" +
+                "import java.util.Vector;\n" +
+                "public class Foo {\n" +
+                "    private int field1;\n" +
+                "    private int field2;\n" +
+                "    public void foo1() {\n" +
+                "    }\n" +
+                "    public void foo2() {\n" +
+                "    }\n" +
+                "}");
+     doTextTest("interface Foo {\n" +
+                "    int field1;\n" +
+                "    int field2;\n" +
+                "\n" +
+                "    void foo1();\n" +
+                "\n" +
+                "    void foo2();\n" +
+                "\n" +
+                "}",
+                "interface Foo {\n" +
+                "    int field1;\n" +
+                "\n" +
+                "\n" +
+                "    int field2;\n" +
+                "\n" +
+                "\n" +
+                "\n" +
+                "    void foo1();\n" +
+                "\n" +
+                "\n" +
+                "\n" +
+                "    void foo2();\n" +
+                "}");
+   }
+   public void test1980() throws Exception {
+     getSettings().RIGHT_MARGIN = 144;
+     getSettings().TERNARY_OPERATION_WRAP = CodeStyleSettings.WRAP_ON_EVERY_ITEM;
+     getSettings().METHOD_CALL_CHAIN_WRAP = CodeStyleSettings.WRAP_AS_NEEDED;
+     getSettings().ALIGN_MULTILINE_TERNARY_OPERATION = true;
+     getSettings().TERNARY_OPERATION_SIGNS_ON_NEXT_LINE = true;
+     doTextTest("class Foo{\n" +
+                "    void foo() {\n" +
+                "final VirtualFile moduleRoot = moduleRelativePath.equals(\"\") ? projectRootDirAfter : projectRootDirAfter.findFileByRelativePath(moduleRelativePath);\n" +
+                "    }\n" +
+ "}", "class Foo {\n" +
+      "    void foo() {\n" +
+      "        final VirtualFile moduleRoot = moduleRelativePath.equals(\"\")\n" +
+      "                                       ? projectRootDirAfter\n" +
+      "                                       : projectRootDirAfter.findFileByRelativePath(moduleRelativePath);\n" +
+      "    }\n" +
+      "}");
+   }
+   public void testStaticBlockBraces() throws Exception {
+     getSettings().BRACE_STYLE = CodeStyleSettings.END_OF_LINE;
+     doTextTest("class Foo {\n" + "    static {\n" + "        //comment\n" + "        i = foo();\n" + "    }\n" + "}",
+                "class Foo {\n" + "    static {\n" + "        //comment\n" + "        i = foo();\n" + "    }\n" + "}");
+     getSettings().BRACE_STYLE = CodeStyleSettings.NEXT_LINE_IF_WRAPPED;
+     doTextTest("class Foo {\n" + "    static {\n" + "        //comment\n" + "        i = foo();\n" + "    }\n" + "}",
+                "class Foo {\n" + "    static {\n" + "        //comment\n" + "        i = foo();\n" + "    }\n" + "}");
+     getSettings().BRACE_STYLE = CodeStyleSettings.NEXT_LINE;
+     doTextTest("class Foo {\n" + "    static {\n" + "        //comment\n" + "        i = foo();\n" + "    }\n" + "}",
+                "class Foo {\n" + "    static\n" + "    {\n" + "        //comment\n" + "        i = foo();\n" + "    }\n" + "}");
+     getSettings().BRACE_STYLE = CodeStyleSettings.NEXT_LINE_SHIFTED;
+     doTextTest("class Foo {\n" + "    static {\n" + "        //comment\n" + "        i = foo();\n" + "        }\n" + "}",
+                "class Foo {\n" + "    static\n" + "        {\n" + "        //comment\n" + "        i = foo();\n" + "        }\n" + "}");
+     getSettings().BRACE_STYLE = CodeStyleSettings.NEXT_LINE_SHIFTED2;
+     doTextTest("class Foo {\n" + "    static {\n" + "        //comment\n" + "        i = foo();\n" + "    }\n" + "}", "class Foo {\n" +
+                                                                                                                       "    static\n" +
+                                                                                                                       "        {\n" +
+                                                                                                                       "            //comment\n" +
+                                                                                                                       "            i = foo();\n" +
+                                                                                                                       "        }\n" +
+                                                                                                                       "}");
+   }
+   public void testSCR2089() throws Exception {
+     doTextTest("class Test { \n" +
+                "    void test(int i) { \n" +
+                "        switch (i) { \n" +
+                "            case 1: { \n" +
+                "                int x = 0; \n" +
+                "                System.out.println(x); \n" +
+                "            } \n" +
+                "                break; \n" +
+                "            case 2: { \n" +
+                "                int y = 0; \n" +
+                "                System.out.println(y); \n" +
+                "            } \n" +
+                "                break; \n" +
+                "        } \n" +
+                "    } \n" +
+ "}", "class Test {\n" +
+      "    void test(int i) {\n" +
+      "        switch (i) {\n" +
+      "            case 1: {\n" +
+      "                int x = 0;\n" +
+      "                System.out.println(x);\n" +
+      "            }\n" +
+      "            break;\n" +
+      "            case 2: {\n" +
+      "                int y = 0;\n" +
+      "                System.out.println(y);\n" +
+      "            }\n" +
+      "            break;\n" +
+      "        }\n" +
+      "    }\n" +
+      "}");
+   }
+   public void testBraces2() throws Exception {
+     getSettings().BRACE_STYLE = CodeStyleSettings.NEXT_LINE_IF_WRAPPED;
+     doTextTest("class Foo {\n" +
+                "    void foo() {\n" +
+                "         if (clientSocket == null)\n" +
+                "        {\n" +
+                "            return false;\n" +
+                "        }" +
+                "    }\n" +
+ "}", "class Foo {\n" +
+      "    void foo() {\n" +
+      "        if (clientSocket == null) {\n" +
+      "            return false;\n" +
+      "        }\n" +
+      "    }\n" +
+      "}");
+     doTextTest("class Foo {\n" +
+                "    void foo() {\n" +
+                "         for (int i = 0; i < 10; i++)\n" +
+                "        {\n" +
+                "            return false;\n" +
+                "        }" +
+                "    }\n" +
+ "}", "class Foo {\n" +
+      "    void foo() {\n" +
+      "        for (int i = 0; i < 10; i++) {\n" +
+      "            return false;\n" +
+      "        }\n" +
+      "    }\n" +
+      "}");
+     doTextTest("class Foo {\n" +
+                "    void foo() {\n" +
+                "         for (Object i : collection)\n" +
+                "        {\n" +
+                "            return false;\n" +
+                "        }" +
+                "    }\n" +
+ "}", "class Foo {\n" +
+      "    void foo() {\n" +
+      "        for (Object i : collection) {\n" +
+      "            return false;\n" +
+      "        }\n" +
+      "    }\n" +
+      "}");
+     doTextTest("class Foo {\n" +
+                "    void foo() {\n" +
+                "         while (i  >0)\n" +
+                "        {\n" +
+                "            return false;\n" +
+                "        }" +
+                "    }\n" +
+ "}", "class Foo {\n" +
+      "    void foo() {\n" +
+      "        while (i > 0) {\n" +
+      "            return false;\n" +
+      "        }\n" +
+      "    }\n" +
+      "}");
+     getSettings().METHOD_BRACE_STYLE = CodeStyleSettings.NEXT_LINE_IF_WRAPPED;
+     doTextTest("class Foo{\n" + "    /**\n" + "     *\n" + "     */\n" + "    void foo() {\n" + "    }\n" + "}",
+                "class Foo {\n" + "    /**\n" + "     *\n" + "     */\n" + "    void foo() {\n" + "    }\n" + "}");
+     getSettings().CLASS_BRACE_STYLE = CodeStyleSettings.NEXT_LINE_IF_WRAPPED;
+     doTextTest("/**\n" + " *\n" + " */\n" + "class Foo\n{\n" + "}", "/**\n" + " *\n" + " */\n" + "class Foo {\n" + "}");
+     doTextTest("/**\n" + " *\n" + " */\n" + "class Foo\n extends B\n{\n" + "}",
+                "/**\n" + " *\n" + " */\n" + "class Foo\n        extends B\n" + "{\n" + "}");
+   }
+   public void testSCR2122() throws Exception {
+     getSettings().BLANK_LINES_AFTER_CLASS_HEADER = 3;
+     doTextTest("class Foo {\n" +
+                "    void foo() {\n" +
+                "        new Runnable() {\n" +
+                "            public void run() {\n" +
+                "            }\n" +
+                "        }\n" +
+                "    }\n" +
+ "}", "class Foo {\n" +
+      "\n" +
+      "\n" +
+      "\n" +
+      "    void foo() {\n" +
+      "        new Runnable() {\n" +
+      "            public void run() {\n" +
+      "            }\n" +
+      "        }\n" +
+      "    }\n" +
+      "}");
+   }
+   public void testSynchronized() throws Exception {
+     getSettings().BRACE_STYLE = CodeStyleSettings.END_OF_LINE;
+     doTextTest("class Foo {\n" + "    void foo() {\n" + "synchronized (this) {foo();\n" + "}\n" + "    }\n" + "}", "class Foo {\n" +
+                                                                                                                    "    void foo() {\n" +
+                                                                                                                    "        synchronized (this) {\n" +
+                                                                                                                    "            foo();\n" +
+                                                                                                                    "        }\n" +
+                                                                                                                    "    }\n" +
+                                                                                                                    "}");
+     getSettings().BRACE_STYLE = CodeStyleSettings.NEXT_LINE;
+     doTextTest("class Foo {\n" + "    void foo() {\n" + "synchronized (this) {foo();\n" + "}\n" + "    }\n" + "}", "class Foo {\n" +
+                                                                                                                    "    void foo() {\n" +
+                                                                                                                    "        synchronized (this)\n" +
+                                                                                                                    "        {\n" +
+                                                                                                                    "            foo();\n" +
+                                                                                                                    "        }\n" +
+                                                                                                                    "    }\n" +
+                                                                                                                    "}");
+     getSettings().BRACE_STYLE = CodeStyleSettings.NEXT_LINE_SHIFTED;
+     doTextTest("class Foo {\n" + "    void foo() {\n" + "synchronized (this) {foo();\n" + "}\n" + "    }\n" + "}", "class Foo {\n" +
+                                                                                                                    "    void foo() {\n" +
+                                                                                                                    "        synchronized (this)\n" +
+                                                                                                                    "            {\n" +
+                                                                                                                    "            foo();\n" +
+                                                                                                                    "            }\n" +
+                                                                                                                    "    }\n" +
+                                                                                                                    "}");
+     getSettings().BRACE_STYLE = CodeStyleSettings.NEXT_LINE_SHIFTED2;
+     doTextTest("class Foo {\n" + "    void foo() {\n" + "synchronized (this) {\n" + "foo();\n" + "}\n" + "    }\n" + "}", "class Foo {\n" +
+                                                                                                                           "    void foo() {\n" +
+                                                                                                                           "        synchronized (this)\n" +
+                                                                                                                           "            {\n" +
+                                                                                                                           "                foo();\n" +
+                                                                                                                           "            }\n" +
+                                                                                                                           "    }\n" +
+                                                                                                                           "}");
+   }
+   public void testSCR2132() throws Exception {
+     getSettings().BRACE_STYLE = CodeStyleSettings.NEXT_LINE_IF_WRAPPED;
+     getSettings().ELSE_ON_NEW_LINE = true;
+     doTextTest("class Foo {\n" +
+                "    void foo() {\n" +
+                "        if (!rightPanel.isAncestorOf(validationPanel)) \n" +
+                "                {\n" +
+                "                    splitPane.setDividerLocation(1.0);\n" +
+                "                }\n" +
+                "                else\n" +
+                "                {\n" +
+                "                    splitPane.setDividerLocation(0.7);\n" +
+                "                }" +
+                "    }\n" +
+ "}", "class Foo {\n" +
+      "    void foo() {\n" +
+      "        if (!rightPanel.isAncestorOf(validationPanel)) {\n" +
+      "            splitPane.setDividerLocation(1.0);\n" +
+      "        }\n" +
+      "        else {\n" +
+      "            splitPane.setDividerLocation(0.7);\n" +
+      "        }\n" +
+      "    }\n" +
+      "}");
+   }
+   public void testNextLineShiftedForBlockStatement() throws Exception {
+     getSettings().BRACE_STYLE = CodeStyleSettings.NEXT_LINE_SHIFTED;
+     doTextTest("class Foo {\n" + "    void foo() {\n" + "        if (a)\n" + "        foo();\n" + "    }\n" + "}",
+                "class Foo {\n" + "    void foo() {\n" + "        if (a)\n" + "            foo();\n" + "    }\n" + "}");
+   }
+   private void doTest() throws Exception {
+     doTest(getTestName(false) + ".java", getTestName(false) + "_after.java");
+   }
+   private void doTest(String fileNameBefore, String fileNameAfter) throws Exception {
+     doTextTest(loadFile(fileNameBefore), loadFile(fileNameAfter));
+   }
+   private void doTextTest(final String text, String textAfter) throws IncorrectOperationException {
+     final PsiFile file = createPseudoPhysicalFile("A.java", text);
+     if (myLineRange != null) {
+       final DocumentImpl document = new DocumentImpl(text);
+       myTextRange =
+         new TextRange(document.getLineStartOffset(myLineRange.getStartOffset()), document.getLineEndOffset(myLineRange.getEndOffset()));
+     }
+     /*
+     CommandProcessor.getInstance().executeCommand(getProject(), new Runnable() {
+       public void run() {
+         ApplicationManager.getApplication().runWriteAction(new Runnable() {
+           public void run() {
+             performFormatting(file);
+           }
+         });
+       }
+     }, null, null);
+     assertEquals(prepareText(textAfter), prepareText(file.getText()));
+       
+     */
+     final PsiDocumentManager manager = PsiDocumentManager.getInstance(getProject());
+     final Document document = manager.getDocument(file);
+     CommandProcessor.getInstance().executeCommand(getProject(), new Runnable() {
+       public void run() {
+         ApplicationManager.getApplication().runWriteAction(new Runnable() {
+           public void run() {
+             document.replaceString(0, document.getTextLength(), text);
+             manager.commitDocument(document);
+             try {
+               if (myTextRange != null) {
+                 CodeStyleManager.getInstance(getProject()).reformatText(file, myTextRange.getStartOffset(), myTextRange.getEndOffset());
+               }
+               else {
+                 CodeStyleManager.getInstance(getProject())
+                   .reformatText(file, file.getTextRange().getStartOffset(), file.getTextRange().getEndOffset());
+               }
+             }
+             catch (IncorrectOperationException e) {
+               assertTrue(e.getLocalizedMessage(), false);
+             }
+           }
+         });
+       }
+     }, "", "");
+     if (document == null) {
+       fail("Don't expect the document to be null");
+       return;
+     }
+     assertEquals(prepareText(textAfter), prepareText(document.getText()));
+     manager.commitDocument(document);
+     assertEquals(prepareText(textAfter), prepareText(file.getText()));
+   }
+   public void testIDEADEV1047() throws Exception {
+     doTextTest("class Foo{\n" + "String field1\n" + ",\n" + "field2\n" + ";" + "}",
+                "class Foo {\n" + "    String field1,\n" + "            field2;\n" + "}");
+     doTextTest("class Foo{\n" + "void foo() {\n" + "    String var1\n" + ",\n" + "var2\n" + ";\n" + "    }\n" + "}",
+                "class Foo {\n" + "    void foo() {\n" + "        String var1,\n" + "                var2;\n" + "    }\n" + "}");
+   }
+   public void testIDEADEV1047_2() throws Exception {
+     doTextTest("class Foo{\n" + "String field1\n" + ",\n" + "field2\n" + "; String field3;" + "}",
+                "class Foo {\n" + "    String field1,\n" + "            field2;\n" + "    String field3;\n" + "}");
+   }
+   public void testFieldWithJavadocAndAnnotation() throws Exception {
+     doTextTest("class Foo {\n" + "    /**\n" + "     * java doc\n" + "     */\n" + "    @NoInspection\n" + "    String field;\n" + "}",
+                "class Foo {\n" + "    /**\n" + "     * java doc\n" + "     */\n" + "    @NoInspection\n" + "    String field;\n" + "}");
+   }
+   public void testSCR2241() throws Exception {
+     getSettings().BRACE_STYLE = CodeStyleSettings.NEXT_LINE_SHIFTED;
+     getSettings().SPECIAL_ELSE_IF_TREATMENT = true;
+     getSettings().ELSE_ON_NEW_LINE = true;
+     doTextTest("class Foo {\n" +
+                "    void foo() {\n" +
+                "        if (a)\n" +
+                "        {\n" +
+                "        }\n" +
+                "        else\n" +
+                "        {\n" +
+                "        }\n" +
+                "    }\n" +
+ "}", "class Foo {\n" +
+      "    void foo() {\n" +
+      "        if (a)\n" +
+      "            {\n" +
+      "            }\n" +
+      "        else\n" +
+      "            {\n" +
+      "            }\n" +
+      "    }\n" +
+      "}");
+   }
+   public void testLongCallChainAfterElse() throws Exception {
+     getSettings().BRACE_STYLE = CodeStyleSettings.NEXT_LINE;
+     getSettings().KEEP_CONTROL_STATEMENT_IN_ONE_LINE = true;
+     getSettings().KEEP_SIMPLE_METHODS_IN_ONE_LINE = true;
+     getSettings().ELSE_ON_NEW_LINE = false;
+     getSettings().RIGHT_MARGIN = 110;
+     getSettings().KEEP_LINE_BREAKS = false;
+     doTextTest("class Foo {\n" +
+                "    void foo() {\n" +
+                "        if (types.length > 1) // returns multiple columns\n" +
+                "        {\n" +
+                "        } else\n" +
+                "            result.add(initializeObject(os, types[0], initializeCollections, initializeAssociations, initializeChildren));" +
+                "    }\n" +
+ "}", "class Foo {\n" +
+      "    void foo() {\n" +
+      "        if (types.length > 1) // returns multiple columns\n" +
+      "        {\n" +
+      "        } else\n" +
+      "            result.add(initializeObject(os, types[0], initializeCollections, initializeAssociations, initializeChildren));\n" +
+      "    }\n" +
+      "}");
+   }
+   public void testSCRIDEA_4783() throws IncorrectOperationException {
+     getSettings().ASSIGNMENT_WRAP = CodeStyleSettings.WRAP_AS_NEEDED;
+     getSettings().METHOD_CALL_CHAIN_WRAP = CodeStyleSettings.WRAP_AS_NEEDED;
+     getSettings().RIGHT_MARGIN = 80;
+     doTextTest("class Foo{\n" +
+                "    void foo() {\n" +
+                "        final CommandRouterProtocolHandler protocolHandler = (CommandRouterProtocolHandler) connection.getProtocolHandler()\n" +
+                "    }\n" +
+ "}", "class Foo {\n" +
+      "    void foo() {\n" +
+      "        final CommandRouterProtocolHandler protocolHandler =\n" +
+      "                (CommandRouterProtocolHandler) connection.getProtocolHandler()\n" +
+      "    }\n" +
+      "}");
+     doTextTest("class Foo{\n" +
+                "    void foo() {\n" +
+                "        protocolHandlerCommandRouterProtocolHandler = (CommandRouterProtocolHandler) connection.getProtocolHandler()\n" +
+                "    }\n" +
+ "}", "class Foo {\n" +
+      "    void foo() {\n" +
+      "        protocolHandlerCommandRouterProtocolHandler =\n" +
+      "                (CommandRouterProtocolHandler) connection.getProtocolHandler()\n" +
+      "    }\n" +
+      "}");
+     doTextTest("class Foo{\n" +
+                "    final CommandRouterProtocolHandler protocolHandler = (CommandRouterProtocolHandler) connection.getProtocolHandler()\n" +
+ "}", "class Foo {\n" +
+      "    final CommandRouterProtocolHandler protocolHandler =\n" +
+      "            (CommandRouterProtocolHandler) connection.getProtocolHandler()\n" +
+      "}");
+     getSettings().PLACE_ASSIGNMENT_SIGN_ON_NEXT_LINE = true;
+     doTextTest("class Foo{\n" +
+                "    void foo() {\n" +
+                "        final CommandRouterProtocolHandler protocolHandler = (CommandRouterProtocolHandler) connection.getProtocolHandler()\n" +
+                "    }\n" +
+ "}", "class Foo {\n" +
+      "    void foo() {\n" +
+      "        final CommandRouterProtocolHandler protocolHandler\n" +
+      "                = (CommandRouterProtocolHandler) connection.getProtocolHandler()\n" +
+      "    }\n" +
+      "}");
+     doTextTest("class Foo{\n" +
+                "    void foo() {\n" +
+                "        protocolHandlerCommandRouterProtocolHandler = (CommandRouterProtocolHandler) connection.getProtocolHandler()\n" +
+                "    }\n" +
+ "}", "class Foo {\n" +
+      "    void foo() {\n" +
+      "        protocolHandlerCommandRouterProtocolHandler\n" +
+      "                = (CommandRouterProtocolHandler) connection.getProtocolHandler()\n" +
+      "    }\n" +
+      "}");
+     doTextTest("class Foo{\n" +
+                "    final CommandRouterProtocolHandler protocolHandler = (CommandRouterProtocolHandler) connection.getProtocolHandler()\n" +
+ "}", "class Foo {\n" +
+      "    final CommandRouterProtocolHandler protocolHandler\n" +
+      "            = (CommandRouterProtocolHandler) connection.getProtocolHandler()\n" +
+      "}");
+   }
+   public void testSCRIDEADEV_2292() throws IncorrectOperationException {
+     getSettings().KEEP_CONTROL_STATEMENT_IN_ONE_LINE = false;
+     getSettings().WHILE_ON_NEW_LINE = true;
+     final JavaPsiFacade facade = getJavaFacade();
+     final LanguageLevel stored = LanguageLevelProjectExtension.getInstance(facade.getProject()).getLanguageLevel();
+     LanguageLevelProjectExtension.getInstance(facade.getProject()).setLanguageLevel(LanguageLevel.JDK_1_5);
+     try {
+       doTextTest("class Foo {\n" + "    void foo() {\n" + "        if (a) foo();\n" + "        else bar();\n" + "    }\n" + "}",
+                  "class Foo {\n" +
+                  "    void foo() {\n" +
+                  "        if (a)\n" +
+                  "            foo();\n" +
+                  "        else\n" +
+                  "            bar();\n" +
+                  "    }\n" +
+                  "}");
+       doTextTest("class Foo {\n" + "    void foo() {\n" + "        for (int i = 0; i < 10; i++) foo();\n" + "    }\n" + "}",
+                  "class Foo {\n" +
+                  "    void foo() {\n" +
+                  "        for (int i = 0; i < 10; i++)\n" +
+                  "            foo();\n" +
+                  "    }\n" +
+                  "}");
+       doTextTest("class Foo {\n" + "    void foo() {\n" + "        for (int var : vars) foo();\n" + "    }\n" + "}",
+                  "class Foo {\n" + "    void foo() {\n" + "        for (int var : vars)\n" + "            foo();\n" + "    }\n" + "}");
+       doTextTest("class Foo {\n" + "    void foo() {\n" + "        do foo(); while (true);\n" + "    }\n" + "}", "class Foo {\n" +
+                                                                                                                  "    void foo() {\n" +
+                                                                                                                  "        do\n" +
+                                                                                                                  "            foo();\n" +
+                                                                                                                  "        while (true);\n" +
+                                                                                                                  "    }\n" +
+                                                                                                                  "}");
+       doTextTest("class Foo {\n" + "    void foo() {\n" + "        while(true) foo();\n" + "    }\n" + "}",
+                  "class Foo {\n" + "    void foo() {\n" + "        while (true)\n" + "            foo();\n" + "    }\n" + "}");
+       getSettings().KEEP_CONTROL_STATEMENT_IN_ONE_LINE = true;
+       getSettings().WHILE_ON_NEW_LINE = false;
+       doTextTest("class Foo {\n" + "    void foo() {\n" + "        if (a) foo();\n" + "        else bar();\n" + "    }\n" + "}",
+                  "class Foo {\n" + "    void foo() {\n" + "        if (a) foo();\n" + "        else bar();\n" + "    }\n" + "}");
+       doTextTest("class Foo {\n" + "    void foo() {\n" + "        for (int i = 0; i < 10; i++) foo();\n" + "    }\n" + "}",
+                  "class Foo {\n" + "    void foo() {\n" + "        for (int i = 0; i < 10; i++) foo();\n" + "    }\n" + "}");
+       doTextTest("class Foo {\n" + "    void foo() {\n" + "        for (int var : vars) foo();\n" + "    }\n" + "}",
+                  "class Foo {\n" + "    void foo() {\n" + "        for (int var : vars) foo();\n" + "    }\n" + "}");
+       doTextTest("class Foo {\n" + "    void foo() {\n" + "        do foo(); while (true);\n" + "    }\n" + "}",
+                  "class Foo {\n" + "    void foo() {\n" + "        do foo(); while (true);\n" + "    }\n" + "}");
+       doTextTest("class Foo {\n" + "    void foo() {\n" + "        while(true) foo();\n" + "    }\n" + "}",
+                  "class Foo {\n" + "    void foo() {\n" + "        while (true) foo();\n" + "    }\n" + "}");
+       getSettings().RIGHT_MARGIN = 17;
+       doTextTest("class Foo {\n" + "    void foo() {\n" + "        if (a) foo();\n" + "        else bar();\n" + "    }\n" + "}",
+                  "class Foo {\n" +
+                  "    void foo() {\n" +
+                  "        if (a)\n" +
+                  "            foo();\n" +
+                  "        else\n" +
+                  "            bar();\n" +
+                  "    }\n" +
+                  "}");
+       getSettings().RIGHT_MARGIN = 30;
+       doTextTest("class Foo {\n" + "    void foo() {\n" + "        for (int i = 0; i < 10; i++) foo();\n" + "    }\n" + "}",
+                  "class Foo {\n" +
+                  "    void foo() {\n" +
+                  "        for (int i = 0; i < 10; i++)\n" +
+                  "            foo();\n" +
+                  "    }\n" +
+                  "}");
+       getSettings().RIGHT_MARGIN = 32;
+       doTextTest("class Foo {\n" + "    void foo() {\n" + "        for (int var : vars) foo();\n" + "    }\n" + "}",
+                  "class Foo {\n" + "    void foo() {\n" + "        for (int var : vars)\n" + "            foo();\n" + "    }\n" + "}");
+       getSettings().RIGHT_MARGIN = 12;
+       doTextTest("class Foo {\n" + "    void foo() {\n" + "        do foo(); while (true);\n" + "    }\n" + "}", "class Foo {\n" +
+                                                                                                                  "    void foo() {\n" +
+                                                                                                                  "        do\n" +
+                                                                                                                  "            foo();\n" +
+                                                                                                                  "        while (true);\n" +
+                                                                                                                  "    }\n" +
+                                                                                                                  "}");
+       getSettings().RIGHT_MARGIN = 23;
+       doTextTest("class Foo {\n" + "    void foo() {\n" + "        while(true) foo();\n" + "    }\n" + "}",
+                  "class Foo {\n" + "    void foo() {\n" + "        while (true)\n" + "            foo();\n" + "    }\n" + "}");
+     }
+     finally {
+       LanguageLevelProjectExtension.getInstance(facade.getProject()).setLanguageLevel(stored);
+     }
+   }
+   public void testSCR3115() throws Exception {
+     final CodeStyleSettings.IndentOptions indentOptions = getSettings().getIndentOptions(StdFileTypes.JAVA);
+     indentOptions.USE_TAB_CHARACTER = true;
+     indentOptions.SMART_TABS = true;
+     getSettings().ALIGN_MULTILINE_ARRAY_INITIALIZER_EXPRESSION = true;
+     doTextTest("class Foo {\n" +
+                "\tpublic void test(String[] args) {\n" +
+                "\t\tfoo(new String[] {\n" +
+                "\t\t\t\t\"1\",\n" +
+                "\t\t        \"2\",\n" +
+                "\t\t        \"3\"});\n" +
+                "\t}\n" +
+ "}", "class Foo {\n" +
+      "\tpublic void test(String[] args) {\n" +
+      "\t\tfoo(new String[]{\n" +
+      "\t\t\t\t\"1\",\n" +
+      "\t\t\t\t\"2\",\n" +
+      "\t\t\t\t\"3\"});\n" +
+      "\t}\n" +
+      "}");
+   }
+   public void testSpacesIncode() throws Exception {
+     final JavaPsiFacade facade = getJavaFacade();
+     final LanguageLevel level = LanguageLevelProjectExtension.getInstance(facade.getProject()).getLanguageLevel();
+     LanguageLevelProjectExtension.getInstance(facade.getProject()).setLanguageLevel(LanguageLevel.JDK_1_5);
+     try {
+       doTextTest("class C<Y, X> {\n" + "}", "class C<Y, X> {\n" + "}");
+       getSettings().SPACE_BEFORE_METHOD_LBRACE = true;
+       getSettings().KEEP_SIMPLE_METHODS_IN_ONE_LINE = true;
+       doTextTest("enum En {\n" + "    A(10) {},\n" + "    B(10) {},\n" + "    C(10);\n" + "\n" + "    En(int i) { }\n" + "}",
+                  "enum En {\n" + "    A(10) {},\n" + "    B(10) {},\n" + "    C(10);\n" + "\n" + "    En(int i) { }\n" + "}");
+       doTextTest("class C {\n" +
+                  "    void foo (Map<?, String> s) {\n" +
+                  "        Set<? extends Map<?, String>.Entry<?, String>> temp = s.entries();\n" +
+                  "    }\n" +
+ "}", "class C {\n" +
+      "    void foo(Map<?, String> s) {\n" +
+      "        Set<? extends Map<?, String>.Entry<?, String>> temp = s.entries();\n" +
+      "    }\n" +
+      "}");
+       doTextTest("class B {\n" +
+                  "    public final A<String> myDelegate = new A<String>();\n" +
+                  "\n" +
+                  "    public List<? extends String> method1() {\n" +
+                  "        return myDelegate.method1();\n" +
+                  "    }\n" +
+                  "\n" +
+                  "    public String method2(String t) {\n" +
+                  "        return myDelegate.method2(t);\n" +
+                  "    }\n" +
+ "}", "class B {\n" +
+      "    public final A<String> myDelegate = new A<String>();\n" +
+      "\n" +
+      "    public List<? extends String> method1() {\n" +
+      "        return myDelegate.method1();\n" +
+      "    }\n" +
+      "\n" +
+      "    public String method2(String t) {\n" +
+      "        return myDelegate.method2(t);\n" +
+      "    }\n" +
+      "}");
+     }
+     finally {
+       LanguageLevelProjectExtension.getInstance(facade.getProject()).setLanguageLevel(level);
+     }
+   }
+   ///IDEA-7761
+   public void testKeepBlankLineInCodeBeforeComment() throws Exception {
+     getSettings().KEEP_BLANK_LINES_IN_CODE = 1;
+     getSettings().KEEP_BLANK_LINES_IN_DECLARATIONS = 0;
+     getSettings().KEEP_FIRST_COLUMN_COMMENT = false;
+     doTextTest("public class ReformatProblem {\n" +
+                "\n" +
+                "    //comment in declaration\n" +
+                "    public static void main(String[] args) {\n" +
+                "        for (String arg : args) {\n" +
+                "            \n" +
+                "            // a first system out\n" +
+                "            System.out.println(\"\");\n" +
+                "            \n" +
+                "            // another system out\n" +
+                "            System.out.println(\"arg = \" + arg);\n" +
+                "        }\n" +
+                "    }\n" +
+ "}", "public class ReformatProblem {\n" +
+      "    //comment in declaration\n" +
+      "    public static void main(String[] args) {\n" +
+      "        for (String arg : args) {\n" +
+      "\n" +
+      "            // a first system out\n" +
+      "            System.out.println(\"\");\n" +
+      "\n" +
+      "            // another system out\n" +
+      "            System.out.println(\"arg = \" + arg);\n" +
+      "        }\n" +
+      "    }\n" +
+      "}");
+     getSettings().KEEP_BLANK_LINES_IN_CODE = 0;
+     getSettings().KEEP_BLANK_LINES_IN_DECLARATIONS = 1;
+     getSettings().KEEP_FIRST_COLUMN_COMMENT = false;
+     doTextTest("public class ReformatProblem {\n" +
+                "\n" +
+                "    //comment in declaration\n" +
+                "    public static void main(String[] args) {\n" +
+                "        for (String arg : args) {\n" +
+                "            \n" +
+                "            // a first system out\n" +
+                "            System.out.println(\"\");\n" +
+                "            \n" +
+                "            // another system out\n" +
+                "            System.out.println(\"arg = \" + arg);\n" +
+                "        }\n" +
+                "    }\n" +
+ "}", "public class ReformatProblem {\n" +
+      "\n" +
+      "    //comment in declaration\n" +
+      "    public static void main(String[] args) {\n" +
+      "        for (String arg : args) {\n" +
+      "            // a first system out\n" +
+      "            System.out.println(\"\");\n" +
+      "            // another system out\n" +
+      "            System.out.println(\"arg = \" + arg);\n" +
+      "        }\n" +
+      "    }\n" +
+      "}");
+   }
+   public void testSpaceBeforeTryBrace() throws Exception {
+     getSettings().SPACE_BEFORE_TRY_LBRACE = false;
+     getSettings().SPACE_BEFORE_FINALLY_LBRACE = true;
+     doTextTest("class Foo{\n" + "    void foo() {\n" + "        try {\n" + "        } finally {\n" + "        }\n" + "    }\n" + "}",
+                "class Foo {\n" + "    void foo() {\n" + "        try{\n" + "        } finally {\n" + "        }\n" + "    }\n" + "}");
+     getSettings().SPACE_BEFORE_TRY_LBRACE = true;
+     getSettings().SPACE_BEFORE_FINALLY_LBRACE = false;
+     doTextTest("class Foo{\n" + "    void foo() {\n" + "        try {\n" + "        } finally {\n" + "        }\n" + "    }\n" + "}",
+                "class Foo {\n" + "    void foo() {\n" + "        try {\n" + "        } finally{\n" + "        }\n" + "    }\n" + "}");
+   }
+   public void testIDEADEV_6239() throws Exception {
+     getSettings().ENABLE_JAVADOC_FORMATTING = true;
+     doTextTest("public class Test {\n" +
+                "\n" +
+                "    /**\n" +
+                "     * The s property.\n" +
+                "     *\n" +
+                "     * @deprecated don't use it\n" +
+                "     */\n" +
+                "    private String s;\n" +
+ "}", "public class Test {\n" +
+      "\n" +
+      "    /**\n" +
+      "     * The s property.\n" +
+      "     *\n" +
+      "     * @deprecated don't use it\n" +
+      "     */\n" +
+      "    private String s;\n" +
+      "}");
+   }
+   public void testFormatComments() throws Exception {
+     getSettings().ENABLE_JAVADOC_FORMATTING = true;
+     doTextTest("public class Test {\n" + "\n" + "    /**\n" + "     * The s property.\n" + "     */\n" + "    private String s;\n" + "}",
+                "public class Test {\n" + "\n" + "    /**\n" + "     * The s property.\n" + "     */\n" + "    private String s;\n" + "}");
+   }
+   public void testDoNotWrapLBrace() throws IncorrectOperationException {
+     getSettings().BRACE_STYLE = CodeStyleSettings.END_OF_LINE;
+     getSettings().RIGHT_MARGIN = 66;
+     doTextTest("public class Test {\n" +
+                "    void foo(){\n" +
+                "        if (veryLongIdentifier1 == 1 && veryLongIdentifier2 == 2) {\n" +
+                "            doSmth();\n" +
+                "        }\n" +
+                "    }\n" +
+ "}", "public class Test {\n" +
+      "    void foo() {\n" +
+      "        if (veryLongIdentifier1 == 1 && veryLongIdentifier2 == 2) {\n" +
+      "            doSmth();\n" +
+      "        }\n" +
+      "    }\n" +
+      "}");
+   }
+   public void testNewLinesAroundArrayInitializer() throws IncorrectOperationException {
+     getSettings().ARRAY_INITIALIZER_WRAP = CodeStyleSettings.WRAP_AS_NEEDED;
+     getSettings().ARRAY_INITIALIZER_LBRACE_ON_NEXT_LINE = true;
+     getSettings().ARRAY_INITIALIZER_RBRACE_ON_NEXT_LINE = true;
+     getSettings().RIGHT_MARGIN = 40;
+     doTextTest("class Foo {\n" + "    int[] a = new int[]{1,2,0x0052,0x0053,0x0054,0x0054,0x0054};\n" + "}", "class Foo {\n" +
+                                                                                                              "    int[] a = new int[]{\n" +
+                                                                                                              "            1, 2, 0x0052, 0x0053,\n" +
+                                                                                                              "            0x0054, 0x0054, 0x0054\n" +
+                                                                                                              "    };\n" +
+                                                                                                              "}");
+   }
+   public void testSpaceAfterCommaInEnum() throws IncorrectOperationException {
+     getSettings().SPACE_AFTER_COMMA = true;
+     final JavaPsiFacade facade = getJavaFacade();
+     final LanguageLevel effectiveLanguageLevel = LanguageLevelProjectExtension.getInstance(facade.getProject()).getLanguageLevel();
+     try {
+       LanguageLevelProjectExtension.getInstance(facade.getProject()).setLanguageLevel(LanguageLevel.JDK_1_5);
+       doTextTest("public enum StringExDirection {\n" + "\n" + "    RIGHT_TO_LEFT, LEFT_TO_RIGHT\n" + "\n" + "}",
+                  "public enum StringExDirection {\n" + "\n" + "    RIGHT_TO_LEFT, LEFT_TO_RIGHT\n" + "\n" + "}");
+     }
+     finally {
+       LanguageLevelProjectExtension.getInstance(facade.getProject()).setLanguageLevel(effectiveLanguageLevel);
+     }
+   }
+   public void testRemoveBraceBeforeInstanceOf() throws IncorrectOperationException {
+     doTextTest("class ReformatInstanceOf {\n" +
+                "    void foo(Object string) {\n" +
+                "        if (string.toString() instanceof String) {} // reformat me\n" +
+                "    }\n" +
+ "}", "class ReformatInstanceOf {\n" +
+      "    void foo(Object string) {\n" +
+      "        if (string.toString() instanceof String) {\n" +
+      "        } // reformat me\n" +
+      "    }\n" +
+      "}");
+   }
+   public void testAnnotationBeforePackageLocalConstructor() throws IncorrectOperationException {
+     doTextTest("class Foo {\n" + "    @MyAnnotation Foo() {\n" + "    }\n" + "}",
+                "class Foo {\n" + "    @MyAnnotation\n" + "    Foo() {\n" + "    }\n" + "}");
+   }
+   public void testLongAnnotationsAreNotWrapped() throws Exception {
+     getSettings().ARRAY_INITIALIZER_WRAP = CodeStyleSettings.WRAP_AS_NEEDED;
+     doTest();
+   }
+   public void testIDEADEV_8755() throws IncorrectOperationException {
+     getSettings().KEEP_LINE_BREAKS = false;
+     doTextTest("class Foo {\n" +
+                "void foo(){\n" +
+                "System\n" +
+                ".out\n" +
+                ".println(\"Sleeping \" \n" +
+                "+ thinkAboutItTime\n" +
+                "+ \" seconds !\");" +
+                "}\n" +
+                "}", "class Foo {\n" +
+                     "    void foo() {\n" +
+                     "        System.out.println(\"Sleeping \" + thinkAboutItTime + \" seconds !\");\n" +
+                     "    }\n" +
+                     "}");
+   }
+   public void testIDEADEV_24168() throws IncorrectOperationException {
+     doTextTest(
+       "class Foo {\n" + "@AnExampleMethod\n" + "public String\n" + "getMeAString()\n" + "throws AnException\n" + "{\n" + "\n" + "}\n" + "}",
+       "class Foo {\n" +
+       "    @AnExampleMethod\n" +
+       "    public String\n" +
+       "    getMeAString()\n" +
+       "            throws AnException {\n" +
+       "\n" +
+       "    }\n" +
+       "}");
+   }
+   public void testIDEADEV_2541() throws IncorrectOperationException {
+     myTextRange = new TextRange(0, 15);
+     doTextTest("/** @param q */\nclass Foo {\n}", "/**\n" + " * @param q\n" + " */\n" + "class Foo {\n" + "}");
+   }
+   public void testIDEADEV_6434() throws IncorrectOperationException {
+     getSettings().ALIGN_MULTILINE_BINARY_OPERATION = true;
+     getSettings().ALIGN_MULTILINE_ASSIGNMENT = true;
+     doTextTest("class Foo {\n" +
+                "void foo(){\n" +
+                "return (interval1.getEndIndex() >= interval2.getStartIndex() &&\n" +
+                "        interval1.getStartIndex() <= interval2.getEndIndex()) ||\n" +
+                "                                                              (interval2.getEndIndex() >= interval1.getStartIndex() &&\n" +
+                "                                                               interval2.getStartIndex() <= interval1.getEndIndex());\n" +
+                "}\n" +
+                "}", "class Foo {\n" +
+                     "    void foo() {\n" +
+                     "        return (interval1.getEndIndex() >= interval2.getStartIndex() &&\n" +
+                     "                interval1.getStartIndex() <= interval2.getEndIndex()) ||\n" +
+                     "               (interval2.getEndIndex() >= interval1.getStartIndex() &&\n" +
+                     "                interval2.getStartIndex() <= interval1.getEndIndex());\n" +
+                     "    }\n" +
+                     "}");
+   }
+   public void testIDEADEV_12836() throws IncorrectOperationException {
+     getSettings().SPECIAL_ELSE_IF_TREATMENT = true;
+     getSettings().RIGHT_MARGIN = 80;
+     doTextTest("class Foo {\n" +
+                "void foo(){\n" +
+                "if (true){\n" +
+                "} else if (\"                                                            \" != null) {\n" +
+                "}\n" +
+                "}\n" +
+                "}", "class Foo {\n" +
+                     "    void foo() {\n" +
+                     "        if (true) {\n" +
+                     "        } else if (\"                                                            \" != null) {\n" +
+                     "        }\n" +
+                     "    }\n" +
+                     "}");
+   }
+   /*
+   public void testIDEADEV_26871() throws IncorrectOperationException {
+     getSettings().getIndentOptions(StdFileTypes.JAVA).CONTINUATION_INDENT_SIZE = 4;
+     doTextTest("class Foo {\n" +
+                "public void foo() {\n" +
+                "    BigDecimal1.ONE1\n" +
+                "    .add2(BigDecimal2.ONE2\n" +
+                "    .add3(BigDecimal3.ONE3\n" +
+                "    .add4(BigDecimal4.ONE4\n" +
+                "    .add5(BigDecimal5.ONE5))))\n" +
+                "}\n" +
+                "}",
+                "class Foo {\n" +
+                "    public void foo() {\n" +
+                "        BigDecimal1.ONE1\n" +
+                "            .add2(BigDecimal2.ONE2\n" +
+                "                .add3(BigDecimal3.ONE3\n" +
+                "                    .add4(BigDecimal4.ONE4\n" +
+                "                        .add5(BigDecimal5.ONE5))))\n" +
+                "    }\n" +
+                "}");
+   }
+   */
+   public void test23551() throws IncorrectOperationException {
+     doTextTest("public class Wrapping {\n" +
+                "    public static void sample() {\n" +
+                "        System.out.println(\".\" + File.separator + \"..\" + File.separator + \"some-directory-name\" + File.separator + \"more-file-name\");\n" +
+                "    }\n" +
+                "}", "public class Wrapping {\n" +
+                     "    public static void sample() {\n" +
+                     "        System.out.println(\".\" + File.separator + \"..\" + File.separator + \"some-directory-name\" + File.separator + \"more-file-name\");\n" +
+                     "    }\n" +
+                     "}");
+   }
+   /*
+   public void testIDEADEV_26871_2() throws IncorrectOperationException {
+     getSettings().getIndentOptions(StdFileTypes.JAVA).CONTINUATION_INDENT_SIZE = 4;
+     doTextTest("class Foo {\n" +
+                "public void foo() {\n" +
+                "    BigDecimal1\n" +
+                "    .add2(BigDecimal2\n" +
+                "    .add3(BigDecimal3\n" +
+                "    .add4(BigDecimal4\n" +
+                "    .add5(BigDecimal5))))\n" +
+                "}\n" +
+                "}",
+                "class Foo {\n" +
+                "    public void foo() {\n" +
+                "        BigDecimal1.ONE1\n" +
+                "            .add2(BigDecimal2.ONE2\n" +
+                "                .add3(BigDecimal3.ONE3\n" +
+                "                    .add4(BigDecimal4.ONE4\n" +
+                "                        .add5(BigDecimal5.ONE5))))\n" +
+                "    }\n" +
+                "}");
+   }
+   */
+   public void testIDEADEV_23551() throws IncorrectOperationException {
+     getSettings().BINARY_OPERATION_WRAP = CodeStyleSettings.WRAP_ON_EVERY_ITEM;
+     getSettings().RIGHT_MARGIN = 60;
+     doTextTest("public class Wrapping {\n" +
+                "public static void sample() {\n" +
+                "System.out.println(\".\" + File.separator + \"..\" + File.separator + \"some-directory-name\" + File.separator + \"more-file-name\");\n" +
+                "}\n" +
+                "}", "public class Wrapping {\n" +
+                     "    public static void sample() {\n" +
+                     "        System.out.println(\".\" +\n" +
+                     "                File.separator +\n" +
+                     "                \"..\" +\n" +
+                     "                File.separator +\n" +
+                     "                \"some-directory-name\" +\n" +
+                     "                File.separator +\n" +
+                     "                \"more-file-name\");\n" +
+                     "    }\n" +
+                     "}");
+   }
+   public void testIDEADEV_22967() throws IncorrectOperationException {
+     getSettings().METHOD_ANNOTATION_WRAP = CodeStyleSettings.WRAP_ALWAYS;
+     doTextTest("public interface TestInterface {\n" +
+                "\n" +
+                "    void empty();\n" +
+                "\n" +
+                "    @Deprecated\n" +
+                "    void annotated();\n" +
+                "\n" +
+                "    <T> void parametrized(T data);\n" +
+                "\n" +
+                "    @Deprecated\n" +
+                "    <T> void parametrizedAnnotated(T data);\n" +
+                "\n" +
+                "    @Deprecated\n" +
+                "    public <T> void publicParametrizedAnnotated(T data);\n" +
+                "\n" +
+                "}", "public interface TestInterface {\n" +
+                     "\n" +
+                     "    void empty();\n" +
+                     "\n" +
+                     "    @Deprecated\n" +
+                     "    void annotated();\n" +
+                     "\n" +
+                     "    <T> void parametrized(T data);\n" +
+                     "\n" +
+                     "    @Deprecated\n" +
+                     "    <T> void parametrizedAnnotated(T data);\n" +
+                     "\n" +
+                     "    @Deprecated\n" +
+                     "    public <T> void publicParametrizedAnnotated(T data);\n" +
+                     "\n" +
+                     "}");
+   }
+   public void testIDEADEV_22967_2() throws IncorrectOperationException {
+     getSettings().METHOD_ANNOTATION_WRAP = CodeStyleSettings.WRAP_ALWAYS;
+     doTextTest("public interface TestInterface {\n" + "    @Deprecated\n" + "    <T> void parametrizedAnnotated(T data);\n" + "}",
+                "public interface TestInterface {\n" + "    @Deprecated\n" + "    <T> void parametrizedAnnotated(T data);\n" + "}");
+   }
+   public void testIDEADEV_22920() throws IncorrectOperationException {
+     getSettings().INDENT_CASE_FROM_SWITCH = false;
+     doTextTest("class Foo{\n" +
+                "void foo () {\n" +
+                "switch(someValue) {\n" +
+                " // This comment is correctly not-indented\n" +
+                " case 1:\n" +
+                "    doSomething();\n" +
+                "    break;\n" +
+                "\n" +
+                " // This comment should not be indented, but it is\n" +
+                " case 2:\n" +
+                "    doSomethingElse();\n" +
+                "    break;\n" +
+                "}\n" +
+                "}\n" +
+                "}", "class Foo {\n" +
+                     "    void foo() {\n" +
+                     "        switch (someValue) {\n" +
+                     "        // This comment is correctly not-indented\n" +
+                     "        case 1:\n" +
+                     "            doSomething();\n" +
+                     "            break;\n" +
+                     "\n" +
+                     "        // This comment should not be indented, but it is\n" +
+                     "        case 2:\n" +
+                     "            doSomethingElse();\n" +
+                     "            break;\n" +
+                     "        }\n" +
+                     "    }\n" +
+                     "}");
+   }
+   public void testIDEADEV_16136() throws IncorrectOperationException {
+     getSettings().ARRAY_INITIALIZER_WRAP = CodeStyleSettings.WRAP_ALWAYS;
+     getSettings().ALIGN_MULTILINE_ARRAY_INITIALIZER_EXPRESSION = true;
+     doTextTest(
+       "@SuppressWarnings({\"UseOfSystemOutOrSystemErr\", \"AssignmentToCollectionOrArrayFieldFromParameter\", \"ReturnOfCollectionOrArrayField\"})\n" +
+       "public class Some {\n" +
+       "}", "@SuppressWarnings({\"UseOfSystemOutOrSystemErr\",\n" +
+            "                   \"AssignmentToCollectionOrArrayFieldFromParameter\",\n" +
+            "                   \"ReturnOfCollectionOrArrayField\"})\n" +
+            "public class Some {\n" +
+            "}");
+   }
+   public void testIDEADEV_20144() throws IncorrectOperationException {
+     getSettings().ALIGN_MULTILINE_PARAMETERS_IN_CALLS = true;
+     getSettings().getIndentOptions(StdFileTypes.JAVA).SMART_TABS = true;
+     getSettings().getIndentOptions(StdFileTypes.JAVA).USE_TAB_CHARACTER = true;
+     doTextTest("class Foo {\n" +
+                "    void foo() {\n" +
+                "        bar(new Object[] {\n" +
+                "            \"hello1\",\n" +
+                "            \"hello2\", add(\"hello3\",\n" +
+                "                           \"world\")\n" +
+                "});" +
+                "    }}", "class Foo {\n" +
+                          "\tvoid foo() {\n" +
+                          "\t\tbar(new Object[]{\n" +
+                          "\t\t\t\t\"hello1\",\n" +
+                          "\t\t\t\t\"hello2\", add(\"hello3\",\n" +
+                          "\t\t\t\t              \"world\")\n" +
+                          "\t\t});\n" +
+                          "\t}\n" +
+                          "}");
+   }
+   public void testIDEADEV_14116() throws IncorrectOperationException {
+     getSettings().KEEP_FIRST_COLUMN_COMMENT = false;
+     doTextTest("class Foo{\n" + "private int foo;     // this is a foo\n" + "}",
+                "class Foo {\n" + "    private int foo;     // this is a foo\n" + "}");
+   }
+   public void testIDEADEV_13018() throws Exception {
+     getSettings().ALIGN_MULTILINE_TERNARY_OPERATION = true;
+     doMethodTest("int i = a ? x\n" + ": y;", "int i = a ? x\n" + "          : y;");
+   }
+   public void testIDEADEV_2840() throws IncorrectOperationException {
+     doTextTest("enum Xyz {\n" + "FOO,\n" + "BAR,\n" + "}", "enum Xyz {\n" + "    FOO,\n" + "    BAR,\n" + "}");
+   }
+   public void testIDEADEV_6787() throws IncorrectOperationException {
+     getSettings().ARRAY_INITIALIZER_WRAP = CodeStyleSettings.WRAP_ALWAYS;
+     getSettings().ARRAY_INITIALIZER_LBRACE_ON_NEXT_LINE = true;
+     getSettings().ARRAY_INITIALIZER_RBRACE_ON_NEXT_LINE = true;
+     doTextTest("public @interface Ann\n" +
+                "{\n" +
+                "int[] x = { 1, 2 };\n" +
+                "\n" +
+                "Mode[] modes () default { @Mode(value = 1), @Mode(value = 2) };\n" +
+                "}", "public @interface Ann {\n" +
+                     "    int[] x = {\n" +
+                     "            1,\n" +
+                     "            2\n" +
+                     "    };\n" +
+                     "\n" +
+                     "    Mode[] modes() default {\n" +
+                     "            @Mode(value = 1),\n" +
+                     "            @Mode(value = 2)\n" +
+                     "    };\n" +
+                     "}");
+   }
+   private void doMethodTest(final String before, final String after) throws Exception {
+     doTextTest("class Foo{\n" + "    void foo() {\n" + before + '\n' + "    }\n" + "}",
+                "class Foo {\n" + "    void foo() {\n" + StringUtil.shiftIndentInside(after, 8, false) + '\n' + "    }\n" + "}");
+   }
+   private void doClassTest(final String before, final String after) throws Exception {
+     doTextTest("class Foo{\n" + before + '\n' + "}", "class Foo {\n" + StringUtil.shiftIndentInside(after, 4, false) + '\n' + "}");
+   }
+   /*
+   public void testIDEADEV_14192() throws IncorrectOperationException {
+     getSettings().KEEP_SIMPLE_METHODS_IN_ONE_LINE = true;
+     getSettings().METHOD_BRACE_STYLE = CodeStyleSettings.NEXT_LINE_SHIFTED;
+     getSettings().METHOD_PARAMETERS_WRAP = CodeStyleSettings.WRAP_ALWAYS;
+     doTextTest(
+         "class Foo {\n" +
+         "String foo(int i, boolean j){return something;}\n" +
+         "}",
+         "class Foo {\n" +
+         "    String foo(int i, boolean j) {return something;}\n" +
+         "}");
+   }
+   */
+   public void testWrapExtendsList() throws Exception {
+     getSettings().RIGHT_MARGIN = 50;
+     getSettings().EXTENDS_LIST_WRAP = CodeStyleSettings.WRAP_ON_EVERY_ITEM;
+     getSettings().EXTENDS_KEYWORD_WRAP = CodeStyleSettings.WRAP_AS_NEEDED;
+     doTextTest("class ColtreDataProvider extends DataProvider, AgentEventListener, ParameterDataEventListener {\n}",
+                "class ColtreDataProvider extends DataProvider,\n" +
+                "        AgentEventListener,\n" +
+                "        ParameterDataEventListener {\n}");
+   }
+   public void testWrapLongExpression() throws Exception {
+     getSettings().RIGHT_MARGIN = 80;
+     getSettings().BINARY_OPERATION_WRAP = CodeStyleSettings.WRAP_AS_NEEDED;
+     getSettings().ALIGN_MULTILINE_BINARY_OPERATION = true;
+     doTextTest("class Foo {\n" +
+                "    void foo () {\n" +
+                "        return (interval1.getEndIndex() >= interval2.getStartIndex() && interval3.getStartIndex() <= interval4.getEndIndex()) || (interval5.getEndIndex() >= interval6.getStartIndex() && interval7.getStartIndex() <= interval8.getEndIndex());" +
+                "    }\n" +
+                "}", "class Foo {\n" +
+                     "    void foo() {\n" +
+                     "        return (interval1.getEndIndex() >= interval2.getStartIndex() &&\n" +
+                     "                interval3.getStartIndex() <= interval4.getEndIndex()) ||\n" +
+                     "               (interval5.getEndIndex() >= interval6.getStartIndex() &&\n" +
+                     "                interval7.getStartIndex() <= interval8.getEndIndex());\n" +
+                     "    }\n" +
+                     "}");
+   }
+   public void testDoNotWrapCallChainIfParametersWrapped() throws Exception {
+     getSettings().RIGHT_MARGIN = 87;
+     getSettings().CALL_PARAMETERS_WRAP = CodeStyleSettings.WRAP_AS_NEEDED;
+     getSettings().METHOD_CALL_CHAIN_WRAP = CodeStyleSettings.WRAP_AS_NEEDED;
+     getSettings().ALIGN_MULTILINE_PARAMETERS_IN_CALLS = true;
+     //getSettings().PREFER_PARAMETERS_WRAP = true;
+     doMethodTest(
+       //9                    30                            70         80    86
+       "descriptors = manager.createProblemDescriptor(parameter1, parameter2, parameterparameterpar3,parameter4);",
+       "descriptors = manager.createProblemDescriptor(parameter1, parameter2,\n" +
+       "                                              parameterparameterpar3,\n" +
+       "                                              parameter4);"
+     );
+   }
+   public void testAlignTernaryOperation() throws Exception {
+     getSettings().ALIGN_MULTILINE_TERNARY_OPERATION = true;
+     doMethodTest("String s = x == 0 ? \"hello\" :\n" +
+                  "                x == 5 ? \"something else\" :\n" +
+                  "                        x > 0 ? \"bla, bla\" :\n" +
+                  "                                \"\";", "String s = x == 0 ? \"hello\" :\n" +
+                                                           "           x == 5 ? \"something else\" :\n" +
+                                                           "           x > 0 ? \"bla, bla\" :\n" +
+                                                           "           \"\";");
+     getSettings().TERNARY_OPERATION_SIGNS_ON_NEXT_LINE = true;
+     doMethodTest("int someVariable = a ?\n" + "x :\n" + "y;",
+                  "int someVariable = a ?\n" + "                   x :\n" + "                   y;");
+   }
+   public void testIDEADEV_20878_1() throws Exception {
+     doMethodTest("checking(new Expectations() {{\n" +
+                  "one(tabConfiguration).addFilter(with(equal(PROPERTY)), with(aListContaining(\"a-c\")));\n" +
+                  "}});", "checking(new Expectations() {{\n" +
+                          "    one(tabConfiguration).addFilter(with(equal(PROPERTY)), with(aListContaining(\"a-c\")));\n" +
+                          "}});");
+   }
+   public void testIDEADEV_20878_2() throws Exception {
+     doTextTest("class Class {\n" + "    private Type field; {\n" + "    }\n" + "}",
+                "class Class {\n" + "    private Type field; {\n" + "    }\n" + "}");
+     doTextTest("class T {\n" +
+                "    private final DecimalFormat fmt = new DecimalFormat(); {\n" +
+                "        fmt.setGroupingUsed(false);\n" +
+                "        fmt.setDecimalFormatSymbols(new DecimalFormatSymbols(Locale.US));\n" +
+                "    }\n" +
+                "}", "class T {\n" +
+                     "    private final DecimalFormat fmt = new DecimalFormat(); {\n" +
+                     "        fmt.setGroupingUsed(false);\n" +
+                     "        fmt.setDecimalFormatSymbols(new DecimalFormatSymbols(Locale.US));\n" +
+                     "    }\n" +
+                     "}");
+     doTextTest("class T {\n" +
+                "    private final DecimalFormat fmt = new DecimalFormat();\n" +
+                "    {\n" +
+                "        fmt.setGroupingUsed(false);\n" +
+                "        fmt.setDecimalFormatSymbols(new DecimalFormatSymbols(Locale.US));\n" +
+                "    }\n" +
+                "}", "class T {\n" +
+                     "    private final DecimalFormat fmt = new DecimalFormat();\n" +
+                     "\n" +
+                     "    {\n" +
+                     "        fmt.setGroupingUsed(false);\n" +
+                     "        fmt.setDecimalFormatSymbols(new DecimalFormatSymbols(Locale.US));\n" +
+                     "    }\n" +
+                     "}");
+   }
+   public void testIDEADEV_3666() throws Exception {
+     getSettings().SPACE_AFTER_COMMA = true;
+     doTextTest("class Foo {\n" + "Map<String,String> map() {}\n" + "}",
+                "class Foo {\n" + "    Map<String, String> map() {\n" + "    }\n" + "}");
+   }
+   public void testIDEADEV_18529() throws Exception {
+     doTextTest("public class TestBed\n" +
+                "{\n" +
+                "    public void methodOne()\n" +
+                "    {\n" +
+                "        //code...\n" +
+                "    }\n" +
+                "\n" +
+                "    @SomeAnnotation\n" +
+                "            <T extends Comparable> void methodTwo(T item) {\n" +
+                "        //code...\n" +
+                "    }\n" +
+                "\n" +
+                "    private void methodThree(String s) {\n" +
+                "        //code...\n" +
+                "    }\n" +
+                "}", "public class TestBed {\n" +
+                     "    public void methodOne() {\n" +
+                     "        //code...\n" +
+                     "    }\n" +
+                     "\n" +
+                     "    @SomeAnnotation\n" +
+                     "    <T extends Comparable> void methodTwo(T item) {\n" +
+                     "        //code...\n" +
+                     "    }\n" +
+                     "\n" +
+                     "    private void methodThree(String s) {\n" +
+                     "        //code...\n" +
+                     "    }\n" +
+                     "}");
+   }
+  public void testIDEA_18299() throws Exception {
+    getSettings().RIGHT_MARGIN = 80;
+    getSettings().ARRAY_INITIALIZER_WRAP = CodeStyleSettings.WRAP_AS_NEEDED;
+    doTextTest(
+      "@AttributeOverrides( { @AttributeOverride(name = \"id\", column = @Column(name = \"recovery_id\"))," +
+      "@AttributeOverride(name = \"transactionReference\", column = @Column(name = \"deal_reference\"))," +
+      "@AttributeOverride(name = \"eventDate\", column = @Column(name = \"recovery_date\"))," +
+      "@AttributeOverride(name = \"amount\", column = @Column(name = \"recovery_amount\"))," +
+      "@AttributeOverride(name = \"currency\", column = @Column(name = \"local_currency\"))," +
+      "@AttributeOverride(name = \"exchangeRate\", column = @Column(name = \"exchange_rate\"))," +
+      "@AttributeOverride(name = \"exchangeRateDate\", column = @Column(name = \"recovery_date\", insertable = false, updatable = false))," +
+      "@AttributeOverride(name = \"exchangeRateAlterationJustification\", column = @Column(name = \"exchange_rate_justification\"))," +
+      "@AttributeOverride(name = \"systemExchangeRate\", column = @Column(name = \"system_exchange_rate\")) })\n" +
+      "class Foo {\n" +
+      "}",
+      "@AttributeOverrides({\n" +
+      "        @AttributeOverride(name = \"id\", column = @Column(name = \"recovery_id\")),\n" +
+      "        @AttributeOverride(name = \"transactionReference\", column = @Column(name = \"deal_reference\")),\n" +
+      "        @AttributeOverride(name = \"eventDate\", column = @Column(name = \"recovery_date\")),\n" +
+      "        @AttributeOverride(name = \"amount\", column = @Column(name = \"recovery_amount\")),\n" +
+      "        @AttributeOverride(name = \"currency\", column = @Column(name = \"local_currency\")),\n" +
+      "        @AttributeOverride(name = \"exchangeRate\", column = @Column(name = \"exchange_rate\")),\n" +
+      "        @AttributeOverride(name = \"exchangeRateDate\", column = @Column(name = \"recovery_date\", insertable = false, updatable = false)),\n" +
+      "        @AttributeOverride(name = \"exchangeRateAlterationJustification\", column = @Column(name = \"exchange_rate_justification\")),\n" +
+      "        @AttributeOverride(name = \"systemExchangeRate\", column = @Column(name = \"system_exchange_rate\"))})\n" +
+      "class Foo {\n" +
+      "}"
+    );
+  }
+   public void testIDEA_18051() throws Exception {
+     getSettings().RIGHT_MARGIN = 80;
+     doTextTest("package formatting;\n" +
+                "\n" +
+                "public class EnumInAnnotationFormatting {\n" +
+                "\n" +
+                "    public enum TheEnum {\n" +
+                "\n" +
+                "        FIRST,\n" +
+                "        SECOND,\n" +
+                "        THIRD,\n" +
+                "\n" +
+                "    }\n" +
+                "\n" +
+                "    public @interface TheAnnotation {\n" +
+                "\n" +
+                "        TheEnum[] value();\n" +
+                "\n" +
+                "        String comment();\n" +
+                "\n" +
+                "    }\n" +
+                "\n" +
+                "\n" +
+                "    @TheAnnotation(value = {TheEnum.FIRST, TheEnum.SECOND}, comment = \"some long comment that goes longer that right margin 012345678901234567890\")\n" +
+                "    public class Test {\n" +
+                "\n" +
+                "    }\n" +
+                "\n" +
+                "}", "package formatting;\n" +
+                     "\n" +
+                     "public class EnumInAnnotationFormatting {\n" +
+                     "\n" +
+                     "    public enum TheEnum {\n" +
+                     "\n" +
+                     "        FIRST,\n" +
+                     "        SECOND,\n" +
+                     "        THIRD,\n" +
+                     "\n" +
+                     "    }\n" +
+                     "\n" +
+                     "    public @interface TheAnnotation {\n" +
+                     "\n" +
+                     "        TheEnum[] value();\n" +
+                     "\n" +
+                     "        String comment();\n" +
+                     "\n" +
+                     "    }\n" +
+                     "\n" +
+                     "\n" +
+                     "    @TheAnnotation(value = {TheEnum.FIRST, TheEnum.SECOND}, comment = \"some long comment that goes longer that right margin 012345678901234567890\")\n" +
+                     "    public class Test {\n" +
+                     "\n" +
+                     "    }\n" +
+                     "\n" +
+                     "}");
+   }
+   public void testIDEA_17870() throws Exception {
+     doClassTest("public Test(@Qualifier(\"blah\") AType blah){}", "public Test(@Qualifier(\"blah\") AType blah) {\n" + "}");
+   }
+   public void testIDEA_16151() throws Exception {
+     doClassTest("@ValidateNestedProperties({\n" +
+                 "@Validate(field=\"name\", required=true, maxlength=Trip.NAME),\n" +
+                 "@Validate(field=\"name\", required=true, maxlength=Trip.NAME)\n" +
+                 "})" +
+                 "public Trip getTrip() {\n" +
+                 "}", "@ValidateNestedProperties({\n" +
+                      "        @Validate(field = \"name\", required = true, maxlength = Trip.NAME),\n" +
+                      "        @Validate(field = \"name\", required = true, maxlength = Trip.NAME)\n" +
+                      "})\n" +
+                      "public Trip getTrip() {\n" +
+                      "}");
+   }
+   public void testIDEA_14324() throws Exception {
+     getSettings().ALIGN_MULTILINE_ARRAY_INITIALIZER_EXPRESSION = true;
+     doClassTest(
+       "@Ann1({ @Ann2,\n" +
+       "                      @Ann3})\n" +
+       "public AuthorAddress getAddress() {\n" +
+       "    return address;\n" +
+       "}",
+       "@Ann1({@Ann2,\n" +
+       "       @Ann3})\n" +
+       "public AuthorAddress getAddress() {\n" +
+       "    return address;\n" +
+       "}");
+     doClassTest("@AttributeOverrides({ @AttributeOverride(name = \"address\", column = @Column(name = \"ADDR\")),\n" +
+                 "                      @AttributeOverride(name = \"country\", column = @Column(name = \"NATION\")) })\n" +
+                 "public AuthorAddress getAddress() {\n" +
+                 "    return address;\n" +
+                 "}",
+                 "@AttributeOverrides({@AttributeOverride(name = \"address\", column = @Column(name = \"ADDR\")),\n" +
+                 "                     @AttributeOverride(name = \"country\", column = @Column(name = \"NATION\"))})\n" +
+                 "public AuthorAddress getAddress() {\n" +
+                 "    return address;\n" +
+                 "}"
+     );
+   }
+   public void testRightMargin() throws Exception {
+     getSettings().WRAP_COMMENTS = true;
+     getSettings().RIGHT_MARGIN = 35;//      |
+     doTextTest(
+       "/** Here is one-line java-doc comment */" +
+       "class Foo {\n" +
+       "}",
+       "/**\n" +
+       " * Here is one-line java-doc\n" +
+       " * comment\n" +
+       " */\n" +
+       "class Foo {\n" +
+       "}");
+   }
+   public void testRightMargin_2() throws Exception {
+     getSettings().RIGHT_MARGIN = 65;
+     getSettings().ASSIGNMENT_WRAP = CodeStyleSettings.WRAP_AS_NEEDED;
+     getSettings().PLACE_ASSIGNMENT_SIGN_ON_NEXT_LINE = true;
+     getSettings().KEEP_LINE_BREAKS = false;
+     doClassTest(
+       "public static final Map<LongType, LongType> longVariableName =\n" +
+       "variableValue;",
+       "public static final Map<LongType, LongType> longVariableName\n" +
+       "        = variableValue;");
+   }
+   public void testRightMargin_3() throws Exception {
+     getSettings().RIGHT_MARGIN = 65;
+     getSettings().ASSIGNMENT_WRAP = CodeStyleSettings.WRAP_AS_NEEDED;
+     getSettings().PLACE_ASSIGNMENT_SIGN_ON_NEXT_LINE = false;
+     getSettings().KEEP_LINE_BREAKS = false;
+     doClassTest(
+       "public static final Map<LongType, LongType> longVariableName =\n" +
+       "variableValue;",
+       "public static final Map<LongType, LongType>\n" +
+       "        longVariableName = variableValue;");
+   }
+   public void testDoNotRemoveLineBreaksBetweenComments(){
+     getSettings().KEEP_LINE_BREAKS = false;
+     getSettings().KEEP_FIRST_COLUMN_COMMENT = false;
+     doTextTest(
+       "public class Foo {\n" +
+       "   //here is a comment\n" +
+       "   //line 2 of comment\n" +
+       "   public void myMethod() {\n" +
+       "       //a comment\n" +
+       "       //... another comment\n" +
+       "   }\n" +
+       "\n" +
+       "//save for later\n" +
+       "//    public void incompleteMethod() {\n" +
+       "//        int blah = 0;\n" +
+       "//        callSomeMethod();\n" +
+       "//        callSomeOtherMethod();\n" +
+       "//        doSomethingElse();\n" +
+       "//    }\n" +
+       "\n" +
+       "//comment at first line\n" +
+       "}",
+       "public class Foo {\n" +
+       "    //here is a comment\n" +
+       "    //line 2 of comment\n" +
+       "    public void myMethod() {\n" +
+       "        //a comment\n" +
+       "        //... another comment\n" +
+       "    }\n" +
+       "\n" +
+       "    //save for later\n" +
+       "    //    public void incompleteMethod() {\n" +
+       "    //        int blah = 0;\n" +
+       "    //        callSomeMethod();\n" +
+       "    //        callSomeOtherMethod();\n" +
+       "    //        doSomethingElse();\n" +
+       "    //    }\n" +
+       "\n" +
+       "    //comment at first line\n" +
+       "}");
+   }
+   public void testWrapParamsOnEveryItem() throws Exception {
+     CodeStyleSettings codeStyleSettings = CodeStyleSettingsManager.getSettings(getProject());
+     int oldMargin = codeStyleSettings.RIGHT_MARGIN;
+     boolean oldKeep = codeStyleSettings.KEEP_LINE_BREAKS;
+     int oldWrap = codeStyleSettings.METHOD_PARAMETERS_WRAP;
+     try {
+       codeStyleSettings.RIGHT_MARGIN = 80;
+       codeStyleSettings.KEEP_LINE_BREAKS = false;
+       codeStyleSettings.METHOD_PARAMETERS_WRAP = CodeStyleSettings.WRAP_ON_EVERY_ITEM;
+       doClassTest(
+         "public void foo(String p1,\n" +
+         "                String p2,\n" +
+         "                String p3,\n" +
+         "                String p4,\n" +
+         "                String p5,\n" +
+         "                String p6,\n" +
+         "                String p7) {\n" +
+         "    //To change body of implemented methods use File | Settings | File Templates.\n" +
+         "}",
+         "public void foo(String p1,\n" +
+         "                String p2,\n" +
+         "                String p3,\n" +
+         "                String p4,\n" +
+         "                String p5,\n" +
+         "                String p6,\n" +
+         "                String p7) {\n" +
+         "    //To change body of implemented methods use File | Settings | File Templates.\n" +
+         "}");
+     }
+     finally {
+       codeStyleSettings.RIGHT_MARGIN = oldMargin;
+       codeStyleSettings.KEEP_LINE_BREAKS = oldKeep;
+       codeStyleSettings.METHOD_PARAMETERS_WRAP = oldWrap;
+     }
+   }
+   public void testCommentAfterDeclaration() throws Exception {
+     CodeStyleSettings codeStyleSettings = CodeStyleSettingsManager.getSettings(getProject());
+     int oldMargin = codeStyleSettings.RIGHT_MARGIN;
+     try {
+       codeStyleSettings.RIGHT_MARGIN = 20;
+       codeStyleSettings.ASSIGNMENT_WRAP = CodeStyleSettings.WRAP_AS_NEEDED;
+       doMethodTest(
+         "int i=0; //comment comment",
+         "int i =\n" +
+         "        0; //comment comment"
+       );
+     }
+     finally {
+       codeStyleSettings.RIGHT_MARGIN = oldMargin;
+     }
+   }
+   private static String prepareText(String actual) {
+     if (actual.startsWith("\n")) {
+       actual = actual.substring(1);
+     }
+     if (actual.startsWith("\n")) {
+       actual = actual.substring(1);
+     }
+     // Strip trailing spaces
+     final Document doc = EditorFactory.getInstance().createDocument(actual);
+     CommandProcessor.getInstance().executeCommand(getProject(), new Runnable() {
+       public void run() {
+         ApplicationManager.getApplication().runWriteAction(new Runnable() {
+           public void run() {
+             ((DocumentEx)doc).stripTrailingSpaces(false);
+           }
+         });
+       }
+     }, "formatting", null);
+     return doc.getText();
+   }
+   private static String loadFile(String name) throws Exception {
+     String fullName = BASE_PATH + File.separatorChar + name;
+     String text = new String(FileUtil.loadFileText(new File(fullName)));
+     text = StringUtil.convertLineSeparators(text);
+     return text;
+   }
+ }
index 7225d898fe3e3c764805b2a962dd0afb9e0d0441,75e1a35a8e0898f4ea72cc8c896f640258f68249..0b829ad023337dd3a69f047f2c529c4019480ddf
@@@ -3,6 -3,6 +3,7 @@@
   */
  package com.intellij.refactoring;
  
++import com.intellij.JavaTestUtil;
  import com.intellij.codeInsight.TargetElementUtilBase;
  import com.intellij.psi.PsiClass;
  import com.intellij.psi.PsiElement;
@@@ -13,7 -13,7 +14,6 @@@ import com.intellij.refactoring.makeSta
  import com.intellij.refactoring.makeStatic.Settings;
  import com.intellij.refactoring.util.ParameterTablePanel;
  import com.intellij.testFramework.LightCodeInsightTestCase;
--import com.intellij.JavaTestUtil;
  
  import java.util.ArrayList;
  
index 13ccc9e1d63355e7104dfb5a9c2f628b90ac73ac,bcd37512ea388c0756b360d5e3b2f9c49b24b2ac..cb1f583ed899625be053477c551642dd53f75c04
@@@ -18,13 -18,13 +18,12 @@@ package com.intellij.psi.impl
  
  import com.intellij.navigation.ItemPresentation;
  import com.intellij.openapi.diagnostic.Logger;
++import com.intellij.openapi.progress.ProcessCanceledException;
++import com.intellij.openapi.project.IndexNotReadyException;
  import com.intellij.openapi.util.IconLoader;
  import com.intellij.openapi.util.Iconable;
--import com.intellij.openapi.util.Key;
  import com.intellij.openapi.util.UserDataHolderBase;
  import com.intellij.openapi.vfs.VirtualFile;
--import com.intellij.openapi.progress.ProcessCanceledException;
--import com.intellij.openapi.project.IndexNotReadyException;
  import com.intellij.psi.PsiElement;
  import com.intellij.psi.PsiFile;
  import com.intellij.ui.IconDeferrer;
index 002adafe42c4f4efa9504ceb7eab223443cb9f78,87252b72425c30ca498e422412cd63ccfb48b422..1bd9aa0360dc9d4f06b44be5d95e868d1057b991
@@@ -43,9 -43,9 +43,7 @@@ import com.intellij.openapi.fileEditor.
  import com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl;
  import com.intellij.openapi.fileTypes.FileType;
  import com.intellij.openapi.fileTypes.StdFileTypes;
--import com.intellij.openapi.project.DumbAwareAction;
  import com.intellij.openapi.project.Project;
--import com.intellij.openapi.ui.DialogBuilder;
  import com.intellij.openapi.util.Disposer;
  import com.intellij.openapi.util.Ref;
  import com.intellij.openapi.util.TextRange;
index 272a8e96d33c4f4f366a6e24843200c714fee0d4,fc065965bbbc5883e2489f3c2aaebb4ef78dbc15..4bff9fe4cb8f28fa5d31a3083a9e0dc8a85b2d79
@@@ -20,7 -20,7 +20,6 @@@ import com.intellij.history.core.change
  import com.intellij.history.core.tree.DirectoryEntry;
  import com.intellij.history.core.tree.Entry;
  import com.intellij.history.core.tree.FileEntry;
--import com.intellij.history.core.tree.RootEntry;
  
  import java.io.DataInput;
  import java.io.DataOutput;
index 33c66ed5d40c8e6394bcd0de1af3109993536db5,81b1e406f0158deb8fc17ea37c3f31f208c64e37..c49ff116a74495aa79826920ac0d3b3da33800c4
@@@ -24,15 -24,15 +24,12 @@@ import com.intellij.history.core.revisi
  import com.intellij.history.core.tree.Entry;
  import com.intellij.history.utils.RunnableAdapter;
  import com.intellij.openapi.module.Module;
--import com.intellij.openapi.roots.ModifiableRootModel;
--import com.intellij.openapi.roots.ModuleRootManager;
  import com.intellij.openapi.util.io.FileUtil;
  import com.intellij.openapi.vfs.*;
  import com.intellij.util.io.ReadOnlyAttributeUtil;
  
  import java.io.File;
  import java.io.IOException;
--import java.util.Arrays;
  import java.util.List;
  
  public class FileListeningTest extends IntegrationTestCase {
index 17dae5393682138794dc4a3913de86f03c314200,6579dab538e02f987b08ab844fa6b026064553af..376a7cd6def73e002377925b399167e09947eb0f
@@@ -16,9 -16,9 +16,9 @@@
  package com.intellij.ui.content;
  
  import com.intellij.openapi.Disposable;
--import com.intellij.openapi.util.ActionCallback;
  import com.intellij.openapi.actionSystem.AnAction;
  import com.intellij.openapi.actionSystem.DataProvider;
++import com.intellij.openapi.util.ActionCallback;
  import org.jetbrains.annotations.NotNull;
  import org.jetbrains.annotations.Nullable;
  
index 41732d5d7ca2c97378baefde4479d39b1569baff,fec419ca7fa47123cd2300206e8bf4cef27f82ae..7072d77b4536b6f1f571dc6e6467ba9e3d8ad78d
@@@ -21,7 -22,7 +22,6 @@@ import com.intellij.ui.UIBundle
  import org.jetbrains.annotations.Nullable;
  
  import javax.swing.*;
--import javax.swing.tree.TreeModel;
  import java.awt.*;
  import java.awt.event.*;
  import java.util.ArrayList;
index ff92d0d0ac7f82cd70aae3342e18fb19c739f44f,ad481d58d4dbfb2a9a9cc8e5ecc06fb3f327d213..b4cf41be8fc2219535bdf906a33b423708216968
@@@ -23,7 -23,7 +23,6 @@@ import com.intellij.ui.IdeBorderFactory
  import com.intellij.util.ui.UIUtil;
  
  import javax.swing.*;
--import javax.swing.border.Border;
  import java.awt.*;
  import java.util.ArrayList;
  import java.util.Arrays;
index b80ec9e5224b324ceef771e0d2db1001400f1344,8f3a4bf9c8ee05a8c7076ea3c94106a1f32ecb29..efc3f84d2bd410c45a151f9f2b99e0167e708110
@@@ -28,8 -29,8 +29,8 @@@ import com.intellij.openapi.fileEditor.
  import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx;
  import com.intellij.openapi.project.DumbAware;
  import com.intellij.openapi.project.Project;
--import com.intellij.openapi.ui.ShadowAction;
  import com.intellij.openapi.ui.Queryable;
++import com.intellij.openapi.ui.ShadowAction;
  import com.intellij.openapi.util.*;
  import com.intellij.openapi.vfs.VirtualFile;
  import com.intellij.openapi.wm.IdeFocusManager;
index f17b058255ced0ef9ac42ae414e6bb3a132c53eb,1ebd69ba2b3e279a6ba7e868ac82663f7867f48c..bfad17fc35b6e970910765df37192d07555046d5
@@@ -40,7 -40,7 +40,6 @@@ import java.awt.event.FocusEvent
  import java.awt.event.KeyEvent;
  import java.lang.ref.WeakReference;
  import java.util.ArrayList;
--import java.util.Iterator;
  import java.util.Map;
  import java.util.Set;
  
index e4bd6eda7ed48683934ceeb4c1a0b38c87d7da69,9f1ad0e583e30ed11349b4c11d7c71912ffbf5be..d3d65195ddda3f80fd1776c85b1da9afdea78b02
  package com.intellij.openapi.wm.impl;
  
  import com.intellij.openapi.Disposable;
--import com.intellij.openapi.ui.MessageType;
--import com.intellij.openapi.components.ServiceManager;
  import com.intellij.openapi.actionSystem.AnAction;
  import com.intellij.openapi.actionSystem.DataProvider;
++import com.intellij.openapi.components.ServiceManager;
++import com.intellij.openapi.ui.MessageType;
  import com.intellij.openapi.util.ActionCallback;
--import com.intellij.openapi.util.Condition;
  import com.intellij.openapi.util.ActiveRunnable;
++import com.intellij.openapi.util.Condition;
  import com.intellij.openapi.wm.*;
  import com.intellij.openapi.wm.ex.ToolWindowManagerEx;
  import com.intellij.openapi.wm.ex.ToolWindowManagerListener;
@@@ -46,9 -46,9 +46,9 @@@ import javax.swing.*
  import javax.swing.event.HyperlinkListener;
  import java.awt.*;
  import java.awt.event.InputEvent;
++import java.util.ArrayList;
  import java.util.Collections;
  import java.util.List;
--import java.util.ArrayList;
  
  @SuppressWarnings({"ConstantConditions"})
  public class ToolWindowHeadlessManagerImpl extends ToolWindowManagerEx {
index 9deeea23b94e9025aa0e83bc5e19a58911628949,ef805034e20b8e6b0fecdc803e3587cdf41dfd4e..48315b78a55b67327b6620eb624abf766f7b3528
@@@ -28,7 -28,7 +28,6 @@@ import com.intellij.openapi.util.text.S
  import com.intellij.openapi.vfs.LocalFileSystem;
  import com.intellij.openapi.vfs.VfsUtil;
  import com.intellij.openapi.vfs.VirtualFile;
--import com.intellij.openapi.vfs.VirtualFileSystem;
  import com.intellij.psi.PsiElement;
  import com.intellij.psi.PsiFile;
  import com.intellij.psi.PsiManager;
index 5ab5a16bd3513a4767899237316891f75336b803,8124b2118b9eb31b7c4f341f6dcd850c9bc0eaf7..479896edef4d63fd17c49e06d38339db77d49bea
@@@ -26,8 -29,8 +29,6 @@@ import org.jetbrains.idea.maven.dom.Mav
  import org.jetbrains.idea.maven.dom.model.MavenDomDependencies;
  import org.jetbrains.idea.maven.dom.model.MavenDomDependency;
  import org.jetbrains.idea.maven.dom.model.MavenDomProjectModel;
--import org.jetbrains.idea.maven.project.MavenId;
--import org.jetbrains.idea.maven.project.MavenProjectsManager;
  import org.jetbrains.idea.maven.utils.MavenIcons;
  
  import java.util.List;
index 0000000000000000000000000000000000000000,2593ad4fc5518de5ab019d3df8af677d1f451561..d2366180e0008c0e5eedb8cb1acd267f5f2b9635
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,43 +1,42 @@@
 -import com.intellij.codeInspection.InspectionToolProvider;
+ /*
+  * Copyright 2000-2010 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.
+  * You may obtain a copy of the License at
+  *
+  * http://www.apache.org/licenses/LICENSE-2.0
+  *
+  * Unless required by applicable law or agreed to in writing, software
+  * distributed under the License is distributed on an "AS IS" BASIS,
+  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  * See the License for the specific language governing permissions and
+  * limitations under the License.
+  */
+ package org.jetbrains.idea.maven.dom.inspections;
+ import com.intellij.util.xml.highlighting.BasicDomElementsInspection;
+ import org.jetbrains.annotations.NotNull;
+ import org.jetbrains.idea.maven.dom.MavenDomBundle;
+ import org.jetbrains.idea.maven.dom.model.MavenDomProjectModel;
+ public class MavenModelInspection extends BasicDomElementsInspection<MavenDomProjectModel> {
+   public MavenModelInspection() {
+     super(MavenDomProjectModel.class);
+   }
+   @NotNull
+   public String getGroupDisplayName() {
+     return MavenDomBundle.message("inspection.group");
+   }
+   @NotNull
+   public String getDisplayName() {
+     return MavenDomBundle.message("inspection.name");
+   }
+   @NotNull
+   public String getShortName() {
+     return "MavenModelInspection";
+   }
+ }
index 1e6bbaa44eca17ca8306f43aabce0072d3ae3b9f,9b27ce1f33b07bc758ed0f5353d88c741db44aad..a328710c864915cb7fc182b7e12af5951648c046
@@@ -22,7 -22,7 +22,6 @@@ import com.intellij.openapi.command.Wri
  import com.intellij.openapi.editor.Editor;
  import com.intellij.openapi.project.Project;
  import com.intellij.openapi.ui.DialogWrapper;
--import com.intellij.openapi.util.Pair;
  import com.intellij.psi.PsiElement;
  import com.intellij.psi.PsiFile;
  import com.intellij.psi.xml.XmlElement;
index 0000000000000000000000000000000000000000,8936bdf142305f516551b958bee512bef2334a58..5e7077aa79b3bd32c6eeccfc79311bf49e06b287
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,138 +1,139 @@@
 -import java.util.*;
+ /*
+  * Copyright 2000-2009 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.
+  * You may obtain a copy of the License at
+  *
+  * http://www.apache.org/licenses/LICENSE-2.0
+  *
+  * Unless required by applicable law or agreed to in writing, software
+  * distributed under the License is distributed on an "AS IS" BASIS,
+  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  * See the License for the specific language governing permissions and
+  * limitations under the License.
+  */
+ package org.jetbrains.idea.maven.embedder;
+ import com.intellij.openapi.util.io.FileUtil;
+ import com.intellij.openapi.util.text.StringUtil;
+ import com.intellij.openapi.vfs.JarFileSystem;
+ import com.intellij.openapi.vfs.LocalFileSystem;
+ import com.intellij.openapi.vfs.VfsUtil;
+ import com.intellij.openapi.vfs.VirtualFile;
+ import org.jetbrains.annotations.NotNull;
+ import org.jetbrains.annotations.Nullable;
+ import org.jetbrains.idea.maven.utils.MavenConstants;
+ import org.jetbrains.idea.maven.utils.MavenJDOMUtil;
+ import org.jetbrains.maven.embedder.MavenEmbedderUtil;
+ import java.io.File;
+ import java.io.IOException;
+ import java.net.URL;
++import java.util.Map;
++import java.util.Properties;
+ import java.util.regex.Pattern;
+ public class MavenEmbedderUtilEx extends MavenEmbedderUtil {
+   private static final String REPOSITORY_DIR = "repository";
+   private static final String LIB_DIR = "lib";
+   private static final String SUPER_POM_PATH = "org/apache/maven/project/" + MavenConstants.SUPER_POM_XML;
+   @NotNull
+   public static VirtualFile resolveSuperPomFile(@Nullable String overrideMavenHome) {
+     VirtualFile result = doResolveSuperPomFile(overrideMavenHome);
+     if (result == null) {
+       URL resource = MavenEmbedderUtilEx.class.getResource("/" + SUPER_POM_PATH);
+       return VfsUtil.findFileByURL(resource);
+     }
+     return result;
+   }
+   @Nullable
+   private static VirtualFile doResolveSuperPomFile(String overrideMavenHome) {
+     File lib = resolveMavenLib(overrideMavenHome);
+     if (lib == null) return null;
+     VirtualFile file = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(lib);
+     if (file == null) return null;
+     VirtualFile root = JarFileSystem.getInstance().getJarRootForLocalFile(file);
+     if (root == null) return null;
+     return root.findFileByRelativePath(SUPER_POM_PATH);
+   }
+   @Nullable
+   private static File resolveMavenLib(String overrideMavenHome) {
+     File directory = resolveMavenHomeDirectory(overrideMavenHome);
+     if (directory == null) return null;
+     File libs = new File(directory, LIB_DIR);
+     File[] files = libs.listFiles();
+     if (files != null) {
+       Pattern pattern = Pattern.compile("maven-\\d+\\.\\d+\\.\\d+-uber\\.jar");
+       for (File each : files) {
+         if (pattern.matcher(each.getName()).matches()) {
+           return each;
+         }
+       }
+     }
+     return null;
+   }
+   @NotNull
+   public static File resolveLocalRepository(@Nullable String mavenHome, @Nullable String userSettings, @Nullable String override) {
+     File result = doResolveLocalRepository(mavenHome, userSettings, override);
+     try {
+       return result.getCanonicalFile();
+     }
+     catch (IOException e) {
+       return result;
+     }
+   }
+   @NotNull
+   private static File doResolveLocalRepository(String mavenHome, String userSettings, String override) {
+     if (!StringUtil.isEmpty(override)) {
+       return new File(override);
+     }
+     final File userSettingsFile = resolveUserSettingsFile(userSettings);
+     if (userSettingsFile != null) {
+       final String fromUserSettings = getRepositoryFromSettings(userSettingsFile);
+       if (!StringUtil.isEmpty(fromUserSettings)) {
+         return new File(fromUserSettings);
+       }
+     }
+     final File globalSettingsFile = resolveGlobalSettingsFile(mavenHome);
+     if (globalSettingsFile != null) {
+       final String fromGlobalSettings = getRepositoryFromSettings(globalSettingsFile);
+       if (!StringUtil.isEmpty(fromGlobalSettings)) {
+         return new File(fromGlobalSettings);
+       }
+     }
+     return new File(resolveM2Dir(), REPOSITORY_DIR);
+   }
+   @Nullable
+   private static String getRepositoryFromSettings(final File file) {
+     try {
+       byte[] bytes = FileUtil.loadFileBytes(file);
+       return expandProperties(MavenJDOMUtil.findChildValueByPath(MavenJDOMUtil.read(bytes, null), "localRepository", null));
+     }
+     catch (IOException e) {
+       return null;
+     }
+   }
+   private static String expandProperties(String text) {
+     if (StringUtil.isEmptyOrSpaces(text)) return text;
+     Properties props = MavenEmbedderWrapper.collectSystemProperties();
+     for (Map.Entry<Object, Object> each : props.entrySet()) {
+       text = text.replace("${" + each.getKey() + "}", (CharSequence)each.getValue());
+     }
+     return text;
+   }
+ }
index 5eb65ee61a81916bb37bbfb152e804c64c92a836,859381cbb4f2ead4386d9f70d4a00d75e74b6a13..de3e7e9c439402a95cdb96547a4279955b666161
@@@ -40,12 -40,11 +40,11 @@@ import org.jdom.Element
  import org.jdom.JDOMException;
  import org.jetbrains.annotations.NotNull;
  import org.jetbrains.annotations.TestOnly;
--import org.jetbrains.idea.maven.utils.MavenRehighlighter;
- import org.jetbrains.idea.maven.embedder.MavenEmbedderFactory;
  import org.jetbrains.idea.maven.embedder.MavenEmbedderWrapper;
  import org.jetbrains.idea.maven.project.MavenGeneralSettings;
  import org.jetbrains.idea.maven.project.MavenProjectsManager;
  import org.jetbrains.idea.maven.utils.MavenLog;
++import org.jetbrains.idea.maven.utils.MavenRehighlighter;
  import org.jetbrains.idea.maven.utils.MavenUtil;
  
  import java.io.File;
index 7a250c2efb9dae29cf2eac49898c7f7512862877,9460bd8948ff0d9b48f9b62f15fb5bb513a6d102..4cd77287fe49b333005d575fd3f45756851d15fd
@@@ -31,8 -31,8 +31,6 @@@ import org.jetbrains.idea.maven.utils.M
  import java.io.File;
  import java.io.Serializable;
  import java.text.MessageFormat;
--import java.util.ArrayList;
--import java.util.List;
  
  import static org.jetbrains.idea.maven.project.MavenId.append;
  
index 3a4318689f33b717dfeedae92ff4bd3cd2cb960a,90e727fc62dc5c6b6075216220f7988d52e8419b..37059c60ac3e71af54ef24e9ac8ebbb64066040f
  
  package org.jetbrains.idea.maven.project;
  
++import com.intellij.openapi.fileChooser.FileChooserDescriptor;
  import com.intellij.openapi.ui.LabeledComponent;
  import com.intellij.openapi.ui.TextFieldWithBrowseButton;
  import com.intellij.openapi.util.text.StringUtil;
--import com.intellij.openapi.fileChooser.FileChooserDescriptor;
  import org.jetbrains.annotations.Nullable;
- import org.jetbrains.idea.maven.embedder.MavenEmbedderFactory;
+ import org.jetbrains.idea.maven.embedder.MavenEmbedderUtilEx;
  
  import javax.swing.*;
  import java.awt.event.ActionEvent;
index 5127a8c7ddd7a6dc4489397391c9714a2374ccab,04d256c8d721d2bd023d15d1c08a8041158550fc..d1ec715a93edb551f21344af6576ea971d3f1592
@@@ -22,8 -22,8 +22,8 @@@ import org.apache.maven.artifact.handle
  import org.apache.maven.project.MavenProject;
  import org.codehaus.plexus.component.repository.ComponentDescriptor;
  import org.jetbrains.idea.maven.MavenImportingTestCase;
--import org.jetbrains.idea.maven.project.MavenId;
  import org.jetbrains.idea.maven.execution.SoutMavenConsole;
++import org.jetbrains.idea.maven.project.MavenId;
  
  import java.io.File;
  import java.util.Arrays;
Simple merge
index c0c4c41fb0756aaf50030169d93262dfb6eab37f,bdd81d2d631364098fbe3902b1a3e8473ee0b15c..4d1b222db8618a8dcf00527799d2f1973818fba5
@@@ -26,8 -26,8 +26,8 @@@ import com.intellij.psi.xml.XmlAttribut
  import com.intellij.psi.xml.XmlTag;
  import com.intellij.util.ProcessingContext;
  import com.intellij.util.containers.HashSet;
--import com.intellij.xml.util.XmlUtil;
  import com.intellij.xml.XmlAttributeDescriptor;
++import com.intellij.xml.util.XmlUtil;
  
  /**
   * @author peter