List<MavenArtifactSearchResult> (Project project, String pattern, int maxResult) { if (StringUtil.isEmpty(pattern)) { return Collections.emptyList(); } List<MavenRepositoryArtifactInfo> searchResults = new ArrayList<>(); DependencySearchService searchService = DependencySearchService.getInstance(project); boolean useLocalProvidersOnly = ApplicationManager.getApplication().isUnitTestMode(); SearchParameters parameters = new SearchParameters(false, useLocalProvidersOnly); Promise<Integer> asyncPromise = searchService.fulltextSearch(pattern, parameters, mdci -> { if (mdci instanceof MavenRepositoryArtifactInfo) { searchResults.add((MavenRepositoryArtifactInfo)mdci); } }); new WaitFor(1000) { @Override protected boolean condition() { return asyncPromise.getState() != Promise.State.PENDING; } }; return processResults(searchResults); }