From 572370fa1c8c624af42201f78a72090252e53119 Mon Sep 17 00:00:00 2001 From: Jinbo Wang Date: Tue, 22 Oct 2019 13:40:34 +0800 Subject: [PATCH 1/2] Support searching main classes from the workspace invisible project Signed-off-by: Jinbo Wang --- .../plugin/internal/ResolveMainClassHandler.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/com.microsoft.java.debug.plugin/src/main/java/com/microsoft/java/debug/plugin/internal/ResolveMainClassHandler.java b/com.microsoft.java.debug.plugin/src/main/java/com/microsoft/java/debug/plugin/internal/ResolveMainClassHandler.java index 187257a9a..eb7a542fa 100644 --- a/com.microsoft.java.debug.plugin/src/main/java/com/microsoft/java/debug/plugin/internal/ResolveMainClassHandler.java +++ b/com.microsoft.java.debug.plugin/src/main/java/com/microsoft/java/debug/plugin/internal/ResolveMainClassHandler.java @@ -12,6 +12,7 @@ package com.microsoft.java.debug.plugin.internal; import java.util.ArrayList; +import java.util.Collection; import java.util.Collections; import java.util.Comparator; import java.util.List; @@ -23,6 +24,7 @@ import org.apache.commons.lang3.StringUtils; import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IFolder; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; @@ -107,7 +109,8 @@ public void acceptSearchMatch(SearchMatch match) { String projectName = ProjectsManager.DEFAULT_PROJECT_NAME.equals(project.getName()) ? null : project.getName(); if (projectName == null || targetProjectPath.isEmpty() - || ResourceUtils.isContainedIn(project.getLocation(), targetProjectPath)) { + || ResourceUtils.isContainedIn(project.getLocation(), targetProjectPath) + || isContainedInInvisibleProject(project, targetProjectPath)) { String filePath = null; if (match.getResource() instanceof IFile) { @@ -141,6 +144,15 @@ public void acceptSearchMatch(SearchMatch match) { return resolutions; } + private boolean isContainedInInvisibleProject(IProject project, Collection rootPaths) { + if (project == null) { + return false; + } + + IFolder workspaceLinkFolder = project.getFolder("_"); + return workspaceLinkFolder.exists() && ResourceUtils.isContainedIn(workspaceLinkFolder.getLocation(), rootPaths); + } + private ValidationResponse validateLaunchConfigCore(List arguments) throws CoreException { ValidationResponse response = new ValidationResponse(); From 935eb17802d390cbee3de072940fda23f7e8140b Mon Sep 17 00:00:00 2001 From: Jinbo Wang Date: Tue, 22 Oct 2019 15:36:47 +0800 Subject: [PATCH 2/2] Address review comment Signed-off-by: Jinbo Wang --- .../java/debug/plugin/internal/ResolveMainClassHandler.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/com.microsoft.java.debug.plugin/src/main/java/com/microsoft/java/debug/plugin/internal/ResolveMainClassHandler.java b/com.microsoft.java.debug.plugin/src/main/java/com/microsoft/java/debug/plugin/internal/ResolveMainClassHandler.java index eb7a542fa..9d3b1014e 100644 --- a/com.microsoft.java.debug.plugin/src/main/java/com/microsoft/java/debug/plugin/internal/ResolveMainClassHandler.java +++ b/com.microsoft.java.debug.plugin/src/main/java/com/microsoft/java/debug/plugin/internal/ResolveMainClassHandler.java @@ -39,6 +39,7 @@ import org.eclipse.jdt.core.search.SearchParticipant; import org.eclipse.jdt.core.search.SearchPattern; import org.eclipse.jdt.core.search.SearchRequestor; +import org.eclipse.jdt.ls.core.internal.ProjectUtils; import org.eclipse.jdt.ls.core.internal.ResourceUtils; import org.eclipse.jdt.ls.core.internal.managers.ProjectsManager; @@ -149,7 +150,7 @@ private boolean isContainedInInvisibleProject(IProject project, Collection