diff options
-rw-r--r-- | bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/OperationFactory.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/OperationFactory.java b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/OperationFactory.java index e5769a594..c016de25b 100644 --- a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/OperationFactory.java +++ b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/OperationFactory.java @@ -123,14 +123,18 @@ public class OperationFactory { } /** - * Return the {@link IInstallableUnit} that are installed in the running instance of eclipse. + * Returns the {@link IInstallableUnit}s that are installed in the running instance of Eclipse. + * * @param rootsOnly set to true to return only the elements that have been explicitly installed (aka roots). * @param monitor the progress monitor - * @return the installable units installed + * @return the installable units installed, or an empty result if the installation profile of the running system + * cannot be accessed */ public IQueryResult<IInstallableUnit> listInstalledElements(boolean rootsOnly, IProgressMonitor monitor) { IProfileRegistry registry = (IProfileRegistry) getAgent().getService(IProfileRegistry.SERVICE_NAME); IProfile profile = registry.getProfile(IProfileRegistry.SELF); + if (profile == null) + return new CollectionResult<IInstallableUnit>(null); if (rootsOnly) return profile.query(new UserVisibleRootQuery(), monitor); return profile.query(QueryUtil.ALL_UNITS, monitor); |