use of com.intellij.ide.util.gotoByName.ChooseByNameModel in project intellij-community by JetBrains.
the class ClassChooserTest method testSubclassModel.
public void testSubclassModel() throws Exception {
myFixture.addClass("class Foo extends Exception {}");
myFixture.addClass("class Bar {}");
PsiClass aClass = JavaPsiFacade.getInstance(getProject()).findClass(CommonClassNames.JAVA_LANG_EXCEPTION, GlobalSearchScope.allScope(getProject()));
final Ref<ChooseByNameModel> ref = new Ref<>();
TreeJavaClassChooserDialog dialog = new TreeJavaClassChooserDialog("hey", getProject(), GlobalSearchScope.projectScope(getProject()), null, aClass, null, false) {
@Override
protected ChooseByNameModel createChooseByNameModel() {
ChooseByNameModel model = super.createChooseByNameModel();
ref.set(model);
return model;
}
@Override
public JRootPane getRootPane() {
return new JRootPane();
}
};
Disposer.register(myFixture.getTestRootDisposable(), dialog.getDisposable());
ChooseByNameModelEx model = (ChooseByNameModelEx) ref.get();
CommonProcessors.CollectProcessor<String> processor = new CommonProcessors.CollectProcessor<>();
model.processNames(processor, false);
List<String> results = (List<String>) processor.getResults();
assertEquals(1, results.size());
}
Aggregations