|
|
040604 |
From a23545ef5b4cbb94ff048fda2839ba08c3593d50 Mon Sep 17 00:00:00 2001
|
|
|
040604 |
From: Mat Booth <mat.booth@redhat.com>
|
|
|
040604 |
Date: Thu, 3 May 2018 15:58:49 +0100
|
|
|
040604 |
Subject: [PATCH] Bug 534326 - Awkward p2 UI when many droplets are installed
|
|
|
040604 |
Filter out software site locations where we know that they are p2 droplets in
|
|
|
040604 |
places we show the list to the user. Change-Id:
|
|
|
040604 |
I12364223850862783cb7cffd32fb7428fbf6b270 Signed-off-by: Mat Booth
|
|
|
040604 |
<mat.booth@redhat.com>
|
|
|
d433ea |
|
|
|
040604 |
---
|
|
|
040604 |
.../p2/ui/dialogs/RepositorySelectionGroup.java | 13 +++++++++++++
|
|
|
040604 |
.../equinox/p2/ui/RepositoryManipulationPage.java | 15 ++++++++++++++-
|
|
|
040604 |
2 files changed, 27 insertions(+), 1 deletion(-)
|
|
|
d433ea |
|
|
|
d433ea |
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
|
|
|
040604 |
index d07be5d43..c666f8fdc 100644
|
|
|
d433ea |
--- a/rt.equinox.p2/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/RepositorySelectionGroup.java
|
|
|
d433ea |
+++ b/rt.equinox.p2/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/RepositorySelectionGroup.java
|
|
|
d433ea |
@@ -303,6 +303,19 @@ public class RepositorySelectionGroup {
|
|
|
d433ea |
void fillRepoCombo(final String selection) {
|
|
|
d433ea |
RepositoryTracker tracker = ui.getRepositoryTracker();
|
|
|
d433ea |
URI[] sites = tracker.getKnownRepositories(ui.getSession());
|
|
|
d433ea |
+ // Filter out sites that are actually installed p2 droplets
|
|
|
d433ea |
+ String fragments = System.getProperty("p2.fragments"); //$NON-NLS-1$
|
|
|
d433ea |
+ ArrayList<URI> filteredSites = new ArrayList<>(Arrays.asList(sites));
|
|
|
d433ea |
+ if (fragments != null) {
|
|
|
d433ea |
+ for (String root : fragments.split(",")) { //$NON-NLS-1$
|
|
|
d433ea |
+ for (URI uri : sites) {
|
|
|
d433ea |
+ if (uri.getPath() != null && uri.getPath().startsWith(root)) {
|
|
|
d433ea |
+ filteredSites.remove(uri);
|
|
|
d433ea |
+ }
|
|
|
d433ea |
+ }
|
|
|
d433ea |
+ }
|
|
|
d433ea |
+ }
|
|
|
d433ea |
+ sites = filteredSites.toArray(new URI[0]);
|
|
|
d433ea |
boolean hasLocalSites = getLocalSites().length > 0;
|
|
|
d433ea |
final String[] items;
|
|
|
d433ea |
if (hasLocalSites) {
|
|
|
d433ea |
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
|
|
|
040604 |
index 78fb5398e..b8e724b66 100644
|
|
|
d433ea |
--- a/rt.equinox.p2/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/RepositoryManipulationPage.java
|
|
|
d433ea |
+++ b/rt.equinox.p2/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/RepositoryManipulationPage.java
|
|
|
d433ea |
@@ -133,9 +133,22 @@ public class RepositoryManipulationPage extends PreferencePage implements IWorkb
|
|
|
d433ea |
if (cachedElements == null) {
|
|
|
d433ea |
Object[] children = super.fetchChildren(o, monitor);
|
|
|
d433ea |
cachedElements = new Hashtable<>(children.length);
|
|
|
d433ea |
+ String fragments = System.getProperty("p2.fragments"); //$NON-NLS-1$
|
|
|
040604 |
for (Object element : children) {
|
|
|
040604 |
if (element instanceof MetadataRepositoryElement) {
|
|
|
040604 |
- put((MetadataRepositoryElement) element);
|
|
|
d433ea |
+ // Filter out locations that are actually installed p2 droplets
|
|
|
d433ea |
+ if (fragments != null) {
|
|
|
d433ea |
+ boolean isDroplet = false;
|
|
|
d433ea |
+ for (String root : fragments.split(",")) { //$NON-NLS-1$
|
|
|
040604 |
+ URI childLoc = ((MetadataRepositoryElement) element).getLocation();
|
|
|
d433ea |
+ if (childLoc.getPath() != null && childLoc.getPath().startsWith(root)) {
|
|
|
d433ea |
+ isDroplet = true;
|
|
|
d433ea |
+ }
|
|
|
d433ea |
+ }
|
|
|
d433ea |
+ if (!isDroplet) {
|
|
|
040604 |
+ put((MetadataRepositoryElement) element);
|
|
|
d433ea |
+ }
|
|
|
d433ea |
+ }
|
|
|
d433ea |
}
|
|
|
d433ea |
}
|
|
|
d433ea |
}
|
|
|
040604 |
--
|
|
|
040604 |
2.21.1
|
|
|
040604 |
|