Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Oberlies2015-02-11 18:07:56 +0000
committerTobias Oberlies2015-02-16 08:29:50 +0000
commitc3cdccddfd6fb7b164b216b605252b718004f6c3 (patch)
treecb968c68bc2aeeb37a691475275cf9c21dc6d3fa /bundles/org.eclipse.equinox.p2.publisher.eclipse
parentac896028a4cc69551aa137135fce3c06642016d5 (diff)
downloadrt.equinox.p2-c3cdccddfd6fb7b164b216b605252b718004f6c3.tar.gz
rt.equinox.p2-c3cdccddfd6fb7b164b216b605252b718004f6c3.tar.xz
rt.equinox.p2-c3cdccddfd6fb7b164b216b605252b718004f6c3.zip
373817 Add hasBundles and hasFeatures methods
... so that the check for ignored product file content does not call getBundles and getFeatures. This makes it easier to override the latter methods to also expand version references with 'qualifier' literals. Bug: 373817 Change-Id: I18591dfe5b8abd014889374b22686501d0173ef4
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.publisher.eclipse')
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/IProductDescriptor.java12
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/ProductFile.java10
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/ProductAction.java4
3 files changed, 23 insertions, 3 deletions
diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/IProductDescriptor.java b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/IProductDescriptor.java
index 87f7fd0a9..f3dc69b7f 100644
--- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/IProductDescriptor.java
+++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/IProductDescriptor.java
@@ -51,6 +51,11 @@ public interface IProductDescriptor {
public List<IVersionedId> getBundles(boolean includeFragments);
/**
+ * Returns <code>true</code> when <code>getBundles(includeFragments)</code> returns a non-empty list.
+ */
+ public boolean hasBundles(boolean includeFragments);
+
+ /**
* Returns the fragments listed in the product.
* @see #useFeatures()
*/
@@ -63,6 +68,11 @@ public interface IProductDescriptor {
public List<IVersionedId> getFeatures();
/**
+ * Returns <code>true</code> when <code>getFeatures()</code> returns a non-empty list.
+ */
+ public boolean hasFeatures();
+
+ /**
* Returns the features listed in the product. Note: These features are only part of
* the product if {@link #useFeatures()} returns <code>true</code>.
* @param options bitmask to indicate what kind of features to return.
@@ -188,4 +198,4 @@ public interface IProductDescriptor {
*/
public List<IRepositoryReference> getRepositoryEntries();
-} \ No newline at end of file
+}
diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/ProductFile.java b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/ProductFile.java
index 109837b64..71816dc1e 100644
--- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/ProductFile.java
+++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/ProductFile.java
@@ -361,6 +361,11 @@ public class ProductFile extends DefaultHandler implements IProductDescriptor {
return result;
}
+ public boolean hasBundles(boolean includeFragments) {
+ // implement directly; don't call the potentially overridden getBundles
+ return !plugins.isEmpty() || (includeFragments && !fragments.isEmpty());
+ }
+
private List<FeatureEntry> getBundleEntries(boolean includeFragments) {
List<FeatureEntry> result = new LinkedList<FeatureEntry>();
result.addAll(plugins);
@@ -398,6 +403,11 @@ public class ProductFile extends DefaultHandler implements IProductDescriptor {
return getFeatures(INCLUDED_FEATURES);
}
+ public boolean hasFeatures() {
+ // implement directly; don't call the potentially overridden getFeatures
+ return !features.isEmpty();
+ }
+
public List<IVersionedId> getFeatures(int options) {
List<IVersionedId> result = new LinkedList<IVersionedId>();
diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/ProductAction.java b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/ProductAction.java
index 650f1dd3c..edaa26842 100644
--- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/ProductAction.java
+++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/ProductAction.java
@@ -136,14 +136,14 @@ public class ProductAction extends AbstractPublisherAction {
case FEATURES : // include features only
list = versionElements(listElements(product.getFeatures(), ".feature.group"), IInstallableUnit.NAMESPACE_IU_ID); //$NON-NLS-1$
- if (!product.getBundles(true).isEmpty()) {
+ if (product.hasBundles(true)) {
finalStatus.add(new Status(IStatus.INFO, Activator.ID, Messages.bundlesInProductFileIgnored));
}
break;
case BUNDLES : // include bundles only
list = versionElements(listElements(product.getBundles(true), null), IInstallableUnit.NAMESPACE_IU_ID);
- if (!product.getFeatures().isEmpty()) {
+ if (product.hasFeatures()) {
finalStatus.add(new Status(IStatus.INFO, Activator.ID, Messages.featuresInProductFileIgnored));
}
break;

Back to the top