void (JComboBox<Integer> comboBox, Module module, @Nullable Runnable onDone) { Object selectedItem = comboBox.getSelectedItem(); ReadAction.nonBlocking(() -> { final DefaultComboBoxModel<Integer> aModel = new DefaultComboBoxModel<>(); aModel.addElement(ALL_IN_PACKAGE); aModel.addElement(DIR); aModel.addElement(PATTERN); aModel.addElement(CLASS); aModel.addElement(METHOD); GlobalSearchScope searchScope = module != null ? GlobalSearchScope.moduleRuntimeScope(module, true) : GlobalSearchScope.allScope(myProject); if (myProject.isDefault() || JavaPsiFacade.getInstance(myProject).findPackage("org.junit") != null) { aModel.addElement(CATEGORY); } if (myProject.isDefault() || JUnitUtil.isJUnit5(searchScope, myProject) || TestObject.hasJUnit5EnginesAPI(searchScope, JavaPsiFacade.getInstance(myProject))) { aModel.addElement(UNIQUE_ID); aModel.addElement(TAGS); } if (Registry.is(TestDiscoveryExtension.TEST_DISCOVERY_REGISTRY_KEY)) { aModel.addElement(BY_SOURCE_POSITION); aModel.addElement(BY_SOURCE_CHANGES); } return aModel; }).finishOnUiThread(ModalityState.any(), model -> { comboBox.setModel(model); comboBox.setSelectedItem(selectedItem == null ? myType : selectedItem); if (onDone != null) { onDone.run(); } }).submit(AppExecutorUtil.getAppExecutorService()); }