public SubclassGotoClassModel( @NotNull final Project project, @NotNull final AbstractTreeClassChooserDialog<T> treeClassChooserDialog, @NotNull BaseClassInheritorsProvider<T> inheritorsProvider) { super(project, treeClassChooserDialog); myInheritorsProvider = inheritorsProvider; assert myInheritorsProvider.getBaseClass() != null; }
@NotNull @Override public String[] getNames(boolean checkBoxState) { if (!myFastMode) { return myInheritorsProvider.getNames(); } final List<String> names = new ArrayList<String>(); myFastMode = myInheritorsProvider .searchForInheritorsOfBaseClass() .forEach( new Processor<T>() { private long start = System.currentTimeMillis(); @Override public boolean process(T aClass) { if (System.currentTimeMillis() - start > 500) { return false; } if ((getTreeClassChooserDialog().getFilter().isAccepted(aClass)) && aClass.getName() != null) { names.add(aClass.getName()); } return true; } }); if (!myFastMode) { return myInheritorsProvider.getNames(); } if ((getTreeClassChooserDialog().getFilter().isAccepted(myInheritorsProvider.getBaseClass())) && myInheritorsProvider.getBaseClass().getName() != null) { names.add(myInheritorsProvider.getBaseClass().getName()); } return ArrayUtil.toStringArray(names); }