Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate icons to codicon in dependency explorer #242

Merged
merged 10 commits into from
Mar 19, 2020
Next Next commit
bugfix: Can only modify the referenced libraries in invisible project
  • Loading branch information
jdneo committed Jan 17, 2020
commit 36c2e09f9311e38849d8e809eaf338175bd0ff44
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