EditorTextField (@NotNull final Project project, @NotNull final ProjectSystemId externalSystemId) { ExternalSystemManager<?, ?, ?, ?, ?> manager = ExternalSystemApiUtil.getManager(externalSystemId); assert manager != null; final AbstractExternalSystemLocalSettings<?> settings = manager.getLocalSettingsProvider().fun(project); final ExternalSystemUiAware uiAware = ExternalSystemUiUtil.getUiAware(externalSystemId); TextFieldCompletionProvider provider = new TextFieldCompletionProviderDumbAware() { @Override protected void addCompletionVariants(@NotNull String text, int offset, @NotNull String prefix, @NotNull CompletionResultSet result) { for (Map.Entry<ExternalProjectPojo, Collection<ExternalProjectPojo>> entry : settings.getAvailableProjects().entrySet()) { String rootProjectPath = entry.getKey().getPath(); String rootProjectName = uiAware.getProjectRepresentationName(rootProjectPath, null); ExternalProjectPathLookupElement rootProjectElement = new ExternalProjectPathLookupElement(rootProjectName, rootProjectPath); result.addElement(rootProjectElement); for (ExternalProjectPojo subProject : entry.getValue()) { String p = subProject.getPath(); if (rootProjectPath.equals(p)) { continue; } String subProjectName = uiAware.getProjectRepresentationName(p, rootProjectPath); ExternalProjectPathLookupElement subProjectElement = new ExternalProjectPathLookupElement(subProjectName, p); result.addElement(subProjectElement); } } result.stopHere(); } }; EditorTextField result = provider.createEditor(project, true, editor -> { collapseIfPossible(editor, externalSystemId, project); editor.getSettings().setShowIntentionBulb(false); }); result.setOneLineMode(true); result.setOpaque(true); result.setBackground(UIUtil.getTextFieldBackground()); return result; }