镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,11 @@ private static List<PackageNode> getContainers(PackageParams query, IProgressMon
.collect(Collectors.toList());
boolean isReferencedLibrariesExist = Arrays.stream(references)
.anyMatch(entry -> entry.getEntryKind() == IClasspathEntry.CPE_LIBRARY || entry.getEntryKind() == IClasspathEntry.CPE_VARIABLE);
if (isReferencedLibrariesExist || !ProjectUtils.isVisibleProject(javaProject.getProject())) {
// Invisble project will always have the referenced libraries entry
if (!ProjectUtils.isVisibleProject(javaProject.getProject())) {
result.add(PackageNode.REFERENCED_LIBRARIES_CONTAINER);
} else if (isReferencedLibrariesExist) {
result.add(PackageNode.IMMUTABLE_REFERENCED_LIBRARIES_CONTAINER);
}
return result;
} catch (CoreException e) {
Expand All @@ -258,8 +261,6 @@ private static List<PackageNode> getContainers(PackageParams query, IProgressMon
return Collections.emptyList();
}



private static List<PackageNode> getPackageFragmentRoots(PackageParams query, IProgressMonitor pm) {
ArrayList<PackageNode> children = new ArrayList<>();
IJavaProject javaProject = getJavaProject(query.getProjectUri());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,14 @@
*/
public class PackageNode {
private static final String REFERENCED_LIBRARIES_CONTAINER_NAME = "Referenced Libraries";
private static final String IMMUTABLE_REFERENCED_LIBRARIES_CONTAINER_NAME = "Referenced Libraries (Read-only)";

public static final String REFERENCED_LIBRARIES_PATH = "REFERENCED_LIBRARIES_PATH";
public static final String DEFAULT_PACKAGE_DISPLAYNAME = "(default package)";
public static final ContainerNode REFERENCED_LIBRARIES_CONTAINER = new ContainerNode(REFERENCED_LIBRARIES_CONTAINER_NAME, REFERENCED_LIBRARIES_PATH,
NodeKind.CONTAINER, IClasspathEntry.CPE_CONTAINER);
public static final ContainerNode IMMUTABLE_REFERENCED_LIBRARIES_CONTAINER = new ContainerNode(IMMUTABLE_REFERENCED_LIBRARIES_CONTAINER_NAME, REFERENCED_LIBRARIES_PATH,
NodeKind.CONTAINER, IClasspathEntry.CPE_CONTAINER);

/**
* The name of the PackageNode
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -230,17 +230,17 @@
},
{
"command": "java.project.addLibraries",
"when": "view == javaDependencyExplorer && viewItem =~ /java:container\/referenced-libraries/",
"when": "view == javaDependencyExplorer && viewItem =~ /java:container\/referenced-libraries$/",
"group": "inline@0"
},
{
"command": "java.project.removeLibrary",
"when": "view == javaDependencyExplorer && viewItem =~ /java:jar\/referenced-libraries/",
"when": "view == javaDependencyExplorer && viewItem =~ /java:jar\/referenced-libraries\\+uri$/",
"group": "inline"
},
{
"command": "java.project.refreshLibraries",
"when": "view == javaDependencyExplorer && viewItem =~ /java:container\/referenced-libraries/",
"when": "view == javaDependencyExplorer && viewItem =~ /java:container\/referenced-libraries$/",
"group": "inline@1"
}
]
Expand Down