Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Kaegi2009-03-13 02:13:21 +0000
committerSimon Kaegi2009-03-13 02:13:21 +0000
commit24aa98be64bc237f9723c3f2d3544bfbaa59414a (patch)
tree010ca5bfd6c52679a130646f436493e6d582954d /bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/PublisherUtil.java
parentb4b3442262a5a9d99aac992595ccee6a26a62478 (diff)
downloadrt.equinox.p2-24aa98be64bc237f9723c3f2d3544bfbaa59414a.tar.gz
rt.equinox.p2-24aa98be64bc237f9723c3f2d3544bfbaa59414a.tar.xz
rt.equinox.p2-24aa98be64bc237f9723c3f2d3544bfbaa59414a.zip
Bug 262331 [eclipse] EclipseTouchpoint requires publisher
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/PublisherUtil.java')
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/PublisherUtil.java26
1 files changed, 26 insertions, 0 deletions
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/PublisherUtil.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/PublisherUtil.java
new file mode 100644
index 000000000..a0913f030
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/PublisherUtil.java
@@ -0,0 +1,26 @@
+package org.eclipse.equinox.internal.p2.touchpoint.eclipse;
+
+import java.io.File;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.equinox.internal.provisional.p2.core.Version;
+import org.eclipse.equinox.internal.provisional.p2.metadata.IArtifactKey;
+import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.publisher.PublisherInfo;
+import org.eclipse.equinox.p2.publisher.eclipse.*;
+import org.eclipse.osgi.service.resolver.BundleDescription;
+
+public class PublisherUtil {
+
+ public static IInstallableUnit createBundleIU(IArtifactKey artifactKey, File bundleFile) {
+ BundleDescription bundleDescription = BundlesAction.createBundleDescription(bundleFile);
+ PublisherInfo info = new PublisherInfo();
+ Version version = new Version(bundleDescription.getVersion().toString());
+ AdviceFileAdvice advice = new AdviceFileAdvice(bundleDescription.getSymbolicName(), version, new Path(bundleFile.getAbsolutePath()), AdviceFileAdvice.BUNDLE_ADVICE_FILE);
+ if (advice.containsAdvice())
+ info.addAdvice(advice);
+ String shape = bundleFile.isDirectory() ? IBundleShapeAdvice.DIR : IBundleShapeAdvice.JAR;
+ info.addAdvice(new BundleShapeAdvice(bundleDescription.getSymbolicName(), version, shape));
+ return BundlesAction.createBundleIU(bundleDescription, artifactKey, info);
+ }
+
+}

Back to the top