mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
show implementations: accept fields as class containers (IDEA-142678)
This commit is contained in:
@@ -57,6 +57,9 @@ public class ClassPresentationUtil {
|
||||
else if (element instanceof PsiFile){
|
||||
return ((PsiFile)element).getName();
|
||||
}
|
||||
else if (element instanceof PsiField) {
|
||||
return ((PsiField)element).getName();
|
||||
}
|
||||
else{
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -163,6 +163,23 @@ public class ImplementationsViewTest extends LightCodeInsightFixtureTestCase {
|
||||
assertContent(component, new String[]{"a.java (AFoo)", "a.java"});
|
||||
}
|
||||
|
||||
public void testInterfaceConstants() {
|
||||
myFixture.configureByText("a.java", "interface AF<caret>oo{\n" +
|
||||
" AFoo IMPL = new AFoo(){};\n" +
|
||||
" boolean aaa();\n" +
|
||||
"}");
|
||||
PsiClass psiClass =
|
||||
(PsiClass)TargetElementUtil.findTargetElement(myFixture.getEditor(), TargetElementUtil.getInstance().getAllAccepted());
|
||||
|
||||
assert psiClass != null;
|
||||
final Collection<PsiElement> classes = getClassImplementations(psiClass);
|
||||
List<PsiElement> all = new ArrayList<PsiElement>();
|
||||
all.add(psiClass);
|
||||
all.addAll(classes);
|
||||
final ImplementationViewComponent component = new ImplementationViewComponent(all.toArray(new PsiElement[all.size()]), 0);
|
||||
assertContent(component, new String[]{"a.java (AFoo)", "a.java (Anonymous in IMPL)"});
|
||||
}
|
||||
|
||||
public void testInterfaceMethodOfFunctionalInterface() {
|
||||
myFixture.configureByText("a.java", "interface AFoo{\n" +
|
||||
" boolean a<caret>aa();\n" +
|
||||
|
||||
Reference in New Issue
Block a user