JComponent () { myPropertiesFile = new ComboBox<>(); SwingUtilities.invokeLater(() -> { ReadAction.nonBlocking(() -> myResourceBundleManager != null ? myResourceBundleManager.suggestPropertiesFiles(myContextModules) : I18nUtil.defaultSuggestPropertiesFiles(myProject, myContextModules)) .finishOnUiThread(ModalityState.stateForComponent(myPropertiesFile), files -> { myPropertiesFile.setModel(new DefaultComboBoxModel<>(ArrayUtil.toStringArray(files))); if (!files.isEmpty()) { String contextString = getContextString(); @NlsSafe String preselectedFile; if (contextString != null && contextString.equals(PropertiesComponent.getInstance(myProject).getValue(LAST_USED_CONTEXT))) { preselectedFile = PropertiesComponent.getInstance(myProject).getValue(LAST_USED_PROPERTIES_FILE); } else { preselectedFile = null; } myPropertiesFile.setSelectedItem(ObjectUtils.notNull(preselectedFile, files.get(0))); } }) .submit(AppExecutorUtil.getAppExecutorService()); }); ComboboxSpeedSearch.installOn(myPropertiesFile); LabeledComponent<JComboBox<String>> component = new LabeledComponent<>(); component.setText(JavaI18nBundle.message("property.file")); component.setComponent(myPropertiesFile); myPropertiesFile.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { PropertiesFile propertiesFile = getPropertiesFile(); if (propertiesFile != null) { List<I18nizedPropertyData<D>> pairs = myKeyValuePairs; ReadAction.nonBlocking(() -> { List<I18nizedPropertyData<D>> result = new ArrayList<>(); for (I18nizedPropertyData<D> data : pairs) { result.add(data.changeKey(I18nizeQuickFixDialog.suggestUniquePropertyKey(data.value(), data.key(), propertiesFile))); } return result; }).finishOnUiThread(ModalityState.stateForComponent(myPropertiesFile), datum -> { for (int i = 0; i < datum.size(); i++) { myKeyValuePairs.set(i, datum.get(i)); } }).submit(AppExecutorUtil.getAppExecutorService()); } } }); JPanel panel = new JPanel(new BorderLayout()); panel.add(component, BorderLayout.NORTH); if (myShowCodeInfo && hasResourceBundleInTemplate()) { myRBEditorTextField = new TextFieldWithStoredHistory("RESOURCE_BUNDLE_KEYS"); if (!myRBEditorTextField.getHistory().isEmpty()) { myRBEditorTextField.setSelectedIndex(0); } panel.add(UI.PanelFactory.panel(myRBEditorTextField) .withLabel(JavaI18nBundle.message("i18n.quickfix.code.panel.resource.bundle.expression.label")) .withComment(JavaI18nBundle.message("comment.if.the.resource.bundle.is.invalid.either.declare.it.as.an.object")) .createPanel(), BorderLayout.SOUTH); } return panel; }