Skip to content

Commit 4aa2bba

Browse files
committed
Do not use PlatformAdmin
PlatformAdmin is the legacy resolver API, we can get the same information from the bundle context directly.
1 parent 05f4bea commit 4aa2bba

File tree

1 file changed

+21
-23
lines changed

1 file changed

+21
-23
lines changed

bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/dialogs/ConfigurationLogUpdateSection.java

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@
2424
import org.eclipse.equinox.p2.engine.IProfileRegistry;
2525
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
2626
import org.eclipse.equinox.p2.query.QueryUtil;
27-
import org.eclipse.osgi.service.resolver.BundleDescription;
28-
import org.eclipse.osgi.service.resolver.PlatformAdmin;
29-
import org.eclipse.osgi.service.resolver.State;
3027
import org.eclipse.osgi.util.NLS;
3128
import org.eclipse.ui.about.ISystemSummarySection;
3229
import org.eclipse.ui.internal.ide.IDEWorkbenchMessages;
30+
import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin;
31+
import org.osgi.framework.Bundle;
32+
import org.osgi.framework.BundleContext;
3333

3434
/**
3535
* Writes information about the update configurer into the system summary.
@@ -73,26 +73,24 @@ private void writeInstalledIUs(PrintWriter writer) {
7373
* Query OSGi and print out the list of known bundles.
7474
*/
7575
private void writeBundles(PrintWriter writer) {
76-
ServiceCaller.callOnce(getClass(), PlatformAdmin.class, (admin) -> {
77-
State state = admin.getState(false);
78-
// Since this code is only called in the Help -> About -> Configuration Details case we
79-
// won't worry too much about performance here and we will sort the query results
80-
// afterwards, but before printing them out.
81-
SortedSet<String> sorted = new TreeSet<>();
82-
for (BundleDescription bundle : state.getBundles()) {
83-
String name = bundle.getName();
84-
if (name == null)
85-
name = bundle.getLocation();
86-
String message = NLS.bind(IDEWorkbenchMessages.ConfigurationLogUpdateSection_bundle, new Object[] {name, bundle.getVersion(), bundle.getLocation()});
87-
sorted.add(message);
88-
}
89-
if (!sorted.isEmpty()) {
90-
writer.println(IDEWorkbenchMessages.ConfigurationLogUpdateSection_bundleHeader);
91-
writer.println();
92-
for (String string : sorted)
93-
writer.println(string);
94-
}
95-
});
76+
BundleContext bundleContext = IDEWorkbenchPlugin.getDefault().getBundle().getBundleContext();
77+
// Since this code is only called in the Help -> About -> Configuration Details case we
78+
// won't worry too much about performance here and we will sort the query results
79+
// afterwards, but before printing them out.
80+
SortedSet<String> sorted = new TreeSet<>();
81+
for (Bundle bundle : bundleContext.getBundles()) {
82+
String name = bundle.getSymbolicName();
83+
if (name == null)
84+
name = bundle.getLocation();
85+
String message = NLS.bind(IDEWorkbenchMessages.ConfigurationLogUpdateSection_bundle, new Object[] {name, bundle.getVersion(), bundle.getLocation()});
86+
sorted.add(message);
87+
}
88+
if (!sorted.isEmpty()) {
89+
writer.println(IDEWorkbenchMessages.ConfigurationLogUpdateSection_bundleHeader);
90+
writer.println();
91+
for (String string : sorted)
92+
writer.println(string);
93+
}
9694
}
9795

9896
@Override

0 commit comments

Comments
 (0)