|
|
11dc0f |
From 9ecc34bf838eae50a356b20c76d35fb62a423563 Mon Sep 17 00:00:00 2001
|
|
|
11dc0f |
From: Stephan Herrmann
|
|
|
11dc0f |
Date: Tue, 18 Jun 2019 16:28:49 +0200
|
|
|
11dc0f |
Subject: Bug 548211 - "Remove" in the Module dependencies tab does not remove
|
|
|
11dc0f |
system modules
|
|
|
11dc0f |
|
|
|
11dc0f |
- more fixes, concerning update on Apply and re-open with only java.base
|
|
|
11dc0f |
|
|
|
11dc0f |
Change-Id: I39a7a1da6c8ae733010009372fd36a88814e4faf
|
|
|
11dc0f |
---
|
|
|
11dc0f |
.../ui/wizards/buildpaths/BuildPathsBlock.java | 3 +++
|
|
|
11dc0f |
.../ui/wizards/buildpaths/CPListElement.java | 24 +++++++++++++++-------
|
|
|
11dc0f |
.../wizards/buildpaths/ModuleDependenciesPage.java | 13 ++++++++++++
|
|
|
11dc0f |
3 files changed, 33 insertions(+), 7 deletions(-)
|
|
|
11dc0f |
|
|
|
11dc0f |
diff --git a/eclipse.jdt.ui/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/buildpaths/BuildPathsBlock.java b/eclipse.jdt.ui/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/buildpaths/BuildPathsBlock.java
|
|
|
11dc0f |
index 3fec77d579..37229a834b 100644
|
|
|
11dc0f |
--- a/eclipse.jdt.ui/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/buildpaths/BuildPathsBlock.java
|
|
|
11dc0f |
+++ b/eclipse.jdt.ui/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/buildpaths/BuildPathsBlock.java
|
|
|
11dc0f |
@@ -395,6 +395,9 @@ public class BuildPathsBlock {
|
|
|
11dc0f |
}
|
|
|
11dc0f |
|
|
|
11dc0f |
protected void doUpdateUI() {
|
|
|
11dc0f |
+ if (fModulesPage.needReInit()) {
|
|
|
11dc0f |
+ init(fCurrJProject, null, null); // extent of system modules was changed, re-init fClassPathList
|
|
|
11dc0f |
+ }
|
|
|
11dc0f |
fBuildPathDialogField.refresh();
|
|
|
11dc0f |
fClassPathList.refresh();
|
|
|
11dc0f |
boolean is9OrHigherAfter= JavaModelUtil.is9OrHigher(fCurrJProject);
|
|
|
11dc0f |
diff --git a/eclipse.jdt.ui/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/buildpaths/CPListElement.java b/eclipse.jdt.ui/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/buildpaths/CPListElement.java
|
|
|
11dc0f |
index a3c475e7ea..c670c0770f 100644
|
|
|
11dc0f |
--- a/eclipse.jdt.ui/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/buildpaths/CPListElement.java
|
|
|
11dc0f |
+++ b/eclipse.jdt.ui/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/buildpaths/CPListElement.java
|
|
|
11dc0f |
@@ -42,6 +42,7 @@ import org.eclipse.jdt.core.IModuleDescription;
|
|
|
11dc0f |
import org.eclipse.jdt.core.IPackageFragmentRoot;
|
|
|
11dc0f |
import org.eclipse.jdt.core.JavaCore;
|
|
|
11dc0f |
import org.eclipse.jdt.core.JavaModelException;
|
|
|
11dc0f |
+import org.eclipse.jdt.core.provisional.JavaModelAccess;
|
|
|
11dc0f |
|
|
|
11dc0f |
|
|
|
11dc0f |
import org.eclipse.jdt.internal.corext.util.JavaModelUtil;
|
|
|
11dc0f |
@@ -207,13 +208,22 @@ public class CPListElement {
|
|
|
11dc0f |
boolean modulesAdded= false;
|
|
|
11dc0f |
if (containerEntry != null) {
|
|
|
11dc0f |
IPackageFragmentRoot[] fragmentRoots= fProject.findPackageFragmentRoots(containerEntry);
|
|
|
11dc0f |
- if (fragmentRoots != null && fragmentRoots.length > 1) {
|
|
|
11dc0f |
- for (IPackageFragmentRoot fragmentRoot : fragmentRoots) {
|
|
|
11dc0f |
- IModuleDescription currModule= fragmentRoot.getModuleDescription();
|
|
|
11dc0f |
- if (currModule != null) {
|
|
|
11dc0f |
- CPListElement curr= create(this, pseudoEntry, currModule, true, fProject);
|
|
|
11dc0f |
- fChildren.add(curr);
|
|
|
11dc0f |
- modulesAdded= true;
|
|
|
11dc0f |
+ if (fragmentRoots != null) {
|
|
|
11dc0f |
+ // detect if system library:
|
|
|
11dc0f |
+ boolean addChildren= false;
|
|
|
11dc0f |
+ if (fragmentRoots.length > 0) {
|
|
|
11dc0f |
+ IModuleDescription module= fragmentRoots[0].getModuleDescription();
|
|
|
11dc0f |
+ if (module != null && JavaModelAccess.isSystemModule(module))
|
|
|
11dc0f |
+ addChildren= true;
|
|
|
11dc0f |
+ }
|
|
|
11dc0f |
+ if (addChildren) {
|
|
|
11dc0f |
+ for (IPackageFragmentRoot fragmentRoot : fragmentRoots) {
|
|
|
11dc0f |
+ IModuleDescription currModule= fragmentRoot.getModuleDescription();
|
|
|
11dc0f |
+ if (currModule != null) {
|
|
|
11dc0f |
+ CPListElement curr= create(this, pseudoEntry, currModule, true, fProject);
|
|
|
11dc0f |
+ fChildren.add(curr);
|
|
|
11dc0f |
+ modulesAdded= true;
|
|
|
11dc0f |
+ }
|
|
|
11dc0f |
}
|
|
|
11dc0f |
}
|
|
|
11dc0f |
}
|
|
|
11dc0f |
diff --git a/eclipse.jdt.ui/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/buildpaths/ModuleDependenciesPage.java b/eclipse.jdt.ui/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/buildpaths/ModuleDependenciesPage.java
|
|
|
11dc0f |
index b813d22956..e9f1c9feff 100644
|
|
|
11dc0f |
--- a/eclipse.jdt.ui/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/buildpaths/ModuleDependenciesPage.java
|
|
|
11dc0f |
+++ b/eclipse.jdt.ui/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/buildpaths/ModuleDependenciesPage.java
|
|
|
11dc0f |
@@ -164,6 +164,7 @@ public class ModuleDependenciesPage extends BuildPathBasePage {
|
|
|
11dc0f |
private Collection<String> fAllDefaultSystemModules; // if current is unnamed module: transitive closure of default root modules (names)
|
|
|
11dc0f |
|
|
|
11dc0f |
public final Map<String,String> fPatchMap= new HashMap<>();
|
|
|
11dc0f |
+ private boolean needReInit= false;
|
|
|
11dc0f |
|
|
|
11dc0f |
public ModuleDependenciesPage(IStatusChangeListener context, CheckedListDialogField<CPListElement> classPathList) {
|
|
|
11dc0f |
fClassPathList= classPathList;
|
|
|
11dc0f |
@@ -530,6 +531,7 @@ public class ModuleDependenciesPage extends BuildPathBasePage {
|
|
|
11dc0f |
}
|
|
|
11dc0f |
updateLimitModules(cpListElement.findAttributeElement(CPListElement.MODULE));
|
|
|
11dc0f |
fModuleList.refresh();
|
|
|
11dc0f |
+ this.needReInit= true;
|
|
|
11dc0f |
}
|
|
|
11dc0f |
|
|
|
11dc0f |
public void addToSystemModules(List<IModuleDescription> modulesToAdd) throws JavaModelException {
|
|
|
11dc0f |
@@ -655,8 +657,19 @@ public class ModuleDependenciesPage extends BuildPathBasePage {
|
|
|
11dc0f |
}
|
|
|
11dc0f |
}
|
|
|
11dc0f |
}
|
|
|
11dc0f |
+ this.needReInit= true;
|
|
|
11dc0f |
}
|
|
|
11dc0f |
|
|
|
11dc0f |
+ /** Destructively reed the needReInit flag.
|
|
|
11dc0f |
+ * @return {@code true} if the classpath needs to be reinitialized due to change of extent of the system library
|
|
|
11dc0f |
+ */
|
|
|
11dc0f |
+ public boolean needReInit() {
|
|
|
11dc0f |
+ try {
|
|
|
11dc0f |
+ return this.needReInit;
|
|
|
11dc0f |
+ } finally {
|
|
|
11dc0f |
+ this.needReInit= false;
|
|
|
11dc0f |
+ }
|
|
|
11dc0f |
+ }
|
|
|
11dc0f |
private Set<String> computeForwardClosure(List<String> seeds) {
|
|
|
11dc0f |
Set<String> closure= new HashSet<>();
|
|
|
11dc0f |
collectForwardClosure(seeds, closure);
|
|
|
11dc0f |
--
|
|
|
11dc0f |
cgit v1.2.1
|
|
|
11dc0f |
|