Merge branch 'master' of git.labs.intellij.net:idea/community
authorirengrig <Irina.Chernushina@jetbrains.com>
Thu, 21 Jan 2010 09:21:50 +0000 (12:21 +0300)
committerirengrig <Irina.Chernushina@jetbrains.com>
Thu, 21 Jan 2010 09:21:50 +0000 (12:21 +0300)
178 files changed:
java/java-tests/testData/codeInsight/completeStatement/AddMissingParen.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/AddMissingParen_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/AddMissingSemicolon.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/AddMissingSemicolon_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/AfterFor.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/AfterFor_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/AtBlockEnd.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/AtBlockEnd_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/BeforeFor.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/BeforeFor_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/BeforeStatement.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/BeforeStatement_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/Block.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/Block1.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/Block1_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/Block_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/BraceFixeNewLine.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/BraceFixeNewLine_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/CdrEndlessLoop.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/CdrEndlessLoop_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/CompleteBreak.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/CompleteBreak_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/CompleteCall.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/CompleteCall_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/CompleteCatch.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/CompleteCatchBody.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/CompleteCatchBody_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/CompleteCatchLParen.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/CompleteCatchLParen_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/CompleteCatchWithExpression.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/CompleteCatchWithExpression_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/CompleteCatch_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/CompleteElseIf.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/CompleteElseIf_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/CompleteIf.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/CompleteIfKeyword.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/CompleteIfKeywordStatementGoesToThen.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/CompleteIfKeywordStatementGoesToThen_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/CompleteIfKeyword_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/CompleteIfNextLineBraceStyle.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/CompleteIfNextLineBraceStyle2.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/CompleteIfNextLineBraceStyle2_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/CompleteIfNextLineBraceStyle_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/CompleteIfStatementGoesToThen.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/CompleteIfStatementGoesToThen_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/CompleteIf_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/CompleteStringLiteral.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/CompleteStringLiteral_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/ElseIf.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/ElseIf_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/EmptyBeforeReturn.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/EmptyBeforeReturn_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/EmptyLine.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/EmptyLine_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/ErrorNavigation.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/ErrorNavigation_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/Field.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/FieldWithInitializer.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/FieldWithInitializer_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/Field_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/FollowedByComment.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/FollowedByComment_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/For.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/ForBlock.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/ForBlock_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/ForEach.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/ForEach_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/ForIncrementExpressionAndBody.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/ForIncrementExpressionAndBody_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/For_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/ForceBlock.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/ForceBlock_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/IDEA22125.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/IDEA22125_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/IDEA22385.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/IDEA22385_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/IDEADEV1093.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/IDEADEV1093_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/IDEADEV13019.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/IDEADEV13019_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/IDEADEV1710.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/IDEADEV1710_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/IDEADEV20713.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/IDEADEV20713_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/IDEADEV40479.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/IDEADEV40479_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/IDEADEV434.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/IDEADEV434_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/If.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/If_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/InComment.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/InComment2.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/InComment2_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/InComment3.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/InComment3_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/InComment4.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/InComment4_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/InComment_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/InPreceedingBlanks.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/InPreceedingBlanks_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/IncompleteCall.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/IncompleteCall_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/IncompleteElseIf.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/IncompleteElseIf_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/Indentation.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/Indentation_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/InterfaceMethodSemicolon.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/InterfaceMethodSemicolon_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/Method.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/Method_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/NewInParentheses.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/NewInParentheses_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/NoBlockReturn.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/NoBlockReturn_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/NoErrors.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/NoErrors_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/NonAbstractMethodWithSemicolon.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/NonAbstractMethodWithSemicolon_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/Parenthesized.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/Parenthesized_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/Return.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/ReturnFromNonVoid.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/ReturnFromNonVoid_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/ReturnFromVoid.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/ReturnFromVoid_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/Return_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/SCR11147.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/SCR11147_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/SCR22904.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/SCR22904_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/SCR30227.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/SCR30227_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/SCR36110.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/SCR36110_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/SCR37331.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/SCR37331_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/StartNewBlock.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/StartNewBlock_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/StringLiteral.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/StringLiteral_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/SwitchKeyword.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/SwitchKeywordWithCondition.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/SwitchKeywordWithCondition_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/SwitchKeyword_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/Synchronized.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/Synchronized_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/Throw.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/Throw_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/Try1.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/Try1_after.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/TwoStatementsInLine.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/completeStatement/TwoStatementsInLine_after.java [new file with mode: 0644]
java/java-tests/testSrc/com/intellij/codeInsight/CompleteStatementTest.java [new file with mode: 0644]
java/java-tests/testSrc/com/intellij/codeInsight/completion/ClassNameCompletionTest.java
java/java-tests/testSrc/com/intellij/codeInsight/completion/CompletionSortingTestCase.java
java/java-tests/testSrc/com/intellij/codeInsight/completion/CompletionStyleTest.java
java/openapi/src/com/intellij/psi/JavaRecursiveElementWalkingVisitor.java
platform/lang-api/src/com/intellij/psi/PsiRecursiveElementWalkingVisitor.java
platform/lang-api/src/com/intellij/psi/PsiWalkingState.java
platform/lang-api/src/com/intellij/psi/WalkingState.java
platform/lang-impl/src/com/intellij/analysis/BaseAnalysisActionDialog.java
platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/LineMarkersPassFactory.java
platform/lang-impl/src/com/intellij/psi/impl/source/tree/RecursiveTreeElementWalkingVisitor.java
platform/testFramework/src/com/intellij/testFramework/TestDataPath.java [new file with mode: 0644]
platform/testFramework/src/com/intellij/testFramework/UsefulTestCase.java
plugins/IdeaTestAssistant/IdeaTestAssistant.iml [new file with mode: 0644]
plugins/IdeaTestAssistant/layout.xml [new file with mode: 0644]
plugins/IdeaTestAssistant/src/META-INF/plugin.xml [new file with mode: 0644]
plugins/IdeaTestAssistant/src/com/intellij/testAssistant/TestDataGroupEditorProvider.java [new file with mode: 0644]
plugins/IdeaTestAssistant/src/com/intellij/testAssistant/TestDataGroupFileEditor.java [new file with mode: 0644]
plugins/IdeaTestAssistant/src/com/intellij/testAssistant/TestDataGroupVirtualFile.java [new file with mode: 0644]
plugins/IdeaTestAssistant/src/com/intellij/testAssistant/TestDataLineMarkerProvider.java [new file with mode: 0644]
plugins/IdeaTestAssistant/src/com/intellij/testAssistant/TestDataReferenceCollector.java [new file with mode: 0644]
plugins/IdeaTestAssistant/testData/referenceCollector/DoFileTest.java [new file with mode: 0644]
plugins/IdeaTestAssistant/testData/referenceCollector/DoTestParameters.java [new file with mode: 0644]
plugins/IdeaTestAssistant/testData/referenceCollector/FixtureConfigureByFile.java [new file with mode: 0644]
plugins/IdeaTestAssistant/testData/referenceCollector/ReferencesInAnyMethod.java [new file with mode: 0644]
plugins/IdeaTestAssistant/testSrc/com/intellij/testAssistant/TestDataReferenceCollectorTest.java [new file with mode: 0644]

