diff options
author | Andrew Niefer | 2009-03-09 22:37:22 +0000 |
---|---|---|
committer | Andrew Niefer | 2009-03-09 22:37:22 +0000 |
commit | 096f18ff5d9c09b6e443bff2fe816ace6b63d2c1 (patch) | |
tree | 731867c59e597b7f263917169c95fdf9a992e38c /bundles | |
parent | f5e186871c762ed1760f225ea462cc37699087cb (diff) | |
download | rt.equinox.p2-096f18ff5d9c09b6e443bff2fe816ace6b63d2c1.tar.gz rt.equinox.p2-096f18ff5d9c09b6e443bff2fe816ace6b63d2c1.tar.xz rt.equinox.p2-096f18ff5d9c09b6e443bff2fe816ace6b63d2c1.zip |
bug 267461 - use product uid attributev20090309-1845
Diffstat (limited to 'bundles')
6 files changed, 92 insertions, 3 deletions
diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/internal/p2/metadata/generator/features/ProductFile.java b/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/internal/p2/metadata/generator/features/ProductFile.java index a87555836..fd1e55017 100644 --- a/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/internal/p2/metadata/generator/features/ProductFile.java +++ b/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/internal/p2/metadata/generator/features/ProductFile.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2008 IBM Corporation and others. + * Copyright (c) 2005, 2009 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -92,6 +92,7 @@ public class ProductFile extends DefaultHandler { private String platformConfigPath = null; private String launcherName = null; private String id = null; + private String uid = null; private boolean useFeatures = false; private List plugins = null; private List fragments = null; @@ -154,6 +155,12 @@ public class ProductFile extends DefaultHandler { } public String getId() { + if (uid != null) + return uid; + return id; + } + + public String getProductId() { return id; } @@ -415,6 +422,7 @@ public class ProductFile extends DefaultHandler { private void processProduct(Attributes attributes) { id = attributes.getValue("id"); //$NON-NLS-1$ + uid = attributes.getValue("uid"); //$NON-NLS-1$ productName = attributes.getValue("name"); //$NON-NLS-1$ String use = attributes.getValue("useFeatures"); //$NON-NLS-1$ if (use != null) diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/eclipse/IProductDescriptor.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/eclipse/IProductDescriptor.java index 63e551fea..e4a742a0e 100644 --- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/eclipse/IProductDescriptor.java +++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/eclipse/IProductDescriptor.java @@ -56,6 +56,16 @@ public interface IProductDescriptor { public String getId(); /** + * Returns the Product extension point ID + */ + public String getProductId(); + + /** + * Returns the Applicaiton extension point ID + */ + public String getApplication(); + + /** * Returns the ID of the bundle in which the splash screen resides. */ public String getSplashLocation(); diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/eclipse/ProductFile.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/eclipse/ProductFile.java index b71c34153..cf2f67dec 100644 --- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/eclipse/ProductFile.java +++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/eclipse/ProductFile.java @@ -38,6 +38,7 @@ public class ProductFile extends DefaultHandler implements IProductDescriptor { private static final String ATTRIBUTE_START_LEVEL = "startLevel"; //$NON-NLS-1$ private static final String ATTRIBUTE_VERSION = "version"; //$NON-NLS-1$ private static final String ATTRIBUTE_ID = "id"; //$NON-NLS-1$ + private static final String ATTRIBUTE_UID = "uid"; //$NON-NLS-1$ private static final String PROPERTY_ECLIPSE_APPLICATION = "eclipse.application"; //$NON-NLS-1$ private static final String PROPERTY_ECLIPSE_PRODUCT = "eclipse.product"; //$NON-NLS-1$ @@ -116,6 +117,7 @@ public class ProductFile extends DefaultHandler implements IProductDescriptor { private String configPlatform = null; private String platformConfigPath = null; private String id = null; + private String uid = null; private boolean useFeatures = false; private List plugins = null; private List fragments = null; @@ -265,6 +267,12 @@ public class ProductFile extends DefaultHandler implements IProductDescriptor { * Returns the ID for this product. */ public String getId() { + if (uid != null) + return uid; + return id; + } + + public String getProductId() { return id; } @@ -607,6 +615,7 @@ public class ProductFile extends DefaultHandler implements IProductDescriptor { private void processProduct(Attributes attributes) { id = attributes.getValue(ATTRIBUTE_ID); + uid = attributes.getValue(ATTRIBUTE_UID); productName = attributes.getValue(ATTRIBUTE_NAME); application = attributes.getValue(ATTRIBUTE_APPLICATION); String use = attributes.getValue("useFeatures"); //$NON-NLS-1$ diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/ProductFileAdvice.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/ProductFileAdvice.java index 4f637775c..ceadd3af1 100644 --- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/ProductFileAdvice.java +++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/ProductFileAdvice.java @@ -142,10 +142,13 @@ public class ProductFileAdvice extends AbstractAdvice implements IExecutableAdvi addProductFileBundles(result); // these are the bundles specified in the <plugins/> tag addProductFileConfigBundles(result); // these are the bundles specified in the <configurations> tag in the product file - result.setProperty("eclipse.product", product.getId()); //$NON-NLS-1$ + if (product.getProductId() != null) + result.setProperty("eclipse.product", product.getProductId()); //$NON-NLS-1$ + if (product.getApplication() != null) + result.setProperty("eclipse.application", product.getApplication()); //$NON-NLS-1$ String location = getSplashLocation(); if (location != null) - result.setProperty(OSGI_SPLASH_PATH, SPLASH_PREFIX + location); //$NON-NLS-1$ + result.setProperty(OSGI_SPLASH_PATH, SPLASH_PREFIX + location); return result; } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductFileTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductFileTest.java index 3e684c5c3..68c7061f3 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductFileTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductFileTest.java @@ -27,10 +27,14 @@ public class ProductFileTest extends TestCase { ProductFile productFile = null; String configFile = "/org.eclipse.equinox.p2.tests/testData/ProductActionTest/productWithConfig/config.ini"; + private String uidProductFileLocation; + private ProductFile uidProductFile; protected void setUp() throws Exception { productFileLocation = TestData.getFile("ProductActionTest/productWithConfig", "sample.product").toString(); productFile = new ProductFile(productFileLocation); + uidProductFileLocation = TestData.getFile("ProductActionTest/productWithConfig", "uidproduct.product").toString(); + uidProductFile = new ProductFile(uidProductFileLocation); } /** @@ -127,6 +131,11 @@ public class ProductFileTest extends TestCase { assertEquals("1.0", "test.product", id); } + public void testGetUID() { + String id = uidProductFile.getId(); + assertEquals("1.0", "UID.test.product", id); + } + /** * Test method for {@link org.eclipse.equinox.internal.p2.publisher.eclipse.ProductFile#getSplashLocation()}. */ diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/ProductActionTest/productWithConfig/uidproduct.product b/bundles/org.eclipse.equinox.p2.tests/testData/ProductActionTest/productWithConfig/uidproduct.product new file mode 100644 index 000000000..b62a7afe3 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.tests/testData/ProductActionTest/productWithConfig/uidproduct.product @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?pde version="3.5"?> + +<product name="aaTestProduct" id="UID.test.product" application="test.app" version="1" useFeatures="false"> + + <configIni use="default"> + <win32>config.ini</win32> + </configIni> + + <launcherArgs> + <programArgs>programArg</programArgs> + <vmArgs>vmArg</vmArgs> + <vmArgsMac>-XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts</vmArgsMac> + </launcherArgs> + + <windowImages/> + + <splash + location="org.eclipse.equinox.p2.tests" + startupProgressRect="5,275,445,15" + startupMessageRect="7,252,445,20" + startupForegroundColor="000000" /> + <launcher name="sample"> + <solaris/> + <win useIco="false"> + <bmp + winSmallLow="test/icon.bmp"/> + </win> + </launcher> + + <vm> + </vm> + + <plugins> + <plugin id="org.eclipse.core.runtime" version="1.0.4"/> + <plugin id="org.eclipse.swt.win32.win32.x86" fragment="true"/> + </plugins> + + <features> + <feature id="org.eclipse.rcp" version="3.5.0.v20081110-9C9tEvNEla71LZ2jFz-RFB-t"/> + </features> + + <configurations> + <plugin id="org.eclipse.core.runtime" autoStart="true" startLevel="2" /> + <property name = "foo" value="bar"/> + <property name = "foo1" /> + <property value="bar1"/> + </configurations> + +</product> |