mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-04 17:20:55 +07:00
Completion in multi-catch
This commit is contained in:
@@ -9,6 +9,8 @@ import com.intellij.openapi.command.WriteCommandAction;
|
||||
import com.intellij.openapi.module.JavaModuleType;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.module.ModuleManager;
|
||||
import com.intellij.openapi.roots.LanguageLevelProjectExtension;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
import com.intellij.testFramework.PsiTestUtil;
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
|
||||
@@ -70,7 +72,7 @@ public class ClassNameCompletionTest extends CompletionTestCase {
|
||||
|
||||
public void testInPlainTextFile() throws Exception {
|
||||
configureByFile(BASE_PATH + getTestName(false) + ".txt");
|
||||
checkResultByFile(BASE_PATH + getTestName(false) + "_after.txt");
|
||||
checkResultByFile(BASE_PATH + getTestName(false) + "_after.txt");
|
||||
}
|
||||
|
||||
public void testDoubleStringBuffer() throws Exception {
|
||||
@@ -95,7 +97,7 @@ public class ClassNameCompletionTest extends CompletionTestCase {
|
||||
private void doTest() throws Exception {
|
||||
String path = BASE_PATH + "/java/";
|
||||
configureByFile(path + getTestName(false) + ".java");
|
||||
checkResultByFile(path + getTestName(false) + "_after.java");
|
||||
checkResultByFile(path + getTestName(false) + "_after.java");
|
||||
}
|
||||
|
||||
public void testNameCompletionJava() throws Exception {
|
||||
@@ -108,14 +110,14 @@ public class ClassNameCompletionTest extends CompletionTestCase {
|
||||
checkResultByFile(path + "/test2-result.java");
|
||||
}
|
||||
|
||||
public void testImplementsFiltering1() throws Exception{
|
||||
public void testImplementsFiltering1() throws Exception {
|
||||
final String path = BASE_PATH + "/nameCompletion/java";
|
||||
configureByFile(path + "/test4-source.java");
|
||||
performAction();
|
||||
checkResultByFile(path + "/test4-result.java");
|
||||
}
|
||||
|
||||
public void testImplementsFiltering2() throws Exception{
|
||||
public void testImplementsFiltering2() throws Exception {
|
||||
final String path = BASE_PATH + "/nameCompletion/java";
|
||||
configureByFile(path + "/test3-source.java");
|
||||
performAction();
|
||||
@@ -135,7 +137,7 @@ public class ClassNameCompletionTest extends CompletionTestCase {
|
||||
return "testAnnotationFiltering".equals(getName());
|
||||
}
|
||||
|
||||
public void testAnnotationFiltering() throws Exception{
|
||||
public void testAnnotationFiltering() throws Exception {
|
||||
final String path = BASE_PATH + "/nameCompletion/java";
|
||||
configureByFile(path + "/test7-source.java");
|
||||
performAction();
|
||||
@@ -217,9 +219,23 @@ public class ClassNameCompletionTest extends CompletionTestCase {
|
||||
checkResultByFile(BASE_PATH + "/nameCompletion/java/" + getTestName(false) + "-result.java");
|
||||
}
|
||||
|
||||
public void testInCatchType1() throws Exception { doJavaTest(); }
|
||||
|
||||
public void testInCatchType2() throws Exception { doJavaTest(); }
|
||||
|
||||
public void testInMultiCatchType1() throws Exception {
|
||||
LanguageLevelProjectExtension.getInstance(getProject()).setLanguageLevel(LanguageLevel.JDK_1_7);
|
||||
doJavaTest();
|
||||
}
|
||||
|
||||
public void testInMultiCatchType2() throws Exception {
|
||||
LanguageLevelProjectExtension.getInstance(getProject()).setLanguageLevel(LanguageLevel.JDK_1_7);
|
||||
doJavaTest();
|
||||
}
|
||||
|
||||
private void doJavaTest() throws Exception {
|
||||
final String path = BASE_PATH + "/nameCompletion/java";
|
||||
configureByFile(path + "/" + getTestName(false) + "-source.java");
|
||||
configureByFileNoCompletion(path + "/" + getTestName(false) + "-source.java");
|
||||
performAction();
|
||||
checkResultByFile(path + "/" + getTestName(false) + "-result.java");
|
||||
}
|
||||
@@ -237,10 +253,11 @@ public class ClassNameCompletionTest extends CompletionTestCase {
|
||||
CodeCompletionHandlerBase handler = new CodeCompletionHandlerBase(CompletionType.CLASS_NAME);
|
||||
handler.invokeCompletion(myProject, myEditor);
|
||||
final LookupManager instance = LookupManager.getInstance(myProject);
|
||||
if(instance instanceof LookupManagerImpl){
|
||||
if (instance instanceof LookupManagerImpl) {
|
||||
final LookupManagerImpl testLookupManager = ((LookupManagerImpl)instance);
|
||||
if(testLookupManager.getActiveLookup() != null)
|
||||
if (testLookupManager.getActiveLookup() != null) {
|
||||
testLookupManager.forceSelection(Lookup.NORMAL_SELECT_CHAR, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user