diff --git a/java-extension/com.microsoft.java.test.plugin/src/main/java/com/microsoft/java/test/plugin/util/TestSearchUtils.java b/java-extension/com.microsoft.java.test.plugin/src/main/java/com/microsoft/java/test/plugin/util/TestSearchUtils.java index dcadee2a..ccd8685f 100644 --- a/java-extension/com.microsoft.java.test.plugin/src/main/java/com/microsoft/java/test/plugin/util/TestSearchUtils.java +++ b/java-extension/com.microsoft.java.test.plugin/src/main/java/com/microsoft/java/test/plugin/util/TestSearchUtils.java @@ -153,9 +153,10 @@ public static List searchTestItems(List arguments, IProgressMo * @throws CoreException * @throws OperationCanceledException * @throws InterruptedException + * @throws URISyntaxException */ public static List searchAllTestItems(List arguments, IProgressMonitor monitor) - throws CoreException, OperationCanceledException, InterruptedException { + throws CoreException, OperationCanceledException, InterruptedException, URISyntaxException { final List searchResult = new LinkedList<>(); if (arguments == null || arguments.size() == 0) { @@ -228,17 +229,17 @@ private static boolean isInTestScope(IJavaElement element) throws JavaModelExcep return false; } - private static IJavaSearchScope createSearchScope(SearchTestItemParams params) throws JavaModelException { + private static IJavaSearchScope createSearchScope(SearchTestItemParams params) + throws JavaModelException, URISyntaxException { switch (params.getLevel()) { case ROOT: final IJavaProject[] projects = JavaCore.create(ResourcesPlugin.getWorkspace().getRoot()) .getJavaProjects(); return SearchEngine.createJavaSearchScope(projects, IJavaSearchScope.SOURCES); case FOLDER: - - final IJavaProject[] javaProjects = JavaCore.create(JDTUtils.findFolder(params.getUri())).getJavaModel() - .getJavaProjects(); - return SearchEngine.createJavaSearchScope(javaProjects, IJavaSearchScope.SOURCES); + final Set projectSet = ProjectUtils.parseProjects(new URI(params.getUri())); + return SearchEngine.createJavaSearchScope(projectSet.toArray(new IJavaElement[projectSet.size()]), + IJavaSearchScope.SOURCES); case PACKAGE: final IJavaElement packageElement = JDTUtils.resolvePackage(params.getUri()); return SearchEngine.createJavaSearchScope(new IJavaElement[] { packageElement },