|
|
11dc0f |
commit 4bfc5a7c6d8c2aaf954c113d805419472de2bcaf
|
|
|
11dc0f |
Author: Mat Booth <mat.booth@redhat.com>
|
|
|
11dc0f |
Date: Thu May 3 15:58:49 2018 +0100
|
|
|
11dc0f |
|
|
|
11dc0f |
Bug 534326 - Awkward p2 UI when many droplets are installed
|
|
|
11dc0f |
|
|
|
11dc0f |
Filter out software site locations where we know that they are p2
|
|
|
11dc0f |
droplets in places we show the list to the user.
|
|
|
11dc0f |
|
|
|
11dc0f |
Change-Id: I12364223850862783cb7cffd32fb7428fbf6b270
|
|
|
11dc0f |
Signed-off-by: Mat Booth <mat.booth@redhat.com>
|
|
|
11dc0f |
|
|
|
11dc0f |
diff --git a/rt.equinox.p2/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/RepositorySelectionGroup.java b/rt.equinox.p2/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/RepositorySelectionGroup.java
|
|
|
11dc0f |
index e6eef8c39..fe5970e79 100644
|
|
|
11dc0f |
--- a/rt.equinox.p2/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/RepositorySelectionGroup.java
|
|
|
11dc0f |
+++ b/rt.equinox.p2/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/RepositorySelectionGroup.java
|
|
|
11dc0f |
@@ -303,6 +303,19 @@ public class RepositorySelectionGroup {
|
|
|
11dc0f |
void fillRepoCombo(final String selection) {
|
|
|
11dc0f |
RepositoryTracker tracker = ui.getRepositoryTracker();
|
|
|
11dc0f |
URI[] sites = tracker.getKnownRepositories(ui.getSession());
|
|
|
11dc0f |
+ // Filter out sites that are actually installed p2 droplets
|
|
|
11dc0f |
+ String fragments = System.getProperty("p2.fragments"); //$NON-NLS-1$
|
|
|
11dc0f |
+ ArrayList<URI> filteredSites = new ArrayList<>(Arrays.asList(sites));
|
|
|
11dc0f |
+ if (fragments != null) {
|
|
|
11dc0f |
+ for (String root : fragments.split(",")) { //$NON-NLS-1$
|
|
|
11dc0f |
+ for (URI uri : sites) {
|
|
|
11dc0f |
+ if (uri.getPath() != null && uri.getPath().startsWith(root)) {
|
|
|
11dc0f |
+ filteredSites.remove(uri);
|
|
|
11dc0f |
+ }
|
|
|
11dc0f |
+ }
|
|
|
11dc0f |
+ }
|
|
|
11dc0f |
+ }
|
|
|
11dc0f |
+ sites = filteredSites.toArray(new URI[0]);
|
|
|
11dc0f |
boolean hasLocalSites = getLocalSites().length > 0;
|
|
|
11dc0f |
final String[] items;
|
|
|
11dc0f |
if (hasLocalSites) {
|
|
|
11dc0f |
diff --git a/rt.equinox.p2/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/RepositoryManipulationPage.java b/rt.equinox.p2/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/RepositoryManipulationPage.java
|
|
|
11dc0f |
index d796aefd0..c03924f90 100644
|
|
|
11dc0f |
--- a/rt.equinox.p2/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/RepositoryManipulationPage.java
|
|
|
11dc0f |
+++ b/rt.equinox.p2/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/RepositoryManipulationPage.java
|
|
|
11dc0f |
@@ -133,9 +133,22 @@ public class RepositoryManipulationPage extends PreferencePage implements IWorkb
|
|
|
11dc0f |
if (cachedElements == null) {
|
|
|
11dc0f |
Object[] children = super.fetchChildren(o, monitor);
|
|
|
11dc0f |
cachedElements = new Hashtable<>(children.length);
|
|
|
11dc0f |
+ String fragments = System.getProperty("p2.fragments"); //$NON-NLS-1$
|
|
|
11dc0f |
for (int i = 0; i < children.length; i++) {
|
|
|
11dc0f |
if (children[i] instanceof MetadataRepositoryElement) {
|
|
|
11dc0f |
- put((MetadataRepositoryElement) children[i]);
|
|
|
11dc0f |
+ // Filter out locations that are actually installed p2 droplets
|
|
|
11dc0f |
+ if (fragments != null) {
|
|
|
11dc0f |
+ boolean isDroplet = false;
|
|
|
11dc0f |
+ for (String root : fragments.split(",")) { //$NON-NLS-1$
|
|
|
11dc0f |
+ URI childLoc = ((MetadataRepositoryElement) children[i]).getLocation();
|
|
|
11dc0f |
+ if (childLoc.getPath() != null && childLoc.getPath().startsWith(root)) {
|
|
|
11dc0f |
+ isDroplet = true;
|
|
|
11dc0f |
+ }
|
|
|
11dc0f |
+ }
|
|
|
11dc0f |
+ if (!isDroplet) {
|
|
|
11dc0f |
+ put((MetadataRepositoryElement) children[i]);
|
|
|
11dc0f |
+ }
|
|
|
11dc0f |
+ }
|
|
|
11dc0f |
}
|
|
|
11dc0f |
}
|
|
|
11dc0f |
}
|