diff --git a/java/java-tests/testData/codeInsight/completeStatement/AddMissingParen.java b/java/java-tests/testData/codeInsight/completeStatement/AddMissingParen.java
new file mode 100644 (file)
index 0000000..daaf1b2
--- /dev/null
@@ -0,0 +1,7 @@
+
+class Foo {
+    abstract void a();
+    {
+        a<caret>(;
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/AddMissingParen_after.java b/java/java-tests/testData/codeInsight/completeStatement/AddMissingParen_after.java
new file mode 100644 (file)
index 0000000..3cf8eb4
--- /dev/null
@@ -0,0 +1,8 @@
+
+class Foo {
+    abstract void a();
+    
+    {
+        a();<caret>
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/AddMissingSemicolon.java b/java/java-tests/testData/codeInsight/completeStatement/AddMissingSemicolon.java
new file mode 100644 (file)
index 0000000..8653358
--- /dev/null
@@ -0,0 +1,7 @@
+
+class Foo {
+    abstract void a();
+    {
+        a(<caret>)
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/AddMissingSemicolon_after.java b/java/java-tests/testData/codeInsight/completeStatement/AddMissingSemicolon_after.java
new file mode 100644 (file)
index 0000000..3cf8eb4
--- /dev/null
@@ -0,0 +1,8 @@
+
+class Foo {
+    abstract void a();
+    
+    {
+        a();<caret>
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/AfterFor.java b/java/java-tests/testData/codeInsight/completeStatement/AfterFor.java
new file mode 100644 (file)
index 0000000..edd3a94
--- /dev/null
@@ -0,0 +1,6 @@
+public class Foo {
+    {
+        for(int i = 0; i < 100; i++) {
+        }<caret>
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/AfterFor_after.java b/java/java-tests/testData/codeInsight/completeStatement/AfterFor_after.java
new file mode 100644 (file)
index 0000000..9d15392
--- /dev/null
@@ -0,0 +1,7 @@
+public class Foo {
+    {
+        for(int i = 0; i < 100; i++) {
+        }
+        <caret>
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/AtBlockEnd.java b/java/java-tests/testData/codeInsight/completeStatement/AtBlockEnd.java
new file mode 100644 (file)
index 0000000..f163594
--- /dev/null
@@ -0,0 +1,7 @@
+public class Foo {
+    {
+        for(int i = 0; i < 100; i++) {
+            x = 3;
+   <caret>     }
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/AtBlockEnd_after.java b/java/java-tests/testData/codeInsight/completeStatement/AtBlockEnd_after.java
new file mode 100644 (file)
index 0000000..f83fa8a
--- /dev/null
@@ -0,0 +1,8 @@
+public class Foo {
+    {
+        for(int i = 0; i < 100; i++) {
+            x = 3;
+            <caret>
+        }
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/BeforeFor.java b/java/java-tests/testData/codeInsight/completeStatement/BeforeFor.java
new file mode 100644 (file)
index 0000000..1b61cf5
--- /dev/null
@@ -0,0 +1,6 @@
+public class Foo {
+    {
+        <caret>for (int i = 0; i < 100; i++) {
+        }
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/BeforeFor_after.java b/java/java-tests/testData/codeInsight/completeStatement/BeforeFor_after.java
new file mode 100644 (file)
index 0000000..dc6562b
--- /dev/null
@@ -0,0 +1,7 @@
+public class Foo {
+    {
+        <caret>
+        for (int i = 0; i < 100; i++) {
+        }
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/BeforeStatement.java b/java/java-tests/testData/codeInsight/completeStatement/BeforeStatement.java
new file mode 100644 (file)
index 0000000..a475f8b
--- /dev/null
@@ -0,0 +1,5 @@
+public class Foo {
+    {
+<caret>        x = 3;
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/BeforeStatement_after.java b/java/java-tests/testData/codeInsight/completeStatement/BeforeStatement_after.java
new file mode 100644 (file)
index 0000000..bcee224
--- /dev/null
@@ -0,0 +1,6 @@
+public class Foo {
+    {
+        <caret>
+        x = 3;
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/Block.java b/java/java-tests/testData/codeInsight/completeStatement/Block.java
new file mode 100644 (file)
index 0000000..dbc20af
--- /dev/null
@@ -0,0 +1,6 @@
+
+class Foo {
+    {
+        if (x) {<caret>
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/Block1.java b/java/java-tests/testData/codeInsight/completeStatement/Block1.java
new file mode 100644 (file)
index 0000000..17b9443
--- /dev/null
@@ -0,0 +1,6 @@
+public class Foo {
+    {
+        {<caret>
+        }
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/Block1_after.java b/java/java-tests/testData/codeInsight/completeStatement/Block1_after.java
new file mode 100644 (file)
index 0000000..dc8bd2e
--- /dev/null
@@ -0,0 +1,7 @@
+public class Foo {
+    {
+        {
+            <caret>
+        }
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/Block_after.java b/java/java-tests/testData/codeInsight/completeStatement/Block_after.java
new file mode 100644 (file)
index 0000000..bfaf383
--- /dev/null
@@ -0,0 +1,8 @@
+
+class Foo {
+    {
+        if (x) {
+            <caret>
+        }
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/BraceFixeNewLine.java b/java/java-tests/testData/codeInsight/completeStatement/BraceFixeNewLine.java
new file mode 100644 (file)
index 0000000..cfc79f4
--- /dev/null
@@ -0,0 +1,9 @@
+public class test {
+    void f() {
+        int k1 = 1;
+        int k2 = 2;
+        int[] array = new int[]{k1, k2<caret>
+
+        System.out.print(k1);
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/BraceFixeNewLine_after.java b/java/java-tests/testData/codeInsight/completeStatement/BraceFixeNewLine_after.java
new file mode 100644 (file)
index 0000000..7a129a9
--- /dev/null
@@ -0,0 +1,9 @@
+public class test {
+    void f() {
+        int k1 = 1;
+        int k2 = 2;
+        int[] array = new int[]{k1, k2};
+
+        System.out.print(k1);
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/CdrEndlessLoop.java b/java/java-tests/testData/codeInsight/completeStatement/CdrEndlessLoop.java
new file mode 100644 (file)
index 0000000..e221622
--- /dev/null
@@ -0,0 +1,5 @@
+public class Test {
+    public int foo(int i) {
+        int ii = foo(0<caret>
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/CdrEndlessLoop_after.java b/java/java-tests/testData/codeInsight/completeStatement/CdrEndlessLoop_after.java
new file mode 100644 (file)
index 0000000..b690a46
--- /dev/null
@@ -0,0 +1,5 @@
+public class Test {
+    public int foo(int i) {
+        int ii = foo(0);<caret>
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/CompleteBreak.java b/java/java-tests/testData/codeInsight/completeStatement/CompleteBreak.java
new file mode 100644 (file)
index 0000000..5d95b11
--- /dev/null
@@ -0,0 +1,8 @@
+
+class Foo {
+    {
+        if (x) {
+                    break<caret>
+        }
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/CompleteBreak_after.java b/java/java-tests/testData/codeInsight/completeStatement/CompleteBreak_after.java
new file mode 100644 (file)
index 0000000..78ee45d
--- /dev/null
@@ -0,0 +1,8 @@
+
+class Foo {
+    {
+        if (x) {
+            break;<caret>            
+        }
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/CompleteCall.java b/java/java-tests/testData/codeInsight/completeStatement/CompleteCall.java
new file mode 100644 (file)
index 0000000..b13eca1
--- /dev/null
@@ -0,0 +1,6 @@
+
+public class Foo {
+    {
+        foo<caret>(x);
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/CompleteCall_after.java b/java/java-tests/testData/codeInsight/completeStatement/CompleteCall_after.java
new file mode 100644 (file)
index 0000000..1c714c2
--- /dev/null
@@ -0,0 +1,7 @@
+
+public class Foo {
+    {
+        foo(x);
+        <caret>
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/CompleteCatch.java b/java/java-tests/testData/codeInsight/completeStatement/CompleteCatch.java
new file mode 100644 (file)
index 0000000..6cd9279
--- /dev/null
@@ -0,0 +1,8 @@
+
+class Foo {
+    {
+        try {
+
+        } catch<caret>
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/CompleteCatchBody.java b/java/java-tests/testData/codeInsight/completeStatement/CompleteCatchBody.java
new file mode 100644 (file)
index 0000000..adf423f
--- /dev/null
@@ -0,0 +1,8 @@
+
+class Foo {
+    {
+        try {
+
+        } catch (a<caret> b)
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/CompleteCatchBody_after.java b/java/java-tests/testData/codeInsight/completeStatement/CompleteCatchBody_after.java
new file mode 100644 (file)
index 0000000..15b3344
--- /dev/null
@@ -0,0 +1,10 @@
+
+class Foo {
+    {
+        try {
+
+        } catch (a b) {
+            <caret>
+        }
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/CompleteCatchLParen.java b/java/java-tests/testData/codeInsight/completeStatement/CompleteCatchLParen.java
new file mode 100644 (file)
index 0000000..001be05
--- /dev/null
@@ -0,0 +1,8 @@
+
+class Foo {
+    {
+        try {
+
+        } catch (<caret>
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/CompleteCatchLParen_after.java b/java/java-tests/testData/codeInsight/completeStatement/CompleteCatchLParen_after.java
new file mode 100644 (file)
index 0000000..7c4d093
--- /dev/null
@@ -0,0 +1,9 @@
+
+class Foo {
+    {
+        try {
+
+        } catch (<caret>) {
+        }
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/CompleteCatchWithExpression.java b/java/java-tests/testData/codeInsight/completeStatement/CompleteCatchWithExpression.java
new file mode 100644 (file)
index 0000000..ffd4f3c
--- /dev/null
@@ -0,0 +1,8 @@
+
+class Foo {
+    {
+        try {
+
+        } catch (a<caret>
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/CompleteCatchWithExpression_after.java b/java/java-tests/testData/codeInsight/completeStatement/CompleteCatchWithExpression_after.java
new file mode 100644 (file)
index 0000000..0b43a4e
--- /dev/null
@@ -0,0 +1,9 @@
+
+class Foo {
+    {
+        try {
+
+        } catch (<caret>a) {
+        }
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/CompleteCatch_after.java b/java/java-tests/testData/codeInsight/completeStatement/CompleteCatch_after.java
new file mode 100644 (file)
index 0000000..7c4d093
--- /dev/null
@@ -0,0 +1,9 @@
+
+class Foo {
+    {
+        try {
+
+        } catch (<caret>) {
+        }
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/CompleteElseIf.java b/java/java-tests/testData/codeInsight/completeStatement/CompleteElseIf.java
new file mode 100644 (file)
index 0000000..a7e2e11
--- /dev/null
@@ -0,0 +1,9 @@
+public class Test {
+    public void foo(int x) {
+        if (x > 0) {
+            System.out.println("true");
+        } else {
+            System.out.println("true");
+        }<caret>
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/CompleteElseIf_after.java b/java/java-tests/testData/codeInsight/completeStatement/CompleteElseIf_after.java
new file mode 100644 (file)
index 0000000..3a4ec51
--- /dev/null
@@ -0,0 +1,10 @@
+public class Test {
+    public void foo(int x) {
+        if (x > 0) {
+            System.out.println("true");
+        } else {
+            System.out.println("true");
+        }
+        <caret>
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/CompleteIf.java b/java/java-tests/testData/codeInsight/completeStatement/CompleteIf.java
new file mode 100644 (file)
index 0000000..1e44cdc
--- /dev/null
@@ -0,0 +1,6 @@
+
+class Foo {
+    {
+        if (a<caret>
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/CompleteIfKeyword.java b/java/java-tests/testData/codeInsight/completeStatement/CompleteIfKeyword.java
new file mode 100644 (file)
index 0000000..c225798
--- /dev/null
@@ -0,0 +1,6 @@
+
+class foo {
+    {
+      if<caret>
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/CompleteIfKeywordStatementGoesToThen.java b/java/java-tests/testData/codeInsight/completeStatement/CompleteIfKeywordStatementGoesToThen.java
new file mode 100644 (file)
index 0000000..18a1110
--- /dev/null
@@ -0,0 +1,8 @@
+
+class foo {
+    {
+        if <caret>foo();
+    }
+    
+    void foo() {}
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/CompleteIfKeywordStatementGoesToThen_after.java b/java/java-tests/testData/codeInsight/completeStatement/CompleteIfKeywordStatementGoesToThen_after.java
new file mode 100644 (file)
index 0000000..8a554d0
--- /dev/null
@@ -0,0 +1,10 @@
+
+class foo {
+    {
+        if (<caret>) {
+            foo();
+        }
+    }
+    
+    void foo() {}
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/CompleteIfKeyword_after.java b/java/java-tests/testData/codeInsight/completeStatement/CompleteIfKeyword_after.java
new file mode 100644 (file)
index 0000000..fb645d2
--- /dev/null
@@ -0,0 +1,7 @@
+
+class foo {
+    {
+        if (<caret>) {
+        }
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/CompleteIfNextLineBraceStyle.java b/java/java-tests/testData/codeInsight/completeStatement/CompleteIfNextLineBraceStyle.java
new file mode 100644 (file)
index 0000000..14f8ca7
--- /dev/null
@@ -0,0 +1,7 @@
+
+class Foo
+{
+    {
+        if (a<caret>
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/CompleteIfNextLineBraceStyle2.java b/java/java-tests/testData/codeInsight/completeStatement/CompleteIfNextLineBraceStyle2.java
new file mode 100644 (file)
index 0000000..048bb12
--- /dev/null
@@ -0,0 +1,9 @@
+
+class Foo
+{
+    {
+        if (a<caret>)
+        {
+        }
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/CompleteIfNextLineBraceStyle2_after.java b/java/java-tests/testData/codeInsight/completeStatement/CompleteIfNextLineBraceStyle2_after.java
new file mode 100644 (file)
index 0000000..53e37bd
--- /dev/null
@@ -0,0 +1,10 @@
+
+class Foo
+{
+    {
+        if (a)
+        {
+            <caret>
+        }
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/CompleteIfNextLineBraceStyle_after.java b/java/java-tests/testData/codeInsight/completeStatement/CompleteIfNextLineBraceStyle_after.java
new file mode 100644 (file)
index 0000000..53e37bd
--- /dev/null
@@ -0,0 +1,10 @@
+
+class Foo
+{
+    {
+        if (a)
+        {
+            <caret>
+        }
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/CompleteIfStatementGoesToThen.java b/java/java-tests/testData/codeInsight/completeStatement/CompleteIfStatementGoesToThen.java
new file mode 100644 (file)
index 0000000..def4f52
--- /dev/null
@@ -0,0 +1,8 @@
+
+class foo {
+    {
+        if (<caret>foo();
+    }
+    
+    void foo() {}
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/CompleteIfStatementGoesToThen_after.java b/java/java-tests/testData/codeInsight/completeStatement/CompleteIfStatementGoesToThen_after.java
new file mode 100644 (file)
index 0000000..8a554d0
--- /dev/null
@@ -0,0 +1,10 @@
+
+class foo {
+    {
+        if (<caret>) {
+            foo();
+        }
+    }
+    
+    void foo() {}
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/CompleteIf_after.java b/java/java-tests/testData/codeInsight/completeStatement/CompleteIf_after.java
new file mode 100644 (file)
index 0000000..4ea34f8
--- /dev/null
@@ -0,0 +1,8 @@
+
+class Foo {
+    {
+        if (a) {
+            <caret>
+        }
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/CompleteStringLiteral.java b/java/java-tests/testData/codeInsight/completeStatement/CompleteStringLiteral.java
new file mode 100644 (file)
index 0000000..80e87d8
--- /dev/null
@@ -0,0 +1,5 @@
+public class Foo {
+    public void foo() {
+        String s = "abc<caret>def";
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/CompleteStringLiteral_after.java b/java/java-tests/testData/codeInsight/completeStatement/CompleteStringLiteral_after.java
new file mode 100644 (file)
index 0000000..7109341
--- /dev/null
@@ -0,0 +1,6 @@
+public class Foo {
+    public void foo() {
+        String s = "abcdef";
+        <caret>
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/ElseIf.java b/java/java-tests/testData/codeInsight/completeStatement/ElseIf.java
new file mode 100644 (file)
index 0000000..4596f76
--- /dev/null
@@ -0,0 +1,7 @@
+class Test {
+    {
+        if(x) {
+          x();
+        } else if(<caret>)
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/ElseIf_after.java b/java/java-tests/testData/codeInsight/completeStatement/ElseIf_after.java
new file mode 100644 (file)
index 0000000..4b92ec0
--- /dev/null
@@ -0,0 +1,8 @@
+class Test {
+    {
+        if(x) {
+          x();
+        } else if (<caret>) {
+        }
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/EmptyBeforeReturn.java b/java/java-tests/testData/codeInsight/completeStatement/EmptyBeforeReturn.java
new file mode 100644 (file)
index 0000000..57f4cb5
--- /dev/null
@@ -0,0 +1,7 @@
+
+class Foo {
+    public void foo() {
+        <caret>
+        return;
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/EmptyBeforeReturn_after.java b/java/java-tests/testData/codeInsight/completeStatement/EmptyBeforeReturn_after.java
new file mode 100644 (file)
index 0000000..c63b384
--- /dev/null
@@ -0,0 +1,8 @@
+
+class Foo {
+    public void foo() {
+        
+        <caret>
+        return;
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/EmptyLine.java b/java/java-tests/testData/codeInsight/completeStatement/EmptyLine.java
new file mode 100644 (file)
index 0000000..cbfabb6
--- /dev/null
@@ -0,0 +1,6 @@
+
+public class Foo {
+    {
+        <caret>
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/EmptyLine_after.java b/java/java-tests/testData/codeInsight/completeStatement/EmptyLine_after.java
new file mode 100644 (file)
index 0000000..859f728
--- /dev/null
@@ -0,0 +1,7 @@
+
+public class Foo {
+    {
+        
+        <caret>
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/ErrorNavigation.java b/java/java-tests/testData/codeInsight/completeStatement/ErrorNavigation.java
new file mode 100644 (file)
index 0000000..62d6f40
--- /dev/null
@@ -0,0 +1,8 @@
+
+class foo {
+    {
+        if (a) {
+            do<caret>
+        }
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/ErrorNavigation_after.java b/java/java-tests/testData/codeInsight/completeStatement/ErrorNavigation_after.java
new file mode 100644 (file)
index 0000000..6275434
--- /dev/null
@@ -0,0 +1,9 @@
+
+class foo {
+    {
+        if (a) {
+            do {
+            } while (<caret>);
+        }
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/Field.java b/java/java-tests/testData/codeInsight/completeStatement/Field.java
new file mode 100644 (file)
index 0000000..7e6390c
--- /dev/null
@@ -0,0 +1,3 @@
+public class Test {
+    String s<caret>
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/FieldWithInitializer.java b/java/java-tests/testData/codeInsight/completeStatement/FieldWithInitializer.java
new file mode 100644 (file)
index 0000000..12d2819
--- /dev/null
@@ -0,0 +1,3 @@
+public class Test {
+    String s =<caret>
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/FieldWithInitializer_after.java b/java/java-tests/testData/codeInsight/completeStatement/FieldWithInitializer_after.java
new file mode 100644 (file)
index 0000000..eb062b5
--- /dev/null
@@ -0,0 +1,3 @@
+public class Test {
+    String s = <caret>;
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/Field_after.java b/java/java-tests/testData/codeInsight/completeStatement/Field_after.java
new file mode 100644 (file)
index 0000000..9d11574
--- /dev/null
@@ -0,0 +1,3 @@
+public class Test {
+    String s;<caret>
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/FollowedByComment.java b/java/java-tests/testData/codeInsight/completeStatement/FollowedByComment.java
new file mode 100644 (file)
index 0000000..6a7de20
--- /dev/null
@@ -0,0 +1,6 @@
+public class Foo {
+   public void foo() {
+       foo(<caret>
+       // some line comment
+   }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/FollowedByComment_after.java b/java/java-tests/testData/codeInsight/completeStatement/FollowedByComment_after.java
new file mode 100644 (file)
index 0000000..209898f
--- /dev/null
@@ -0,0 +1,6 @@
+public class Foo {
+   public void foo() {
+       foo();<caret>
+       // some line comment
+   }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/For.java b/java/java-tests/testData/codeInsight/completeStatement/For.java
new file mode 100644 (file)
index 0000000..f6d6b2d
--- /dev/null
@@ -0,0 +1,7 @@
+
+class Foo {
+    {
+        for (int<caret> i = 0; i < 100; i++) {
+        }
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/ForBlock.java b/java/java-tests/testData/codeInsight/completeStatement/ForBlock.java
new file mode 100644 (file)
index 0000000..9644a75
--- /dev/null
@@ -0,0 +1,6 @@
+
+class Foo {
+    {
+        for (int<caret> i = 0; i < 100; i++)
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/ForBlock_after.java b/java/java-tests/testData/codeInsight/completeStatement/ForBlock_after.java
new file mode 100644 (file)
index 0000000..3761fa2
--- /dev/null
@@ -0,0 +1,8 @@
+
+class Foo {
+    {
+        for (int i = 0; i < 100; i++) {
+            <caret>
+        }
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/ForEach.java b/java/java-tests/testData/codeInsight/completeStatement/ForEach.java
new file mode 100644 (file)
index 0000000..fd6745a
--- /dev/null
@@ -0,0 +1,6 @@
+class Foo {
+    {
+        List list;
+        for (String s:list<caret>)
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/ForEach_after.java b/java/java-tests/testData/codeInsight/completeStatement/ForEach_after.java
new file mode 100644 (file)
index 0000000..7c9a7e7
--- /dev/null
@@ -0,0 +1,8 @@
+class Foo {
+    {
+        List list;
+        for (String s : list) {
+            <caret>
+        }
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/ForIncrementExpressionAndBody.java b/java/java-tests/testData/codeInsight/completeStatement/ForIncrementExpressionAndBody.java
new file mode 100644 (file)
index 0000000..b2a81c7
--- /dev/null
@@ -0,0 +1,6 @@
+
+class foo {
+    {
+        for (int i = 0; i < 5; s.toString(<caret>
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/ForIncrementExpressionAndBody_after.java b/java/java-tests/testData/codeInsight/completeStatement/ForIncrementExpressionAndBody_after.java
new file mode 100644 (file)
index 0000000..7c4d774
--- /dev/null
@@ -0,0 +1,8 @@
+
+class foo {
+    {
+        for (int i = 0; i < 5; s.toString()) {
+            <caret>
+        }
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/For_after.java b/java/java-tests/testData/codeInsight/completeStatement/For_after.java
new file mode 100644 (file)
index 0000000..3761fa2
--- /dev/null
@@ -0,0 +1,8 @@
+
+class Foo {
+    {
+        for (int i = 0; i < 100; i++) {
+            <caret>
+        }
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/ForceBlock.java b/java/java-tests/testData/codeInsight/completeStatement/ForceBlock.java
new file mode 100644 (file)
index 0000000..4387335
--- /dev/null
@@ -0,0 +1,9 @@
+
+public class Foo {
+    {
+        int a;
+        a = 1;
+        if (a == 1<caret>)
+        a = 2;
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/ForceBlock_after.java b/java/java-tests/testData/codeInsight/completeStatement/ForceBlock_after.java
new file mode 100644 (file)
index 0000000..f9403d3
--- /dev/null
@@ -0,0 +1,11 @@
+
+public class Foo {
+    {
+        int a;
+        a = 1;
+        if (a == 1) {
+            <caret>
+        }
+        a = 2;
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/IDEA22125.java b/java/java-tests/testData/codeInsight/completeStatement/IDEA22125.java
new file mode 100644 (file)
index 0000000..07cfd38
--- /dev/null
@@ -0,0 +1,6 @@
+
+public class Junk {
+    public static void main(String[] args) {
+        int i <caret>= 1 // comment
+    }
+}
diff --git a/java/java-tests/testData/codeInsight/completeStatement/IDEA22125_after.java b/java/java-tests/testData/codeInsight/completeStatement/IDEA22125_after.java
new file mode 100644 (file)
index 0000000..61fca24
--- /dev/null
@@ -0,0 +1,6 @@
+
+public class Junk {
+    public static void main(String[] args) {
+        int i = 1; // comment<caret>
+    }
+}
diff --git a/java/java-tests/testData/codeInsight/completeStatement/IDEA22385.java b/java/java-tests/testData/codeInsight/completeStatement/IDEA22385.java
new file mode 100644 (file)
index 0000000..5905122
--- /dev/null
@@ -0,0 +1,6 @@
+import static java.ut<caret>il.*
+
+public class Junk {
+    public static void main(String[] args) {
+    }
+}
diff --git a/java/java-tests/testData/codeInsight/completeStatement/IDEA22385_after.java b/java/java-tests/testData/codeInsight/completeStatement/IDEA22385_after.java
new file mode 100644 (file)
index 0000000..d0d446b
--- /dev/null
@@ -0,0 +1,6 @@
+import static java.util.*;<caret>
+
+public class Junk {
+    public static void main(String[] args) {
+    }
+}
diff --git a/java/java-tests/testData/codeInsight/completeStatement/IDEADEV1093.java b/java/java-tests/testData/codeInsight/completeStatement/IDEADEV1093.java
new file mode 100644 (file)
index 0000000..df7ef88
--- /dev/null
@@ -0,0 +1,6 @@
+class Foo {
+    public static void foo(int x<caret>) {
+    public static void bar(int x, int y) {
+        System.out.println();
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/IDEADEV1093_after.java b/java/java-tests/testData/codeInsight/completeStatement/IDEADEV1093_after.java
new file mode 100644 (file)
index 0000000..f4dae50
--- /dev/null
@@ -0,0 +1,8 @@
+class Foo {
+    public static void foo(int x) {
+        <caret>
+    }
+    public static void bar(int x, int y) {
+        System.out.println();
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/IDEADEV13019.java b/java/java-tests/testData/codeInsight/completeStatement/IDEADEV13019.java
new file mode 100644 (file)
index 0000000..256e613
--- /dev/null
@@ -0,0 +1,5 @@
+
+class T
+{
+    public static void main(String[] args)<caret>
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/IDEADEV13019_after.java b/java/java-tests/testData/codeInsight/completeStatement/IDEADEV13019_after.java
new file mode 100644 (file)
index 0000000..fd8d909
--- /dev/null
@@ -0,0 +1,8 @@
+
+class T
+{
+    public static void main(String[] args)
+    {
+        <caret>
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/IDEADEV1710.java b/java/java-tests/testData/codeInsight/completeStatement/IDEADEV1710.java
new file mode 100644 (file)
index 0000000..3ca6f16
--- /dev/null
@@ -0,0 +1,3 @@
+public class Foo {
+    public void foo() throws Exception <caret>
+}
diff --git a/java/java-tests/testData/codeInsight/completeStatement/IDEADEV1710_after.java b/java/java-tests/testData/codeInsight/completeStatement/IDEADEV1710_after.java
new file mode 100644 (file)
index 0000000..6cbea9a
--- /dev/null
@@ -0,0 +1,5 @@
+public class Foo {
+    public void foo() throws Exception {
+        <caret>
+    }
+}
diff --git a/java/java-tests/testData/codeInsight/completeStatement/IDEADEV20713.java b/java/java-tests/testData/codeInsight/completeStatement/IDEADEV20713.java
new file mode 100644 (file)
index 0000000..de38a64
--- /dev/null
@@ -0,0 +1,8 @@
+
+class T {
+    void test(Object a) {
+        if (true) <caret>
+        if (a != null)
+            System.out.println("a = " + a.toString());
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/IDEADEV20713_after.java b/java/java-tests/testData/codeInsight/completeStatement/IDEADEV20713_after.java
new file mode 100644 (file)
index 0000000..b3699dd
--- /dev/null
@@ -0,0 +1,10 @@
+
+class T {
+    void test(Object a) {
+        if (true) {
+            <caret>
+        }
+        if (a != null)
+            System.out.println("a = " + a.toString());
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/IDEADEV40479.java b/java/java-tests/testData/codeInsight/completeStatement/IDEADEV40479.java
new file mode 100644 (file)
index 0000000..dda24cd
--- /dev/null
@@ -0,0 +1,6 @@
+
+public class Junk {
+    public static void main(String[] args) {
+        int[] arr = new int[]{1,2,3}<caret>
+    }
+}
diff --git a/java/java-tests/testData/codeInsight/completeStatement/IDEADEV40479_after.java b/java/java-tests/testData/codeInsight/completeStatement/IDEADEV40479_after.java
new file mode 100644 (file)
index 0000000..c61c4ca
--- /dev/null
@@ -0,0 +1,6 @@
+
+public class Junk {
+    public static void main(String[] args) {
+        int[] arr = new int[]{1, 2, 3};<caret>
+    }
+}
diff --git a/java/java-tests/testData/codeInsight/completeStatement/IDEADEV434.java b/java/java-tests/testData/codeInsight/completeStatement/IDEADEV434.java
new file mode 100644 (file)
index 0000000..976b0ae
--- /dev/null
@@ -0,0 +1,6 @@
+class Foo {
+    {
+        if (true) <caret>
+        System.out.println();
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/IDEADEV434_after.java b/java/java-tests/testData/codeInsight/completeStatement/IDEADEV434_after.java
new file mode 100644 (file)
index 0000000..519d2df
--- /dev/null
@@ -0,0 +1,8 @@
+class Foo {
+    {
+        if (true) {
+            <caret>
+        }
+        System.out.println();
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/If.java b/java/java-tests/testData/codeInsight/completeStatement/If.java
new file mode 100644 (file)
index 0000000..5b272e1
--- /dev/null
@@ -0,0 +1,7 @@
+public class Foo {
+    {
+        if<caret> (x)
+        {
+        }
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/If_after.java b/java/java-tests/testData/codeInsight/completeStatement/If_after.java
new file mode 100644 (file)
index 0000000..b601e26
--- /dev/null
@@ -0,0 +1,7 @@
+public class Foo {
+    {
+        if (x) {
+            <caret>
+        }
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/InComment.java b/java/java-tests/testData/codeInsight/completeStatement/InComment.java
new file mode 100644 (file)
index 0000000..f1a576f
--- /dev/null
@@ -0,0 +1,6 @@
+
+public class Test {
+    /**<caret>
+    public void foo() {
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/InComment2.java b/java/java-tests/testData/codeInsight/completeStatement/InComment2.java
new file mode 100644 (file)
index 0000000..48246d3
--- /dev/null
@@ -0,0 +1,8 @@
+
+public class Test {
+    /**
+     * abcd<caret>efgh
+     */
+    public void foo() {
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/InComment2_after.java b/java/java-tests/testData/codeInsight/completeStatement/InComment2_after.java
new file mode 100644 (file)
index 0000000..e04aeae
--- /dev/null
@@ -0,0 +1,9 @@
+
+public class Test {
+    /**
+     * abcdefgh
+     * <caret>
+     */
+    public void foo() {
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/InComment3.java b/java/java-tests/testData/codeInsight/completeStatement/InComment3.java
new file mode 100644 (file)
index 0000000..5902e28
--- /dev/null
@@ -0,0 +1,6 @@
+
+public class Test {
+    public void foo() {
+        // Some <caret> comment
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/InComment3_after.java b/java/java-tests/testData/codeInsight/completeStatement/InComment3_after.java
new file mode 100644 (file)
index 0000000..7b662e1
--- /dev/null
@@ -0,0 +1,7 @@
+
+public class Test {
+    public void foo() {
+        // Some  comment
+        // <caret>
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/InComment4.java b/java/java-tests/testData/codeInsight/completeStatement/InComment4.java
new file mode 100644 (file)
index 0000000..07f8bbe
--- /dev/null
@@ -0,0 +1,7 @@
+
+public class Test {
+    public void foo() {
+        /*<caret>
+        System.out.println("foo");
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/InComment4_after.java b/java/java-tests/testData/codeInsight/completeStatement/InComment4_after.java
new file mode 100644 (file)
index 0000000..a9f5247
--- /dev/null
@@ -0,0 +1,9 @@
+
+public class Test {
+    public void foo() {
+        /*
+        <caret>
+         */
+        System.out.println("foo");
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/InComment_after.java b/java/java-tests/testData/codeInsight/completeStatement/InComment_after.java
new file mode 100644 (file)
index 0000000..307d206
--- /dev/null
@@ -0,0 +1,8 @@
+
+public class Test {
+    /**
+     * <caret>
+     */
+    public void foo() {
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/InPreceedingBlanks.java b/java/java-tests/testData/codeInsight/completeStatement/InPreceedingBlanks.java
new file mode 100644 (file)
index 0000000..372c5c9
--- /dev/null
@@ -0,0 +1,6 @@
+public class Test {
+    {
+        x = 2;
+    <caret>    foo();
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/InPreceedingBlanks_after.java b/java/java-tests/testData/codeInsight/completeStatement/InPreceedingBlanks_after.java
new file mode 100644 (file)
index 0000000..fde9a34
--- /dev/null
@@ -0,0 +1,7 @@
+public class Test {
+    {
+        x = 2;
+        <caret>
+        foo();
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/IncompleteCall.java b/java/java-tests/testData/codeInsight/completeStatement/IncompleteCall.java
new file mode 100644 (file)
index 0000000..57b03ac
--- /dev/null
@@ -0,0 +1,7 @@
+
+public class Foo {
+    {
+        foo<caret>(
+        foo();
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/IncompleteCall_after.java b/java/java-tests/testData/codeInsight/completeStatement/IncompleteCall_after.java
new file mode 100644 (file)
index 0000000..608de1e
--- /dev/null
@@ -0,0 +1,7 @@
+
+public class Foo {
+    {
+        foo();<caret>
+        foo();
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/IncompleteElseIf.java b/java/java-tests/testData/codeInsight/completeStatement/IncompleteElseIf.java
new file mode 100644 (file)
index 0000000..127d3ed
--- /dev/null
@@ -0,0 +1,8 @@
+class Foo {
+    boolean a;
+    {
+        if (a) {
+        } el<caret>se
+        a = 2;
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/IncompleteElseIf_after.java b/java/java-tests/testData/codeInsight/completeStatement/IncompleteElseIf_after.java
new file mode 100644 (file)
index 0000000..eb64785
--- /dev/null
@@ -0,0 +1,11 @@
+class Foo {
+    boolean a;
+
+    {
+        if (a) {
+        } else {
+            <caret>
+        }
+        a = 2;
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/Indentation.java b/java/java-tests/testData/codeInsight/completeStatement/Indentation.java
new file mode 100644 (file)
index 0000000..de56ed5
--- /dev/null
@@ -0,0 +1,8 @@
+
+class foo {
+    {
+        if (a) {
+            if(a<caret>
+        }
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/Indentation_after.java b/java/java-tests/testData/codeInsight/completeStatement/Indentation_after.java
new file mode 100644 (file)
index 0000000..511ed3d
--- /dev/null
@@ -0,0 +1,10 @@
+
+class foo {
+    {
+        if (a) {
+            if (a) {
+                <caret>
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/InterfaceMethodSemicolon.java b/java/java-tests/testData/codeInsight/completeStatement/InterfaceMethodSemicolon.java
new file mode 100644 (file)
index 0000000..987ec95
--- /dev/null
@@ -0,0 +1,4 @@
+interface InterfaceMethodSemicolon {
+    void foo(String s)<caret>
+    Object bar();
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/InterfaceMethodSemicolon_after.java b/java/java-tests/testData/codeInsight/completeStatement/InterfaceMethodSemicolon_after.java
new file mode 100644 (file)
index 0000000..ed67b8d
--- /dev/null
@@ -0,0 +1,4 @@
+interface InterfaceMethodSemicolon {
+    void foo(String s);<caret>
+    Object bar();
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/Method.java b/java/java-tests/testData/codeInsight/completeStatement/Method.java
new file mode 100644 (file)
index 0000000..c8eadab
--- /dev/null
@@ -0,0 +1,3 @@
+public class Test {
+   void foo(<caret>
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/Method_after.java b/java/java-tests/testData/codeInsight/completeStatement/Method_after.java
new file mode 100644 (file)
index 0000000..d1ce394
--- /dev/null
@@ -0,0 +1,5 @@
+public class Test {
+    void foo() {
+        <caret>
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/NewInParentheses.java b/java/java-tests/testData/codeInsight/completeStatement/NewInParentheses.java
new file mode 100644 (file)
index 0000000..7483ed6
--- /dev/null
@@ -0,0 +1,6 @@
+
+class foo {
+    {
+        Object d = ( ( String ) new String()<caret>
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/NewInParentheses_after.java b/java/java-tests/testData/codeInsight/completeStatement/NewInParentheses_after.java
new file mode 100644 (file)
index 0000000..0bdd9c0
--- /dev/null
@@ -0,0 +1,6 @@
+
+class foo {
+    {
+        Object d = ((String) new String());<caret>
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/NoBlockReturn.java b/java/java-tests/testData/codeInsight/completeStatement/NoBlockReturn.java
new file mode 100644 (file)
index 0000000..fecc7a7
--- /dev/null
@@ -0,0 +1,5 @@
+public class Test {
+    public void foo() {
+        if (i) return<caret>;
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/NoBlockReturn_after.java b/java/java-tests/testData/codeInsight/completeStatement/NoBlockReturn_after.java
new file mode 100644 (file)
index 0000000..05e0c34
--- /dev/null
@@ -0,0 +1,6 @@
+public class Test {
+    public void foo() {
+        if (i) return;
+        <caret>
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/NoErrors.java b/java/java-tests/testData/codeInsight/completeStatement/NoErrors.java
new file mode 100644 (file)
index 0000000..413189a
--- /dev/null
@@ -0,0 +1,6 @@
+
+public class Test {
+    public void foo() {
+        int x <caret>= 2;
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/NoErrors_after.java b/java/java-tests/testData/codeInsight/completeStatement/NoErrors_after.java
new file mode 100644 (file)
index 0000000..43dc309
--- /dev/null
@@ -0,0 +1,7 @@
+
+public class Test {
+    public void foo() {
+        int x = 2;
+        <caret>
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/NonAbstractMethodWithSemicolon.java b/java/java-tests/testData/codeInsight/completeStatement/NonAbstractMethodWithSemicolon.java
new file mode 100644 (file)
index 0000000..9d0e938
--- /dev/null
@@ -0,0 +1,4 @@
+
+public class Foo {
+   void <caret>foo();
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/NonAbstractMethodWithSemicolon_after.java b/java/java-tests/testData/codeInsight/completeStatement/NonAbstractMethodWithSemicolon_after.java
new file mode 100644 (file)
index 0000000..b9845cd
--- /dev/null
@@ -0,0 +1,6 @@
+
+public class Foo {
+    void foo() {
+        <caret>
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/Parenthesized.java b/java/java-tests/testData/codeInsight/completeStatement/Parenthesized.java
new file mode 100644 (file)
index 0000000..68c3c77
--- /dev/null
@@ -0,0 +1,6 @@
+
+class Foo {
+    {
+        tx2 = (long) (vcx + vw<caret>
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/Parenthesized_after.java b/java/java-tests/testData/codeInsight/completeStatement/Parenthesized_after.java
new file mode 100644 (file)
index 0000000..cecc090
--- /dev/null
@@ -0,0 +1,6 @@
+
+class Foo {
+    {
+        tx2 = (long) (vcx + vw);<caret>
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/Return.java b/java/java-tests/testData/codeInsight/completeStatement/Return.java
new file mode 100644 (file)
index 0000000..89d1b52
--- /dev/null
@@ -0,0 +1,7 @@
+public class Test {
+    public void foo() {
+        if(x) {
+            return;<caret>
+        }
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/ReturnFromNonVoid.java b/java/java-tests/testData/codeInsight/completeStatement/ReturnFromNonVoid.java
new file mode 100644 (file)
index 0000000..d7e2567
--- /dev/null
@@ -0,0 +1,6 @@
+
+public class Foo {
+    public int foo() {
+      return<caret>
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/ReturnFromNonVoid_after.java b/java/java-tests/testData/codeInsight/completeStatement/ReturnFromNonVoid_after.java
new file mode 100644 (file)
index 0000000..cbdb9b8
--- /dev/null
@@ -0,0 +1,6 @@
+
+public class Foo {
+    public int foo() {
+        return<caret>;
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/ReturnFromVoid.java b/java/java-tests/testData/codeInsight/completeStatement/ReturnFromVoid.java
new file mode 100644 (file)
index 0000000..97a1dfb
--- /dev/null
@@ -0,0 +1,7 @@
+
+class Test {
+    void test(Object o) {
+        if (o == null) return<caret>
+        String foo = "foo";
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/ReturnFromVoid_after.java b/java/java-tests/testData/codeInsight/completeStatement/ReturnFromVoid_after.java
new file mode 100644 (file)
index 0000000..b576059
--- /dev/null
@@ -0,0 +1,7 @@
+
+class Test {
+    void test(Object o) {
+        if (o == null) return;<caret>
+        String foo = "foo";
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/Return_after.java b/java/java-tests/testData/codeInsight/completeStatement/Return_after.java
new file mode 100644 (file)
index 0000000..9c07eb9
--- /dev/null
@@ -0,0 +1,8 @@
+public class Test {
+    public void foo() {
+        if(x) {
+            return;
+        }
+        <caret>
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/SCR11147.java b/java/java-tests/testData/codeInsight/completeStatement/SCR11147.java
new file mode 100644 (file)
index 0000000..75020fc
--- /dev/null
@@ -0,0 +1,9 @@
+
+public class Foo {
+    {
+        int x = 0;
+        if (x == 0) {
+            <caret>
+        }
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/SCR11147_after.java b/java/java-tests/testData/codeInsight/completeStatement/SCR11147_after.java
new file mode 100644 (file)
index 0000000..5c42698
--- /dev/null
@@ -0,0 +1,10 @@
+
+public class Foo {
+    {
+        int x = 0;
+        if (x == 0) {
+            
+            <caret>
+        }
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/SCR22904.java b/java/java-tests/testData/codeInsight/completeStatement/SCR22904.java
new file mode 100644 (file)
index 0000000..8c4c47f
--- /dev/null
@@ -0,0 +1,4 @@
+interface Test {
+    void foo(String s)<caret>
+    Object bar();
+}
diff --git a/java/java-tests/testData/codeInsight/completeStatement/SCR22904_after.java b/java/java-tests/testData/codeInsight/completeStatement/SCR22904_after.java
new file mode 100644 (file)
index 0000000..a10695c
--- /dev/null
@@ -0,0 +1,4 @@
+interface Test {
+    void foo(String s);<caret>
+    Object bar();
+}
diff --git a/java/java-tests/testData/codeInsight/completeStatement/SCR30227.java b/java/java-tests/testData/codeInsight/completeStatement/SCR30227.java
new file mode 100644 (file)
index 0000000..5849054
--- /dev/null
@@ -0,0 +1,16 @@
+public abstract class A {
+    abstract void f(boolean b);
+
+    A IMPL = new A() {
+      void f(boolean b) {
+        if (b)
+          f(true);
+        else {
+          f(false);
+          f(false);
+        }        
+        for(int i = 0; i < 5; i++)
+          f(true);
+      }
+    }; <caret>
+}
diff --git a/java/java-tests/testData/codeInsight/completeStatement/SCR30227_after.java b/java/java-tests/testData/codeInsight/completeStatement/SCR30227_after.java
new file mode 100644 (file)
index 0000000..af9f9bb
--- /dev/null
@@ -0,0 +1,16 @@
+public abstract class A {
+    abstract void f(boolean b);
+
+    A IMPL = new A() {
+        void f(boolean b) {
+            if (b)
+                f(true);
+            else {
+                f(false);
+                f(false);
+            }
+            for (int i = 0; i < 5; i++)
+                f(true);
+        }
+    };<caret>
+}
diff --git a/java/java-tests/testData/codeInsight/completeStatement/SCR36110.java b/java/java-tests/testData/codeInsight/completeStatement/SCR36110.java
new file mode 100644 (file)
index 0000000..b70a7ed
--- /dev/null
@@ -0,0 +1,8 @@
+public enum TransactionAttributeType {
+MANDATORY,
+REQUIRED,
+REQUIRESNEW,
+SUPPORTS,
+NOTSUPPORTED,
+NEVE<caret>R
+}
diff --git a/java/java-tests/testData/codeInsight/completeStatement/SCR36110_after.java b/java/java-tests/testData/codeInsight/completeStatement/SCR36110_after.java
new file mode 100644 (file)
index 0000000..dadb291
--- /dev/null
@@ -0,0 +1,8 @@
+public enum TransactionAttributeType {
+MANDATORY,
+REQUIRED,
+REQUIRESNEW,
+SUPPORTS,
+NOTSUPPORTED,
+    NEVER,<caret>
+}
diff --git a/java/java-tests/testData/codeInsight/completeStatement/SCR37331.java b/java/java-tests/testData/codeInsight/completeStatement/SCR37331.java
new file mode 100644 (file)
index 0000000..21fad21
--- /dev/null
@@ -0,0 +1,6 @@
+
+public class Junk {
+    public static void main(String[] args) {
+        String s = (<caret>
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/SCR37331_after.java b/java/java-tests/testData/codeInsight/completeStatement/SCR37331_after.java
new file mode 100644 (file)
index 0000000..2381adb
--- /dev/null
@@ -0,0 +1,6 @@
+
+public class Junk {
+    public static void main(String[] args) {
+        String s = (<caret>);
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/StartNewBlock.java b/java/java-tests/testData/codeInsight/completeStatement/StartNewBlock.java
new file mode 100644 (file)
index 0000000..77469fb
--- /dev/null
@@ -0,0 +1,6 @@
+
+public class Foo {
+    {
+        if (x) {<caret>foo();
+    }
+}
diff --git a/java/java-tests/testData/codeInsight/completeStatement/StartNewBlock_after.java b/java/java-tests/testData/codeInsight/completeStatement/StartNewBlock_after.java
new file mode 100644 (file)
index 0000000..a033317
--- /dev/null
@@ -0,0 +1,8 @@
+
+public class Foo {
+    {
+        if (x) {
+            <caret>foo();
+        }
+    }
+}
diff --git a/java/java-tests/testData/codeInsight/completeStatement/StringLiteral.java b/java/java-tests/testData/codeInsight/completeStatement/StringLiteral.java
new file mode 100644 (file)
index 0000000..5848d3e
--- /dev/null
@@ -0,0 +1,6 @@
+
+class foo {
+    {
+        String s = "a<caret>
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/StringLiteral_after.java b/java/java-tests/testData/codeInsight/completeStatement/StringLiteral_after.java
new file mode 100644 (file)
index 0000000..b76baf5
--- /dev/null
@@ -0,0 +1,6 @@
+
+class foo {
+    {
+        String s = "a";<caret>
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/SwitchKeyword.java b/java/java-tests/testData/codeInsight/completeStatement/SwitchKeyword.java
new file mode 100644 (file)
index 0000000..dbfbef3
--- /dev/null
@@ -0,0 +1,6 @@
+
+class foo {
+    {
+        switch<caret>
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/SwitchKeywordWithCondition.java b/java/java-tests/testData/codeInsight/completeStatement/SwitchKeywordWithCondition.java
new file mode 100644 (file)
index 0000000..3787360
--- /dev/null
@@ -0,0 +1,6 @@
+
+class foo {
+    {
+        switch (i<caret>
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/SwitchKeywordWithCondition_after.java b/java/java-tests/testData/codeInsight/completeStatement/SwitchKeywordWithCondition_after.java
new file mode 100644 (file)
index 0000000..908ab9f
--- /dev/null
@@ -0,0 +1,8 @@
+
+class foo {
+    {
+        switch (i) {
+            <caret>
+        }
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/SwitchKeyword_after.java b/java/java-tests/testData/codeInsight/completeStatement/SwitchKeyword_after.java
new file mode 100644 (file)
index 0000000..01d1cd2
--- /dev/null
@@ -0,0 +1,7 @@
+
+class foo {
+    {
+        switch (<caret>) {
+        }
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/Synchronized.java b/java/java-tests/testData/codeInsight/completeStatement/Synchronized.java
new file mode 100644 (file)
index 0000000..d3fd2ef
--- /dev/null
@@ -0,0 +1,5 @@
+public class Test {
+    public void foo() {
+       synchronized(this<caret>)
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/Synchronized_after.java b/java/java-tests/testData/codeInsight/completeStatement/Synchronized_after.java
new file mode 100644 (file)
index 0000000..bcad9ff
--- /dev/null
@@ -0,0 +1,7 @@
+public class Test {
+    public void foo() {
+        synchronized (this) {
+            <caret>
+        }
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/Throw.java b/java/java-tests/testData/codeInsight/completeStatement/Throw.java
new file mode 100644 (file)
index 0000000..ac0adcf
--- /dev/null
@@ -0,0 +1,7 @@
+public class Test {
+    {
+        if(x) {
+            throw <caret>new Exception();
+        }
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/Throw_after.java b/java/java-tests/testData/codeInsight/completeStatement/Throw_after.java
new file mode 100644 (file)
index 0000000..472fc78
--- /dev/null
@@ -0,0 +1,8 @@
+public class Test {
+    {
+        if(x) {
+            throw new Exception();
+        }
+        <caret>
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/Try1.java b/java/java-tests/testData/codeInsight/completeStatement/Try1.java
new file mode 100644 (file)
index 0000000..1987cf4
--- /dev/null
@@ -0,0 +1,8 @@
+public class Foo {
+    {
+        try {<caret>
+        }
+        catch(Exception e) {
+        }
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/Try1_after.java b/java/java-tests/testData/codeInsight/completeStatement/Try1_after.java
new file mode 100644 (file)
index 0000000..e384452
--- /dev/null
@@ -0,0 +1,9 @@
+public class Foo {
+    {
+        try {
+            <caret>
+        }
+        catch(Exception e) {
+        }
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/TwoStatementsInLine.java b/java/java-tests/testData/codeInsight/completeStatement/TwoStatementsInLine.java
new file mode 100644 (file)
index 0000000..0748ba2
--- /dev/null
@@ -0,0 +1,7 @@
+
+class Foo {
+    {
+        x = 3;
+        x <caret>= 2 y = 4;
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completeStatement/TwoStatementsInLine_after.java b/java/java-tests/testData/codeInsight/completeStatement/TwoStatementsInLine_after.java
new file mode 100644 (file)
index 0000000..66956f1
--- /dev/null
@@ -0,0 +1,7 @@
+
+class Foo {
+    {
+        x = 3;
+        x = 2;<caret> y = 4;
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/CompleteStatementTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/CompleteStatementTest.java
new file mode 100644 (file)
index 0000000..0323fe9
--- /dev/null
@@ -0,0 +1,221 @@
+package com.intellij.codeInsight;
+
+import com.intellij.JavaTestUtil;
+import com.intellij.openapi.actionSystem.IdeActions;
+import com.intellij.openapi.roots.LanguageLevelProjectExtension;
+import com.intellij.pom.java.LanguageLevel;
+import com.intellij.psi.JavaPsiFacade;
+import com.intellij.psi.codeStyle.CodeStyleSettings;
+import com.intellij.psi.codeStyle.CodeStyleSettingsManager;
+import com.intellij.testFramework.EditorActionTestCase;
+import com.intellij.testFramework.TestDataPath;
+
+/**
+ * @author max
+ */
+@TestDataPath("$CONTENT_ROOT/testData")
+public class CompleteStatementTest extends EditorActionTestCase {
+  public void testAddMissingSemicolon() throws Exception { doTest(); }
+
+  public void testAddMissingParen() throws Exception { doTest(); }
+
+  public void testCompleteIf() throws Exception { doTest(); }
+
+  public void testCompleteIfKeyword() throws Exception { doTest(); }
+
+  public void testCompleteIfStatementGoesToThen() throws Exception { doTest(); }
+
+  public void testCompleteIfKeywordStatementGoesToThen() throws Exception { doTest(); }
+
+  public void testIndentation() throws Exception { doTest(); }
+
+  public void testErrorNavigation() throws Exception { doTest(); }
+
+  public void testStringLiteral() throws Exception { doTest(); }
+
+  public void testCompleteCatch() throws Exception { doTest(); }
+  
+  public void testCompleteCatchLParen() throws Exception { doTest(); }
+
+  public void testCompleteCatchWithExpression() throws Exception { doTest(); }
+
+  public void testCompleteCatchBody() throws Exception { doTest(); }
+
+  public void testSCR11147() throws Exception { doTest(); }
+
+  public void testNoErrors() throws Exception { doTest(); }
+
+  public void testThrow() throws Exception { doTest(); }
+
+  public void testReturn() throws Exception { doTest(); }
+
+  public void testEmptyLine() throws Exception { doTest(); }
+
+  public void testBlock() throws Exception { doTest(); }
+
+  public void testTwoStatementsInLine() throws Exception { doTest(); }
+
+  public void testFor() throws Exception { doTest(); }
+
+  public void testForEach() throws Exception { doTest(); }
+
+  public void testForBlock() throws Exception { doTest(); }
+
+  public void testForIncrementExpressionAndBody() throws Exception { doTest(); }
+
+  public void testEmptyBeforeReturn() throws Exception { doTest(); }
+
+  public void testIf() throws Exception { doTest(); }
+
+  public void testBeforeStatement() throws Exception { doTest(); }
+
+  public void testTry1() throws Exception { doTest(); }
+
+  public void testBlock1() throws Exception { doTest(); }
+
+  public void testAfterFor() throws Exception { doTest(); }
+
+  public void testBeforeFor() throws Exception { doTest(); }
+
+  public void testAtBlockEnd() throws Exception { doTest(); }
+
+  public void testForceBlock() throws Exception { doTest(); }
+
+  public void testElseIf() throws Exception { doTest(); }
+
+  public void testIncompleteElseIf() throws Exception { doTest(); }
+
+  public void testField() throws Exception { doTest(); }
+
+  public void testMethod() throws Exception { doTest(); }
+
+  public void testCompleteElseIf() throws Exception { doTest(); }
+
+  public void testCompleteStringLiteral() throws Exception {
+    doTest();
+  }
+
+  public void testNonAbstractMethodWithSemicolon() throws Exception { doTest(); }
+
+  public void testReturnFromNonVoid() throws Exception { doTest(); }
+
+  public void testReturnFromVoid() throws Exception { doTest(); }
+
+  public void testIncompleteCall() throws Exception { doTest(); }
+
+  public void testCompleteCall() throws Exception { doTest(); }
+
+  public void testStartNewBlock() throws Exception { doTest(); }
+
+  public void testInPreceedingBlanks() throws Exception { doTest(); }
+
+  public void testNoBlockReturn() throws Exception { doTest(); }
+
+  public void testInComment() throws Exception { doTest(); }
+
+  public void testInComment2() throws Exception { doTest(); }
+  public void testInComment3() throws Exception { doTest(); }
+  public void testInComment4() throws Exception { doTest(); }
+
+  public void testSCR22904() throws Exception { doTest(); }
+  public void testSCR30227() throws Exception { doTest(); }
+
+  public void testFieldWithInitializer() throws Exception { doTest(); }
+
+  public void testParenthesized() throws Exception { doTest(); }
+
+  public void testCompleteBreak() throws Exception {
+    doTest();
+  }
+
+  public void testCompleteIfNextLineBraceStyle() throws Exception {
+    CodeStyleSettings settings = CodeStyleSettingsManager.getSettings(getProject());
+    settings.BRACE_STYLE = CodeStyleSettings.NEXT_LINE;
+    doTest();
+    settings.BRACE_STYLE = CodeStyleSettings.END_OF_LINE;
+  }
+
+  public void testCompleteIfNextLineBraceStyle2() throws Exception {
+    CodeStyleSettings settings = CodeStyleSettingsManager.getSettings(getProject());
+    settings.BRACE_STYLE = CodeStyleSettings.NEXT_LINE;
+    doTest();
+    settings.BRACE_STYLE = CodeStyleSettings.END_OF_LINE;
+  }
+
+  public void testSCR36110() throws Exception {
+    JavaPsiFacade facade = JavaPsiFacade.getInstance(getProject());
+    LanguageLevel old = LanguageLevelProjectExtension.getInstance(facade.getProject()).getLanguageLevel();
+    LanguageLevelProjectExtension.getInstance(facade.getProject()).setLanguageLevel(LanguageLevel.JDK_1_5);
+    doTest();
+    LanguageLevelProjectExtension.getInstance(facade.getProject()).setLanguageLevel(old);
+  }
+
+  public void testSCR37331() throws Exception { doTest(); }
+  public void testIDEADEV434() throws Exception {
+    CodeStyleSettingsManager.getSettings(getProject()).KEEP_SIMPLE_BLOCKS_IN_ONE_LINE = true;
+    doTest();
+    CodeStyleSettingsManager.getSettings(getProject()).KEEP_SIMPLE_BLOCKS_IN_ONE_LINE = false;
+    doTest();
+  }
+
+  public void testIDEADEV1093() throws Exception { doTest(); }
+
+  public void testIDEADEV1710() throws Exception { doTest(); }
+
+  public void testInterfaceMethodSemicolon() throws Exception { doTest(); }
+
+  public void testSynchronized() throws Exception { doTest(); }
+
+  public void testCdrEndlessLoop() throws Exception { doTest(); }
+
+  public void testFollowedByComment() throws Exception { doTest(); }
+
+  public void testBraceFixeNewLine() throws Exception { doTest(); }
+
+  public void testSwitchKeyword() throws Exception { doTest(); }
+
+  public void testSwitchKeywordWithCondition() throws Exception { doTest(); }
+
+  public void testNewInParentheses() throws Exception { doTest(); }
+  
+  public void testIDEADEV20713() throws Exception { doTest(); }
+
+  public void testIDEA22125() throws Exception { doTest(); }
+  
+  public void testIDEA22385() throws Exception { doTest(); }
+
+  public void testIDEADEV40479() throws Exception { doTest(); }
+
+  public void testIDEADEV13019() throws Exception { 
+    CodeStyleSettings settings = CodeStyleSettingsManager.getSettings(getProject());
+    settings.BRACE_STYLE = CodeStyleSettings.NEXT_LINE;
+    settings.METHOD_BRACE_STYLE = CodeStyleSettings.NEXT_LINE;
+    settings.CLASS_BRACE_STYLE = CodeStyleSettings.NEXT_LINE;
+    try {
+      doTest();
+    }
+    finally {
+      settings.BRACE_STYLE = CodeStyleSettings.END_OF_LINE;
+      settings.METHOD_BRACE_STYLE = CodeStyleSettings.END_OF_LINE;
+      settings.CLASS_BRACE_STYLE = CodeStyleSettings.END_OF_LINE;
+    }
+  }
+
+  private void doTest() throws Exception {
+    doTest("java");
+  }
+
+  private void doTest(String ext) throws Exception {
+    String path = "/codeInsight/completeStatement/";
+    doFileTest(path + getTestName(false) + "." + ext, path + getTestName(false) + "_after." + ext, true);
+  }
+
+  protected String getActionId() {
+    return IdeActions.ACTION_EDITOR_COMPLETE_STATEMENT;
+  }
+
+  @Override
+  protected String getTestDataPath() {
+    return JavaTestUtil.getJavaTestDataPath();
+  }
+}
index c88a10e44616f357e7849ab1875194accc027b03..89dac789b5e94f03accbc7e0380a3f7a9cf19e45 100644 (file)
@@ -11,9 +11,11 @@ import com.intellij.openapi.module.ModuleManager;
 import com.intellij.openapi.projectRoots.Sdk;
 import com.intellij.openapi.projectRoots.impl.JavaSdkImpl;
 import com.intellij.testFramework.PsiTestUtil;
+import com.intellij.testFramework.TestDataPath;
 
 import java.io.File;
 
+@TestDataPath("$CONTENT_ROOT/testData")
 public class ClassNameCompletionTest extends CompletionTestCase {
   private static final String BASE_PATH = "/codeInsight/completion/className/";
   protected boolean myOldSetting;
@@ -125,7 +127,7 @@ public class ClassNameCompletionTest extends CompletionTestCase {
     configureByFile(path + "/implements2-source.java");
     performAction();
     checkResultByFile(path + "/implements2-result.java");
-    
+
     configureByFile(path + "/implements3-source.java");
     performAction();
     checkResultByFile(path + "/implements3-result.java");
@@ -144,7 +146,7 @@ public class ClassNameCompletionTest extends CompletionTestCase {
     configureByFile(path + "/test8-source.java");
     performAction();
     checkResultByFile(path + "/test8-result.java");
-    
+
     configureByFile(path + "/test9-source.java");
     performAction();
     checkResultByFile(path + "/test9-result.java");
@@ -187,7 +189,7 @@ public class ClassNameCompletionTest extends CompletionTestCase {
     performAction();
     checkResultByFile(path + "/methodCall1-result.java");
   }
-  
+
   public void testInVariableDeclarationType() throws Throwable {
     final String path = BASE_PATH + "/nameCompletion/java";
     configureByFile(path + "/varType-source.java");
index 4d7ae04269db7ee469ed1e5beedea9eca691de8e..e3edc69a9acef634f5e49359ac1f5179cff3286e 100644 (file)
@@ -10,6 +10,7 @@ import com.intellij.codeInsight.lookup.LookupManager;
 import com.intellij.codeInsight.lookup.impl.LookupImpl;
 import com.intellij.openapi.projectRoots.Sdk;
 import com.intellij.openapi.projectRoots.impl.JavaSdkImpl;
+import com.intellij.testFramework.TestDataPath;
 
 import javax.swing.*;
 import java.util.ArrayList;
@@ -19,6 +20,7 @@ import java.util.List;
 /**
  * @author peter
  */
+@TestDataPath("$CONTENT_ROOT/testData")
 public abstract class CompletionSortingTestCase extends LightCompletionTestCase {
   @SuppressWarnings({"JUnitTestCaseWithNonTrivialConstructors"})
   protected CompletionSortingTestCase(CompletionType type) {
index bfff24fee7d2a1c27e189df6bdad54c3efbcbd17..f8862f4417a35877b67eff8be013c6ebcf5c95f3 100644 (file)
@@ -10,6 +10,7 @@ import com.intellij.psi.codeStyle.CodeStyleSettingsManager;
 import com.intellij.psi.statistics.StatisticsManager;
 import com.intellij.psi.statistics.impl.StatisticsManagerImpl;
 import com.intellij.testFramework.LightCodeInsightTestCase;
+import com.intellij.testFramework.TestDataPath;
 
 /**
  * Created by IntelliJ IDEA.
@@ -18,6 +19,7 @@ import com.intellij.testFramework.LightCodeInsightTestCase;
  * Time: 15:44:18
  * To change this template use Options | File Templates.
  */
+@TestDataPath("$CONTENT_ROOT/testData")
 public class CompletionStyleTest extends LightCodeInsightTestCase{
   private static final String BASE_PATH = "/codeInsight/completion/style";
 
index 27b7d2147419cb8d45748a79e2cf8b96a1d9c3ba..4debc262c8840528463e4dda3e52415a8e4eea39 100644 (file)
  */
 package com.intellij.psi;
 
+import org.jetbrains.annotations.NotNull;
+
 public abstract class JavaRecursiveElementWalkingVisitor extends JavaElementVisitor {
   private final PsiWalkingState myWalkingState = new PsiWalkingState(this){
-    public void elementFinished(PsiElement element) {
+    public void elementFinished(@NotNull PsiElement element) {
       JavaRecursiveElementWalkingVisitor.this.elementFinished(element);
     }
   };
index 17d28446730fdacf68ef2ad3dc7f6a6d5e7cdf9d..8df03c6b609e806522dc924d22c5129cadd90dab 100644 (file)
@@ -16,6 +16,7 @@
 package com.intellij.psi;
 
 import com.intellij.openapi.progress.ProgressManager;
+import org.jetbrains.annotations.NotNull;
 
 import java.util.List;
 
@@ -26,7 +27,7 @@ import java.util.List;
 public abstract class PsiRecursiveElementWalkingVisitor extends PsiElementVisitor  {
   private final boolean myVisitAllFileRoots;
   private final PsiWalkingState myWalkingState = new PsiWalkingState(this){
-    public void elementFinished(PsiElement element) {
+    public void elementFinished(@NotNull PsiElement element) {
       PsiRecursiveElementWalkingVisitor.this.elementFinished(element);
     }
   };
index 091c65f8a198099b9e12ee877289388d68a58942..cafc4e254c8a4e5fd37a58d1a74b0b19783280c9 100644 (file)
@@ -17,6 +17,7 @@
 package com.intellij.psi;
 
 import com.intellij.openapi.diagnostic.Logger;
+import org.jetbrains.annotations.NotNull;
 
 /**
  * @author cdr
@@ -26,19 +27,19 @@ public abstract class PsiWalkingState extends WalkingState<PsiElement> {
   private final PsiElementVisitor myVisitor;
 
   private static class PsiTreeGuide implements TreeGuide<PsiElement> {
-    public PsiElement getNextSibling(PsiElement element) {
+    public PsiElement getNextSibling(@NotNull PsiElement element) {
       return element.getNextSibling();
     }
 
-    public PsiElement getPrevSibling(PsiElement element) {
+    public PsiElement getPrevSibling(@NotNull PsiElement element) {
       return element.getPrevSibling();
     }
 
-    public PsiElement getFirstChild(PsiElement element) {
+    public PsiElement getFirstChild(@NotNull PsiElement element) {
       return element.getFirstChild();
     }
 
-    public PsiElement getParent(PsiElement element) {
+    public PsiElement getParent(@NotNull PsiElement element) {
       return element.getParent();
     }
 
@@ -51,12 +52,12 @@ public abstract class PsiWalkingState extends WalkingState<PsiElement> {
   }
 
   @Override
-  public void visit(PsiElement element) {
+  public void visit(@NotNull PsiElement element) {
     element.accept(myVisitor);
   }
 
   @Override
-  public void elementStarted(PsiElement element) {
+  public void elementStarted(@NotNull PsiElement element) {
     if (!startedWalking && element instanceof PsiCompiledElement) {
       // do not walk inside compiled PSI since getNextSibling() is too slow there
       LOG.error(element+"; Do not use walking visitor inside compiled PSI since getNextSibling() is too slow there");
index 011521c4dd4b4861ce14617041b1ebdd2cc534b3..a3dc83c42fd42e5b5986ce7cfbc3f4e10a37c30c 100644 (file)
 
 package com.intellij.psi;
 
+import org.jetbrains.annotations.NotNull;
+
 /**
  * @author cdr
  */
 public abstract class WalkingState<T> {
   public interface TreeGuide<T> {
-    T getNextSibling(T element);
-    T getPrevSibling(T element);
-    T getFirstChild(T element);
-    T getParent(T element);
+    T getNextSibling(@NotNull T element);
+    T getPrevSibling(@NotNull T element);
+    T getFirstChild(@NotNull T element);
+    T getParent(@NotNull T element);
   }
   private boolean isDown;
   protected boolean startedWalking;
   private final TreeGuide<T> myWalker;
   private boolean stopped;
 
-  public abstract void elementFinished(T element);
+  public abstract void elementFinished(@NotNull T element);
 
-  protected WalkingState(TreeGuide<T> delegate) {
+  protected WalkingState(@NotNull TreeGuide<T> delegate) {
     myWalker = delegate;
   }
 
-  public void visit(T element) {
+  public void visit(@NotNull T element) {
     elementStarted(element);
   }
 
-  public void elementStarted(T element){
+  public void elementStarted(@NotNull T element){
     isDown = true;
     if (!startedWalking) {
       stopped = false;
index 6bc16aca7e3086497a49efc2e45d45f767925ba9..fd74d5886304dd3f76cdd499bb9293df384f8a90 100644 (file)
@@ -144,12 +144,15 @@ public class BaseAnalysisActionDialog extends DialogWrapper {
     boolean searchInLib = file != null && (fileIndex.isInLibraryClasses(file) || fileIndex.isInLibrarySource(file));
 
 
-    String preselect = !StringUtil.isEmptyOrSpaces(myAnalysisOptions.CUSTOM_SCOPE_NAME)
-                       ? myAnalysisOptions.CUSTOM_SCOPE_NAME
-                       : FindSettings.getInstance().getDefaultScopeName();
+    String preselect = StringUtil.isEmptyOrSpaces(myAnalysisOptions.CUSTOM_SCOPE_NAME)
+                       ? FindSettings.getInstance().getDefaultScopeName()
+                       : myAnalysisOptions.CUSTOM_SCOPE_NAME;
     if (searchInLib && GlobalSearchScope.projectScope(myProject).getDisplayName().equals(preselect)) {
+      preselect = GlobalSearchScope.allScope(myProject).getDisplayName();
+    }
+    if (GlobalSearchScope.allScope(myProject).getDisplayName().equals(preselect)) {
       myAnalysisOptions.SCOPE_TYPE = AnalysisScope.CUSTOM;
-      myAnalysisOptions.CUSTOM_SCOPE_NAME = preselect = GlobalSearchScope.allScope(myProject).getDisplayName();
+      myAnalysisOptions.CUSTOM_SCOPE_NAME = preselect;
     }
 
     //custom scope
index 0b695c244f93d6f7f078a5b542f2bfb43d1284f9..7472f823fdc4552af160191b092fab70dbffb6e4 100644 (file)
@@ -35,7 +35,7 @@ import org.jetbrains.annotations.Nullable;
 public class LineMarkersPassFactory extends AbstractProjectComponent implements TextEditorHighlightingPassFactory {
   public LineMarkersPassFactory(Project project, TextEditorHighlightingPassRegistrar highlightingPassRegistrar) {
     super(project);
-    highlightingPassRegistrar.registerTextEditorHighlightingPass(this, null, new int[]{Pass.UPDATE_ALL}, false, Pass.LINE_MARKERS);
+    highlightingPassRegistrar.registerTextEditorHighlightingPass(this, new int[]{Pass.VISIBLE_LINE_MARKERS}, new int[]{Pass.UPDATE_ALL}, false, Pass.LINE_MARKERS);
   }
 
   @NonNls
index f8858df9fc4941cf32c2202407ac6306485c363e..c69f77318e8c3993ea7b807be16bf293c6d90642 100644 (file)
@@ -18,6 +18,7 @@ package com.intellij.psi.impl.source.tree;
 
 import com.intellij.lang.ASTNode;
 import com.intellij.psi.WalkingState;
+import org.jetbrains.annotations.NotNull;
 
 public abstract class RecursiveTreeElementWalkingVisitor extends TreeElementVisitor{
   private final boolean myDoTransform;
@@ -31,19 +32,19 @@ public abstract class RecursiveTreeElementWalkingVisitor extends TreeElementVisi
   }
 
   private static class ASTTreeGuide implements WalkingState.TreeGuide<ASTNode> {
-    public ASTNode getNextSibling(ASTNode element) {
+    public ASTNode getNextSibling(@NotNull ASTNode element) {
       return element.getTreeNext();
     }
 
-    public ASTNode getPrevSibling(ASTNode element) {
+    public ASTNode getPrevSibling(@NotNull ASTNode element) {
       return element.getTreePrev();
     }
 
-    public ASTNode getFirstChild(ASTNode element) {
+    public ASTNode getFirstChild(@NotNull ASTNode element) {
       return element.getFirstChildNode();
     }
 
-    public ASTNode getParent(ASTNode element) {
+    public ASTNode getParent(@NotNull ASTNode element) {
       return element.getTreeParent();
     }
 
@@ -52,12 +53,12 @@ public abstract class RecursiveTreeElementWalkingVisitor extends TreeElementVisi
 
   private final WalkingState<ASTNode> myWalkingState = new WalkingState<ASTNode>(ASTTreeGuide.instance) {
     @Override
-    public void elementFinished(ASTNode element) {
+    public void elementFinished(@NotNull ASTNode element) {
 
     }
 
     @Override
-    public void visit(ASTNode element) {
+    public void visit(@NotNull ASTNode element) {
       ((TreeElement)element).acceptTree(RecursiveTreeElementWalkingVisitor.this);
     }
   };
diff --git a/platform/testFramework/src/com/intellij/testFramework/TestDataPath.java b/platform/testFramework/src/com/intellij/testFramework/TestDataPath.java
new file mode 100644 (file)
index 0000000..375554a
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * 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 com.intellij.testFramework;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Specifies the path to testdata for the current test case class.
+ * May use the variable $CONTENT_ROOT to specify the module content root.
+ *
+ * @author yole
+ */
+@Retention(RetentionPolicy.SOURCE)
+@Target({ElementType.TYPE})
+public @interface TestDataPath {
+  String value();
+}
index ef668653649d5bd5306d12feb1e62161693242cb..f7a8063f269cb0b7939a90e8d8e355179550d3cd 100644 (file)
@@ -363,6 +363,10 @@ public abstract class UsefulTestCase extends TestCase {
     if (StringUtil.isEmpty(name)) {
       return "";
     }
+    return getTestName(name, lowercaseFirstLetter);
+  }
+
+  public static String getTestName(String name, boolean lowercaseFirstLetter) {
     if (lowercaseFirstLetter && !isAllUppercaseName(name)) {
       name = Character.toLowerCase(name.charAt(0)) + name.substring(1);
     }
diff --git a/plugins/IdeaTestAssistant/IdeaTestAssistant.iml b/plugins/IdeaTestAssistant/IdeaTestAssistant.iml
new file mode 100644 (file)
index 0000000..084f641
--- /dev/null
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="JAVA_MODULE" version="4">
+  <component name="NewModuleRootManager" inherit-compiler-output="true">
+    <exclude-output />
+    <content url="file://$MODULE_DIR$">
+      <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/testSrc" isTestSource="true" />
+    </content>
+    <orderEntry type="inheritedJdk" />
+    <orderEntry type="sourceFolder" forTests="false" />
+    <orderEntry type="module" module-name="openapi" />
+    <orderEntry type="module" module-name="testFramework-java" scope="TEST" />
+  </component>
+</module>
+
diff --git a/plugins/IdeaTestAssistant/layout.xml b/plugins/IdeaTestAssistant/layout.xml
new file mode 100644 (file)
index 0000000..e1875c2
--- /dev/null
@@ -0,0 +1,13 @@
+<project name="Layout IdeaTestAssistant plugin distribution" default="layout">
+  <target name="layout">
+    <layout todir="${deploy}/plugins" xmlns="antlib:jetbrains.antlayout">
+      <dir name="IdeaTestAssistant">
+        <dir name="lib">
+          <jar name="IdeaTestAssistant.jar">
+            <module name="IdeaTestAssistant"/>
+          </jar>
+        </dir>
+      </dir>
+    </layout>
+  </target>
+</project>
\ No newline at end of file
diff --git a/plugins/IdeaTestAssistant/src/META-INF/plugin.xml b/plugins/IdeaTestAssistant/src/META-INF/plugin.xml
new file mode 100644 (file)
index 0000000..21c2a88
--- /dev/null
@@ -0,0 +1,16 @@
+<idea-plugin>
+  <id>com.intellij.testAssistant</id>
+  <name>IDEA Test Assistant</name>
+  <description>Assists in writing and maintaining tests for IntelliJ IDEA's code</description>
+  <version>1.0.0</version>
+  <vendor url="http://www.jetbrains.com" logo="/general/ijLogo.png">JetBrains</vendor>
+
+  <extensions defaultExtensionNs="com.intellij">
+    <codeInsight.lineMarkerProvider language="JAVA" implementationClass="com.intellij.testAssistant.TestDataLineMarkerProvider"/>
+    <fileEditorProvider implementation="com.intellij.testAssistant.TestDataGroupEditorProvider"/>
+  </extensions>
+
+  <actions>
+  </actions>
+</idea-plugin>
+
diff --git a/plugins/IdeaTestAssistant/src/com/intellij/testAssistant/TestDataGroupEditorProvider.java b/plugins/IdeaTestAssistant/src/com/intellij/testAssistant/TestDataGroupEditorProvider.java
new file mode 100644 (file)
index 0000000..cba0e5f
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ * 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 com.intellij.testAssistant;
+
+import com.intellij.openapi.fileEditor.FileEditor;
+import com.intellij.openapi.fileEditor.FileEditorPolicy;
+import com.intellij.openapi.fileEditor.FileEditorProvider;
+import com.intellij.openapi.fileEditor.FileEditorState;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.Disposer;
+import com.intellij.openapi.vfs.VirtualFile;
+import org.jdom.Element;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * @author yole
+ */
+public class TestDataGroupEditorProvider implements FileEditorProvider {
+  public boolean accept(@NotNull Project project, @NotNull VirtualFile file) {
+    return file instanceof TestDataGroupVirtualFile;
+  }
+
+  @NotNull
+  public FileEditor createEditor(@NotNull Project project, @NotNull VirtualFile file) {
+    return new TestDataGroupFileEditor(project, (TestDataGroupVirtualFile) file);
+  }
+
+  public void disposeEditor(@NotNull FileEditor editor) {
+    Disposer.dispose(editor);
+  }
+
+  @NotNull
+  public FileEditorState readState(@NotNull Element sourceElement, @NotNull Project project, @NotNull VirtualFile file) {
+    return FileEditorState.INSTANCE;
+  }
+
+  public void writeState(@NotNull FileEditorState state, @NotNull Project project, @NotNull Element targetElement) {
+  }
+
+  @NotNull
+  public String getEditorTypeId() {
+    return "TestDataGroup";
+  }
+
+  @NotNull
+  public FileEditorPolicy getPolicy() {
+    return FileEditorPolicy.HIDE_DEFAULT_EDITOR;
+  }
+}
diff --git a/plugins/IdeaTestAssistant/src/com/intellij/testAssistant/TestDataGroupFileEditor.java b/plugins/IdeaTestAssistant/src/com/intellij/testAssistant/TestDataGroupFileEditor.java
new file mode 100644 (file)
index 0000000..8949290
--- /dev/null
@@ -0,0 +1,119 @@
+/*
+ * 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 com.intellij.testAssistant;
+
+import com.intellij.codeHighlighting.BackgroundEditorHighlighter;
+import com.intellij.ide.structureView.StructureViewBuilder;
+import com.intellij.openapi.fileEditor.FileEditor;
+import com.intellij.openapi.fileEditor.FileEditorLocation;
+import com.intellij.openapi.fileEditor.FileEditorState;
+import com.intellij.openapi.fileEditor.FileEditorStateLevel;
+import com.intellij.openapi.fileEditor.impl.text.TextEditorProvider;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.ui.Splitter;
+import com.intellij.openapi.util.UserDataHolderBase;
+import org.jetbrains.annotations.NotNull;
+
+import javax.swing.*;
+import java.awt.*;
+import java.beans.PropertyChangeListener;
+
+/**
+ * @author yole
+ */
+public class TestDataGroupFileEditor extends UserDataHolderBase implements FileEditor {
+  private final TestDataGroupVirtualFile myFile;
+  private final FileEditor myBeforeEditor;
+  private final FileEditor myAfterEditor;
+
+  public TestDataGroupFileEditor(Project project, TestDataGroupVirtualFile file) {
+    myFile = file;
+    myBeforeEditor = TextEditorProvider.getInstance().createEditor(project, file.getBeforeFile());
+    myAfterEditor = TextEditorProvider.getInstance().createEditor(project, file.getAfterFile());
+  }
+
+  @NotNull
+  public JComponent getComponent() {
+    Splitter splitter = new Splitter(false);
+    splitter.setFirstComponent(wrapWithTitle(myFile.getBeforeFile().getName(), myBeforeEditor));
+    splitter.setSecondComponent(wrapWithTitle(myFile.getAfterFile().getName(), myAfterEditor));
+    return splitter;
+  }
+
+  private static JComponent wrapWithTitle(String name, final FileEditor beforeEditor) {
+    JPanel panel = new JPanel(new BorderLayout());
+    final JLabel label = new JLabel(name);
+    label.setBorder(BorderFactory.createEmptyBorder(1, 4, 2, 0));
+    label.setFont(label.getFont().deriveFont(Font.BOLD));
+    panel.add(BorderLayout.NORTH, label);
+    panel.add(BorderLayout.CENTER, beforeEditor.getComponent());
+    return panel;
+  }
+
+  public JComponent getPreferredFocusedComponent() {
+    return null;
+  }
+
+  @NotNull
+  public String getName() {
+    return myFile.getName();
+  }
+
+  @NotNull
+  public FileEditorState getState(@NotNull FileEditorStateLevel level) {
+    return FileEditorState.INSTANCE;
+  }
+
+  public void setState(@NotNull FileEditorState state) {
+  }
+
+  public boolean isModified() {
+    return myBeforeEditor.isModified() || myAfterEditor.isModified();
+  }
+
+  public boolean isValid() {
+    return myBeforeEditor.isValid() && myAfterEditor.isValid();
+  }
+
+  public void selectNotify() {
+  }
+
+  public void deselectNotify() {
+  }
+
+  public void addPropertyChangeListener(@NotNull PropertyChangeListener listener) {
+  }
+
+  public void removePropertyChangeListener(@NotNull PropertyChangeListener listener) {
+  }
+
+  public BackgroundEditorHighlighter getBackgroundHighlighter() {
+    return null;
+  }
+
+  public FileEditorLocation getCurrentLocation() {
+    return null;
+  }
+
+  public StructureViewBuilder getStructureViewBuilder() {
+    return null;
+  }
+
+  public void dispose() {
+    TextEditorProvider.getInstance().disposeEditor(myBeforeEditor);
+    TextEditorProvider.getInstance().disposeEditor(myAfterEditor);
+  }
+}
diff --git a/plugins/IdeaTestAssistant/src/com/intellij/testAssistant/TestDataGroupVirtualFile.java b/plugins/IdeaTestAssistant/src/com/intellij/testAssistant/TestDataGroupVirtualFile.java
new file mode 100644 (file)
index 0000000..33bca9c
--- /dev/null
@@ -0,0 +1,137 @@
+/*
+ * 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 com.intellij.testAssistant;
+
+import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.openapi.vfs.DeprecatedVirtualFile;
+import com.intellij.openapi.vfs.LocalFileSystem;
+import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.openapi.vfs.VirtualFileSystem;
+import com.intellij.util.Icons;
+import org.jetbrains.annotations.NotNull;
+
+import javax.swing.*;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+/**
+ * @author yole
+ */
+public class TestDataGroupVirtualFile extends DeprecatedVirtualFile {
+  private final VirtualFile myBeforeFile;
+  private final VirtualFile myAfterFile;
+
+  public TestDataGroupVirtualFile(VirtualFile beforeFile, VirtualFile afterFile) {
+    myBeforeFile = beforeFile;
+    myAfterFile = afterFile;
+  }
+
+  @NotNull
+  @Override
+  public String getName() {
+    final String prefix = StringUtil.commonPrefix(myBeforeFile.getName(), myAfterFile.getName());
+    if (prefix.length() == 0) {
+      return StringUtil.commonSuffix(myBeforeFile.getName(), myAfterFile.getName());
+    }
+    return prefix + "." + myBeforeFile.getExtension();
+  }
+
+  public VirtualFile getBeforeFile() {
+    return myBeforeFile;
+  }
+
+  public VirtualFile getAfterFile() {
+    return myAfterFile;
+  }
+
+  @Override
+  public Icon getIcon() {
+    return Icons.TEST_SOURCE_FOLDER;
+  }
+
+  @NotNull
+  @Override
+  public VirtualFileSystem getFileSystem() {
+    return LocalFileSystem.getInstance();
+  }
+
+  @Override
+  public String getPath() {
+    return myBeforeFile.getPath();
+  }
+
+  @Override
+  public boolean isWritable() {
+    return true;
+  }
+
+  @Override
+  public boolean isDirectory() {
+    return false;
+  }
+
+  @Override
+  public boolean isValid() {
+    return true;
+  }
+
+  @Override
+  public VirtualFile getParent() {
+    return null;
+  }
+
+  @Override
+  public VirtualFile[] getChildren() {
+    return EMPTY_ARRAY;
+  }
+
+  @NotNull
+  @Override
+  public OutputStream getOutputStream(Object requestor, long newModificationStamp, long newTimeStamp) throws IOException {
+    throw new UnsupportedOperationException();
+  }
+
+  @NotNull
+  @Override
+  public byte[] contentsToByteArray() throws IOException {
+    throw new UnsupportedOperationException();
+  }
+
+  @Override
+  public long getTimeStamp() {
+    return 0;
+  }
+
+  @Override
+  public long getLength() {
+    return 0;
+  }
+
+  @Override
+  public long getModificationStamp() {
+    return 0;
+  }
+
+  @Override
+  public void refresh(boolean asynchronous, boolean recursive, Runnable postRunnable) {
+  }
+
+  @Override
+  public InputStream getInputStream() throws IOException {
+    throw new UnsupportedOperationException();
+  }
+}
diff --git a/plugins/IdeaTestAssistant/src/com/intellij/testAssistant/TestDataLineMarkerProvider.java b/plugins/IdeaTestAssistant/src/com/intellij/testAssistant/TestDataLineMarkerProvider.java
new file mode 100644 (file)
index 0000000..da4c464
--- /dev/null
@@ -0,0 +1,211 @@
+package com.intellij.testAssistant;
+
+import com.intellij.codeHighlighting.Pass;
+import com.intellij.codeInsight.AnnotationUtil;
+import com.intellij.codeInsight.daemon.GutterIconNavigationHandler;
+import com.intellij.codeInsight.daemon.LineMarkerInfo;
+import com.intellij.codeInsight.daemon.LineMarkerProvider;
+import com.intellij.openapi.application.ApplicationManager;
+import com.intellij.openapi.fileEditor.OpenFileDescriptor;
+import com.intellij.openapi.fileTypes.FileType;
+import com.intellij.openapi.fileTypes.FileTypeManager;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.roots.ProjectFileIndex;
+import com.intellij.openapi.roots.ProjectRootManager;
+import com.intellij.openapi.ui.Messages;
+import com.intellij.openapi.ui.popup.PopupChooserBuilder;
+import com.intellij.openapi.util.Computable;
+import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.openapi.vfs.LocalFileSystem;
+import com.intellij.openapi.vfs.VfsUtil;
+import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.psi.*;
+import com.intellij.ui.ColoredListCellRenderer;
+import com.intellij.ui.awt.RelativePoint;
+import com.intellij.util.ArrayUtil;
+import com.intellij.util.Icons;
+import org.jetbrains.annotations.Nullable;
+
+import javax.swing.*;
+import java.awt.event.MouseEvent;
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * @author yole
+ */
+public class TestDataLineMarkerProvider implements LineMarkerProvider {
+  public LineMarkerInfo getLineMarkerInfo(PsiElement element) {
+    if (!(element instanceof PsiMethod)) {
+      return null;
+    }
+    final PsiMethod method = (PsiMethod)element;
+    String name = method.getName();
+    if (!name.startsWith("test")) {
+      return null;
+    }
+    String testDataPath = getTestDataBasePath(method.getContainingClass());
+    if (testDataPath != null) {
+      List<String> fileNames = new TestDataReferenceCollector(testDataPath, name.substring(4)).collectTestDataReferences(method);
+      if (fileNames.size() > 0) {
+        return new LineMarkerInfo<PsiMethod>(method, method.getTextOffset(), Icons.TEST_SOURCE_FOLDER, Pass.UPDATE_ALL, null,
+                                             new TestDataNavigationHandler(fileNames));
+      }
+    }
+    return null;
+  }
+
+  public void collectSlowLineMarkers(List<PsiElement> elements, Collection<LineMarkerInfo> result) {
+  }
+
+  @Nullable
+  private static String getTestDataBasePath(PsiClass psiClass) {
+    final PsiAnnotation annotation = AnnotationUtil.findAnnotationInHierarchy(psiClass, Collections.singleton("com.intellij.testFramework.TestDataPath"));
+    if (annotation != null) {
+      final PsiAnnotationMemberValue value = annotation.findAttributeValue(PsiAnnotation.DEFAULT_REFERENCED_METHOD_NAME);
+      if (value instanceof PsiExpression) {
+        final PsiConstantEvaluationHelper evaluationHelper = JavaPsiFacade.getInstance(value.getProject()).getConstantEvaluationHelper();
+        final Object constantValue = evaluationHelper.computeConstantExpression(value, false);
+        if (constantValue instanceof String) {
+          String path = (String) constantValue;
+          if (path.indexOf("$CONTENT_ROOT") >= 0) {
+            final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(psiClass.getProject()).getFileIndex();
+            final VirtualFile contentRoot = fileIndex.getContentRootForFile(psiClass.getContainingFile().getVirtualFile());
+            if (contentRoot == null) return null;
+            path = path.replace("$CONTENT_ROOT", contentRoot.getPath());
+          }
+          return path;
+        }
+      }
+    }
+    return null;
+  }
+
+  private static class TestDataNavigationHandler implements GutterIconNavigationHandler<PsiMethod> {
+    private List<String> myFileNames;
+
+    public TestDataNavigationHandler(List<String> fileNames) {
+      myFileNames = fileNames;
+    }
+
+    public void navigate(MouseEvent e, final PsiMethod elt) {
+      if (myFileNames.size() == 1) {
+        openFileByIndex(elt.getProject(), 0);
+      }
+      else {
+        TestDataGroupVirtualFile groupFile = getTestDataGroup();
+        if (groupFile != null) {
+          new OpenFileDescriptor(elt.getProject(), groupFile).navigate(true);
+        }
+        else {
+          showNavigationPopup(elt.getProject(), e);
+        }
+      }
+    }
+
+    @Nullable
+    private TestDataGroupVirtualFile getTestDataGroup() {
+      if (myFileNames.size() != 2) {
+        return null;
+      }
+      VirtualFile file1 = LocalFileSystem.getInstance().refreshAndFindFileByPath(myFileNames.get(0));
+      VirtualFile file2 = LocalFileSystem.getInstance().refreshAndFindFileByPath(myFileNames.get(1));
+      if (file1 == null || file2 == null) {
+        return null;
+      }
+      final int commonPrefixLength = StringUtil.commonPrefixLength(file1.getName(), file2.getName());
+      if (file1.getName().substring(commonPrefixLength).toLowerCase().contains("after")) {
+        return new TestDataGroupVirtualFile(file2, file1);
+      }
+      if (file2.getName().substring(commonPrefixLength).toLowerCase().contains("after")) {
+        return new TestDataGroupVirtualFile(file1, file2);
+      }
+      return null;
+    }
+
+    private void showNavigationPopup(final Project project, MouseEvent e) {
+      List<String> shortNames = new ArrayList<String>();
+      for (String fileName : myFileNames) {
+        shortNames.add(new File(fileName).getName());
+      }
+      final String CREATE_MISSING_OPTION = "Create Missing Files";
+      if (myFileNames.size() == 2) {
+        shortNames.add(CREATE_MISSING_OPTION);
+      }
+      final JList list = new JList(shortNames.toArray(new String[shortNames.size()]));
+      list.setCellRenderer(new ColoredListCellRenderer() {
+        @Override
+        protected void customizeCellRenderer(JList list, Object value, int index, boolean selected, boolean hasFocus) {
+          String fileName = (String)value;
+          if (!fileName.equals(CREATE_MISSING_OPTION)) {
+            final FileType fileType = FileTypeManager.getInstance().getFileTypeByFileName(fileName);
+            setIcon(fileType.getIcon());
+          }
+          append(fileName);
+        }
+      });
+      PopupChooserBuilder builder = new PopupChooserBuilder(list);
+      builder.setItemChoosenCallback(new Runnable() {
+        public void run() {
+          final int[] indices = list.getSelectedIndices();
+          if (ArrayUtil.indexOf(indices, myFileNames.size()) >= 0) {
+            createMissingFiles(project);
+          }
+          else {
+            for (int index : indices) {
+              openFileByIndex(project, index);
+            }
+          }
+        }
+      }).createPopup().show(new RelativePoint(e));
+    }
+
+    private void createMissingFiles(Project project) {
+      for (String name : myFileNames) {
+        if (LocalFileSystem.getInstance().refreshAndFindFileByPath(name) == null) {
+          createFileByName(project, name);
+        }
+      }
+      final TestDataGroupVirtualFile testDataGroup = getTestDataGroup();
+      if (testDataGroup != null) {
+        new OpenFileDescriptor(project, testDataGroup).navigate(true);
+      }
+    }
+
+    private void openFileByIndex(final Project project, final int index) {
+      final String path = myFileNames.get(index);
+      final VirtualFile file = LocalFileSystem.getInstance().refreshAndFindFileByPath(path);
+      if (file != null) {
+        new OpenFileDescriptor(project, file).navigate(true);
+      }
+      else {
+        int rc = Messages.showYesNoDialog(project, "The referenced testdata file " + path + " does not exist. Would you like to create it?",
+                                          "Create Testdata File", Messages.getQuestionIcon());
+        if (rc == 0) {
+          VirtualFile vFile = createFileByName(project, path);
+          new OpenFileDescriptor(project, vFile).navigate(true);
+        }
+      }
+    }
+
+    private VirtualFile createFileByName(final Project project, final String path) {
+      return ApplicationManager.getApplication().runWriteAction(new Computable<VirtualFile>() {
+        public VirtualFile compute() {
+          try {
+            final File file = new File(path);
+            final VirtualFile parent = VfsUtil.createDirectories(file.getParent());
+            return parent.createChildData(this, file.getName());
+          }
+          catch (IOException e) {
+            Messages.showErrorDialog(project, e.getMessage(), "Create Testdata File");
+            return null;
+          }
+        }
+      });
+    }
+  }
+}
diff --git a/plugins/IdeaTestAssistant/src/com/intellij/testAssistant/TestDataReferenceCollector.java b/plugins/IdeaTestAssistant/src/com/intellij/testAssistant/TestDataReferenceCollector.java
new file mode 100644 (file)
index 0000000..c7d343c
--- /dev/null
@@ -0,0 +1,140 @@
+/*
+ * 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 com.intellij.testAssistant;
+
+import com.intellij.psi.*;
+import com.intellij.testFramework.UsefulTestCase;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author yole
+ */
+public class TestDataReferenceCollector {
+  private final String myTestDataPath;
+  private final String myTestName;
+
+  public TestDataReferenceCollector(String testDataPath, String testName) {
+    myTestDataPath = testDataPath;
+    myTestName = testName;
+  }
+
+  List<String> collectTestDataReferences(final PsiMethod method) {
+    return collectTestDataReferences(method, new HashMap<String, String>());
+  }
+
+  private List<String> collectTestDataReferences(final PsiMethod method, final Map<String, String> argumentMap) {
+    final List<String> result = new ArrayList<String>();
+    method.accept(new JavaRecursiveElementVisitor() {
+      @Override
+      public void visitMethodCallExpression(PsiMethodCallExpression expression) {
+        String callText = expression.getMethodExpression().getReferenceName();
+        if (callText == null) return;
+        if (callText.equals("configureByFile") || callText.equals("checkResultByFile")) {
+          processCallArgument(expression, argumentMap, result, 0);
+        }
+        else if (callText.equals("doFileTest")) {
+          processCallArgument(expression, argumentMap, result, 0);
+          processCallArgument(expression, argumentMap, result, 1);
+        }
+        else if (expression.getMethodExpression().getQualifierExpression() == null) {
+          final PsiMethod callee = expression.resolveMethod();
+          if (callee != null) {
+            result.addAll(collectTestDataReferences(callee, buildArgumentMap(expression, callee)));
+          }
+        }
+      }
+    });
+    return result;
+  }
+
+  private void processCallArgument(PsiMethodCallExpression expression, Map<String, String> argumentMap, List<String> result, final int index) {
+    final PsiExpression[] arguments = expression.getArgumentList().getExpressions();
+    if (arguments.length > index) {
+      String testDataFile = getReferencedFile(arguments [index], argumentMap);
+      if (testDataFile != null) {
+        result.add(myTestDataPath + testDataFile);
+      }
+    }
+  }
+
+  private static Map<String, String> buildArgumentMap(PsiMethodCallExpression expression, PsiMethod method) {
+    Map<String, String> result = new HashMap<String, String>();
+    final PsiParameter[] parameters = method.getParameterList().getParameters();
+    final PsiExpression[] arguments = expression.getArgumentList().getExpressions();
+    for (int i = 0; i < arguments.length && i < parameters.length; i++) {
+      if (arguments[i] instanceof PsiLiteralExpression) {
+        final Object value = ((PsiLiteralExpression)arguments[i]).getValue();
+        if (value instanceof String) {
+          result.put(parameters [i].getName(), (String) value);
+        }
+      }
+    }
+    return result;
+  }
+
+  @Nullable
+  private String getReferencedFile(PsiExpression expression, Map<String, String> arguments) {
+    if (expression instanceof PsiBinaryExpression) {
+      PsiBinaryExpression binaryExpression = (PsiBinaryExpression)expression;
+      if (binaryExpression.getOperationTokenType() == JavaTokenType.PLUS) {
+        String lhs = getReferencedFile(binaryExpression.getLOperand(), arguments);
+        String rhs = getReferencedFile(binaryExpression.getROperand(), arguments);
+        if (lhs != null && rhs != null) {
+          return lhs + rhs;
+        }
+      }
+    }
+    else if (expression instanceof PsiLiteralExpression) {
+      final Object value = ((PsiLiteralExpression)expression).getValue();
+      if (value instanceof String) {
+        return (String) value;
+      }
+    }
+    else if (expression instanceof PsiReferenceExpression) {
+      final PsiElement result = ((PsiReferenceExpression)expression).resolve();
+      if (result instanceof PsiParameter) {
+        final String name = ((PsiParameter)result).getName();
+        return arguments.get(name);
+      }
+      if (result instanceof PsiVariable) {
+        final PsiExpression initializer = ((PsiVariable)result).getInitializer();
+        if (initializer != null) {
+          return getReferencedFile(initializer, arguments);
+        }
+
+      }
+    }
+    else if (expression instanceof PsiMethodCallExpression) {
+      final PsiMethodCallExpression methodCall = (PsiMethodCallExpression)expression;
+      final String callText = methodCall.getMethodExpression().getText();
+      if (callText.equals("getTestName")) {
+        final PsiExpression[] psiExpressions = methodCall.getArgumentList().getExpressions();
+        if (psiExpressions.length == 1) {
+          if (psiExpressions[0].getText().equals("true")) {
+            return UsefulTestCase.getTestName(myTestName, true);
+          }
+          return myTestName;
+        }
+      }
+    }
+    return null;
+  }
+}
diff --git a/plugins/IdeaTestAssistant/testData/referenceCollector/DoFileTest.java b/plugins/IdeaTestAssistant/testData/referenceCollector/DoFileTest.java
new file mode 100644 (file)
index 0000000..14e7c29
--- /dev/null
@@ -0,0 +1,6 @@
+public class ATest extends LightCodeInsightFixtureTestCase {
+
+  public void testFixtureConfigureByFile() throws Exception {
+    doFileTest("before", "after");
+  }
+}
diff --git a/plugins/IdeaTestAssistant/testData/referenceCollector/DoTestParameters.java b/plugins/IdeaTestAssistant/testData/referenceCollector/DoTestParameters.java
new file mode 100644 (file)
index 0000000..2c1c42b
--- /dev/null
@@ -0,0 +1,14 @@
+public class ATest extends LightCodeInsightFixtureTestCase {
+
+  public void testDoTestParameters() throws Exception {
+    doTest();
+  }
+
+  private void doTest() throws Exception {
+    doTest("java");
+  }
+
+  private void doTest(String extension) throws Exception {
+    configureByFile(getTestName(true) + "." + extension);
+  }
+}
diff --git a/plugins/IdeaTestAssistant/testData/referenceCollector/FixtureConfigureByFile.java b/plugins/IdeaTestAssistant/testData/referenceCollector/FixtureConfigureByFile.java
new file mode 100644 (file)
index 0000000..e509245
--- /dev/null
@@ -0,0 +1,6 @@
+public class ATest extends LightCodeInsightFixtureTestCase {
+
+  public void testFixtureConfigureByFile() throws Exception {
+    myFixture.configureByFile(getTestName(true));
+  }
+}
diff --git a/plugins/IdeaTestAssistant/testData/referenceCollector/ReferencesInAnyMethod.java b/plugins/IdeaTestAssistant/testData/referenceCollector/ReferencesInAnyMethod.java
new file mode 100644 (file)
index 0000000..e9aa3e5
--- /dev/null
@@ -0,0 +1,10 @@
+public class ATest extends LightCodeInsightFixtureTestCase {
+
+  public void testReferencesInAnyMethod() throws Exception {
+    resolve();
+  }
+
+  private void resolve() throws Exception {
+    configureByFile("before");
+  }
+}
diff --git a/plugins/IdeaTestAssistant/testSrc/com/intellij/testAssistant/TestDataReferenceCollectorTest.java b/plugins/IdeaTestAssistant/testSrc/com/intellij/testAssistant/TestDataReferenceCollectorTest.java
new file mode 100644 (file)
index 0000000..cea843a
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+ * 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 com.intellij.testAssistant;
+
+import com.intellij.openapi.application.PluginPathManager;
+import com.intellij.psi.PsiJavaFile;
+import com.intellij.psi.PsiMethod;
+import com.intellij.testFramework.TestDataPath;
+import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase;
+
+import java.util.List;
+
+/**
+ * @author yole
+ */
+@TestDataPath("$CONTENT_ROOT/testData/")
+public class TestDataReferenceCollectorTest extends LightCodeInsightFixtureTestCase {
+  public void testFixtureConfigureByFile() throws Exception {
+    final List<String> references = doTest();
+    assertEquals(1, references.size());
+    assertEquals("fixtureConfigureByFile", references.get(0));
+  }
+
+  public void testDoTestParameters() throws Exception {
+    final List<String> references = doTest();
+    assertEquals(1, references.size());
+    assertEquals("doTestParameters.java", references.get(0));
+  }
+
+  public void testDoFileTest() throws Exception {
+    final List<String> references = doTest();
+    assertEquals(2, references.size());
+    assertTrue(references.contains("before"));
+    assertTrue(references.contains("after"));
+  }
+
+  public void testReferencesInAnyMethod() throws Exception {
+    final List<String> references = doTest();
+    assertEquals(1, references.size());
+    assertEquals("before", references.get(0));
+  }
+
+  private List<String> doTest() throws Exception {
+    myFixture.configureByFile("referenceCollector/" + getTestName(false) + ".java");
+    final PsiMethod theMethod = ((PsiJavaFile)myFixture.getFile()).getClasses()[0].getMethods()[0];
+    return new TestDataReferenceCollector("", theMethod.getName().substring(4)).collectTestDataReferences(theMethod);
+  }
+
+  @Override
+  protected String getBasePath() {
+    return PluginPathManager.getPluginHomePathRelative("IdeaTestAssistant") + "/testData/";
+  }
+}