diff options
author | Todor Boev | 2017-05-05 14:03:05 +0000 |
---|---|---|
committer | Alexander Kurtakov | 2017-08-22 06:53:33 +0000 |
commit | 2fcf9baa76e556a3da92b035f0128a6e02bc5bb5 (patch) | |
tree | 17d3a2d2b409b67329e8aec8222166f99c7953cc | |
parent | 32ddfb708c99129fae3179d50f8f5cced264ca56 (diff) | |
download | rt.equinox.p2-2fcf9baa76e556a3da92b035f0128a6e02bc5bb5.tar.gz rt.equinox.p2-2fcf9baa76e556a3da92b035f0128a6e02bc5bb5.tar.xz rt.equinox.p2-2fcf9baa76e556a3da92b035f0128a6e02bc5bb5.zip |
Bug 486279 - Added a utility method to search for BundleInfo
Added a utility method to search for BundleInfo entries by name/version
rather than by Object.equals()
Change-Id: Ib31c8672834e7beaa274d68e20065acef9a31f11
Signed-off-by: Todor Boev <rinsvind@gmail.com>
-rw-r--r-- | bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/Util.java | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/Util.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/Util.java index 52d27b2dc..0f803ccdd 100644 --- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/Util.java +++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/Util.java @@ -22,6 +22,7 @@ import org.eclipse.core.runtime.*; import org.eclipse.equinox.frameworkadmin.BundleInfo; import org.eclipse.equinox.internal.p2.core.helpers.*; import org.eclipse.equinox.internal.p2.metadata.IRequiredCapability; +import org.eclipse.equinox.internal.provisional.frameworkadmin.ConfigData; import org.eclipse.equinox.p2.core.*; import org.eclipse.equinox.p2.engine.IProfile; import org.eclipse.equinox.p2.metadata.*; @@ -206,6 +207,23 @@ public class Util { return bundleInfo; } + public static BundleInfo findBundleInfo(ConfigData config, IInstallableUnit unit) { + // Construct a partial BundleInfo from the IU capabilities. + BundleInfo bundleInfo = Util.createBundleInfo(null, unit); + + // Find the actual fully populated BundleInfo used by the runtime. + BundleInfo[] bundles = config.getBundles(); + for (BundleInfo bundle : bundles) { + // Can't use BundleInfol.equals(), because bundleInfo is only partially populated. + if (bundleInfo.getSymbolicName().equals(bundle.getSymbolicName()) + && bundleInfo.getVersion().equals(bundle.getVersion())) { + return bundle; + } + } + + return null; + } + private static String getFragmentHost(IInstallableUnit unit, String fragmentName) { Collection<IRequirement> requires = unit.getRequirements(); for (IRequirement iRequirement : requires) { |