|
|
11dc0f |
From 5ca45e97b527b5a4d4ed4ce92e32720859911968 Mon Sep 17 00:00:00 2001
|
|
|
11dc0f |
From: Stephan Herrmann
|
|
|
11dc0f |
Date: Sat, 15 Jun 2019 20:47:45 +0200
|
|
|
11dc0f |
Subject: Bug 548211 - "Remove" in the Module dependencies tab does not remove
|
|
|
11dc0f |
system modules
|
|
|
11dc0f |
|
|
|
11dc0f |
Change-Id: I633fa86e5911c50b17a1c7ef188805902942e1db
|
|
|
11dc0f |
---
|
|
|
11dc0f |
.../jdt/internal/ui/wizards/NewWizardMessages.java | 1 +
|
|
|
11dc0f |
.../ui/wizards/NewWizardMessages.properties | 1 +
|
|
|
11dc0f |
.../wizards/buildpaths/ModuleDependenciesPage.java | 22 ++++++++++++++++++----
|
|
|
11dc0f |
3 files changed, 20 insertions(+), 4 deletions(-)
|
|
|
11dc0f |
|
|
|
11dc0f |
diff --git a/eclipse.jdt.ui/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/NewWizardMessages.java b/eclipse.jdt.ui/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/NewWizardMessages.java
|
|
|
11dc0f |
index 3a66ae56ed..961aa63bba 100644
|
|
|
11dc0f |
--- a/eclipse.jdt.ui/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/NewWizardMessages.java
|
|
|
11dc0f |
+++ b/eclipse.jdt.ui/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/NewWizardMessages.java
|
|
|
11dc0f |
@@ -564,6 +564,7 @@ public final class NewWizardMessages extends NLS {
|
|
|
11dc0f |
public static String ModuleDependenciesPage_removeCurrentModule_error;
|
|
|
11dc0f |
public static String ModuleDependenciesPage_removeModule_error_with_hint;
|
|
|
11dc0f |
public static String ModuleDependenciesPage_removeSystemModule_error_hint;
|
|
|
11dc0f |
+ public static String ModuleDependenciesPage_moduleIsRequired_error_hint;
|
|
|
11dc0f |
|
|
|
11dc0f |
public static String ModuleDependenciesAdapter_patchConflict_title;
|
|
|
11dc0f |
public static String ModuleDependenciesAdapter_patchConflict_message;
|
|
|
11dc0f |
diff --git a/eclipse.jdt.ui/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/NewWizardMessages.properties b/eclipse.jdt.ui/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/NewWizardMessages.properties
|
|
|
11dc0f |
index feb30bc627..a3d8a04624 100644
|
|
|
11dc0f |
--- a/eclipse.jdt.ui/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/NewWizardMessages.properties
|
|
|
11dc0f |
+++ b/eclipse.jdt.ui/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/NewWizardMessages.properties
|
|
|
11dc0f |
@@ -605,6 +605,7 @@ ModuleDependenciesPage_removeCurrentModule_error=Cannot remove the current modul
|
|
|
11dc0f |
ModuleDependenciesPage_removeModule_error_with_hint=Cannot remove module ''{0}''{1}
|
|
|
11dc0f |
ModuleDependenciesPage_removeSystemModule_error_hint=\nOnly system modules can be removed here.\n\
|
|
|
11dc0f |
To remove other modules please remove them from the Modulepath (Projects or Libraries tab).
|
|
|
11dc0f |
+ModuleDependenciesPage_moduleIsRequired_error_hint=\nIt is required along the path {0}
|
|
|
11dc0f |
|
|
|
11dc0f |
ModuleDependenciesAdapter_patchConflict_title=Patch module conflict
|
|
|
11dc0f |
ModuleDependenciesAdapter_patchConflict_message=The {0} {1} was declared to patch module ''{2}''.\n\
|
|
|
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 ccc5c3317a..b813d22956 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 |
@@ -614,7 +614,16 @@ public class ModuleDependenciesPage extends BuildPathBasePage {
|
|
|
11dc0f |
return;
|
|
|
11dc0f |
}
|
|
|
11dc0f |
selectedModuleNames.add(moduleName);
|
|
|
11dc0f |
- collectModulesToRemove(moduleName, allModulesToRemove);
|
|
|
11dc0f |
+ String problemModule= collectModulesToRemove(moduleName, allModulesToRemove);
|
|
|
11dc0f |
+ if (problemModule != null) {
|
|
|
11dc0f |
+ int lastArrow= problemModule.lastIndexOf("->"); //$NON-NLS-1$
|
|
|
11dc0f |
+ String leafMod= lastArrow == -1 ? problemModule : problemModule.substring(lastArrow+2);
|
|
|
11dc0f |
+ MessageDialog.openError(getShell(), NewWizardMessages.ModuleDependenciesPage_removeModule_dialog_title,
|
|
|
11dc0f |
+ MessageFormat.format(NewWizardMessages.ModuleDependenciesPage_removeModule_error_with_hint,
|
|
|
11dc0f |
+ leafMod,
|
|
|
11dc0f |
+ MessageFormat.format(NewWizardMessages.ModuleDependenciesPage_moduleIsRequired_error_hint, problemModule)));
|
|
|
11dc0f |
+ return;
|
|
|
11dc0f |
+ }
|
|
|
11dc0f |
}
|
|
|
11dc0f |
String seedModules= String.join(", ", selectedModuleNames); //$NON-NLS-1$
|
|
|
11dc0f |
if (allModulesToRemove.size() == selectedModuleNames.size()) {
|
|
|
11dc0f |
@@ -664,15 +673,20 @@ public class ModuleDependenciesPage extends BuildPathBasePage {
|
|
|
11dc0f |
}
|
|
|
11dc0f |
}
|
|
|
11dc0f |
|
|
|
11dc0f |
- private void collectModulesToRemove(String mod, Set<String> modulesToRemove) {
|
|
|
11dc0f |
+ private String collectModulesToRemove(String mod, Set<String> modulesToRemove) {
|
|
|
11dc0f |
if (fModuleList.fNames.contains(mod) && modulesToRemove.add(mod)) {
|
|
|
11dc0f |
List<String> requireds= fModuleRequiredByModules.get(mod);
|
|
|
11dc0f |
if (requireds != null) {
|
|
|
11dc0f |
for (String required : requireds) {
|
|
|
11dc0f |
- collectModulesToRemove(required, modulesToRemove);
|
|
|
11dc0f |
+ if (fModuleList.getModuleKind(required) == ModuleKind.Focus)
|
|
|
11dc0f |
+ return required + "->" + mod; //$NON-NLS-1$
|
|
|
11dc0f |
+ String problemModule= collectModulesToRemove(required, modulesToRemove);
|
|
|
11dc0f |
+ if (problemModule != null)
|
|
|
11dc0f |
+ return problemModule + "->" + mod; //$NON-NLS-1$
|
|
|
11dc0f |
}
|
|
|
11dc0f |
}
|
|
|
11dc0f |
}
|
|
|
11dc0f |
+ return null;
|
|
|
11dc0f |
}
|
|
|
11dc0f |
|
|
|
11dc0f |
private boolean confirmRemoveModule(String message) {
|
|
|
11dc0f |
@@ -741,7 +755,7 @@ public class ModuleDependenciesPage extends BuildPathBasePage {
|
|
|
11dc0f |
List<String> dominators= fModuleRequiredByModules.get(name);
|
|
|
11dc0f |
if (dominators != null) {
|
|
|
11dc0f |
for (String dominator : dominators) {
|
|
|
11dc0f |
- if (names.contains(dominator)) {
|
|
|
11dc0f |
+ if (names.contains(dominator) && fModuleList.getModuleKind(dominator) == ModuleKind.System) {
|
|
|
11dc0f |
continue outer;
|
|
|
11dc0f |
}
|
|
|
11dc0f |
}
|
|
|
11dc0f |
--
|
|
|
11dc0f |
cgit v1.2.1
|
|
|
11dc0f |
|