Support for IProduct
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/InternalPlatform.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/InternalPlatform.java
index 781e4aa..91aca0d 100644
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/InternalPlatform.java
+++ b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/InternalPlatform.java
@@ -1293,10 +1293,10 @@
public IProduct getProduct() {
if (product != null)
return product;
- String productId = System.getProperty("eclipse.product");
+ String productId = System.getProperty(PROP_PRODUCT);
if (productId == null)
return null;
- IConfigurationElement[] entries = getRegistry().getConfigurationElementsFor(PI_RUNTIME, "products", productId);
+ IConfigurationElement[] entries = getRegistry().getConfigurationElementsFor(PI_RUNTIME, IPlatform.PT_PRODUCT, productId);
if (entries == null || entries.length == 0)
return null;
// There should only be one product with the given id so just take the first element
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/PlatformActivator.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/PlatformActivator.java
index f1503e3..13a08a0 100644
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/PlatformActivator.java
+++ b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/PlatformActivator.java
@@ -27,6 +27,9 @@
* Activator for the Eclipse runtime.
*/
public class PlatformActivator extends Plugin implements BundleActivator {
+ private static final String PROP_ECLIPSE_EXITCODE = "eclipse.exitcode"; //$NON-NLS-1$
+ private static final String PROP_ECLIPSE_APPLICATION = "eclipse.application"; //$NON-NLS-1$
+
private static BundleContext context;
private EclipseBundleListener pluginBundleListener;
private ExtensionRegistry registry;
@@ -217,8 +220,17 @@
public void run() {
IPlatformRunnable application = null;
String applicationId = null;
- try {
- applicationId = System.getProperty("eclipse.application");
+ try {
+ applicationId = System.getProperty(PROP_ECLIPSE_APPLICATION);
+ if (applicationId == null) {
+ //Derive the application from the product information
+ IProduct product = InternalPlatform.getDefault().getProduct();
+ if (product != null) {
+ applicationId = product.getApplication();
+ System.setProperty(PROP_ECLIPSE_APPLICATION, applicationId);
+ }
+ }
+
IExtension applicationExtension = registry.getExtension(IPlatform.PI_RUNTIME, IPlatform.PT_APPLICATIONS, applicationId);
if (applicationExtension == null)
throw new RuntimeException("Unable to locate application extension: " + applicationId);
@@ -244,7 +256,7 @@
try {
Object result = application.run(InternalPlatform.getDefault().getAppArgs());
int exitCode = result instanceof Integer ? ((Integer) result).intValue() : 0;
- System.setProperty("eclipse.exitcode", Integer.toString(exitCode)); //$NON-NLS-1$
+ System.setProperty(PROP_ECLIPSE_EXITCODE, Integer.toString(exitCode)); //$NON-NLS-1$
if (InternalPlatform.DEBUG)
System.out.println(Policy.bind("application.returned", new String[] { applicationId, Integer.toString(exitCode)})); //$NON-NLS-1$
} catch (Exception e) {
@@ -258,7 +270,7 @@
}
};
Hashtable properties = new Hashtable(1);
- properties.put("eclipse.application", "default"); //$NON-NLS-1$ //$NON-NLS-2$
+ properties.put(PROP_ECLIPSE_APPLICATION, "default"); //$NON-NLS-1$ //$NON-NLS-2$
context.registerService("java.lang.Runnable", work, properties);
}
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/Product.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/Product.java
index 735ca31..046a530 100644
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/Product.java
+++ b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/Product.java
@@ -16,10 +16,10 @@
import org.eclipse.core.runtime.IProduct;
public class Product implements IProduct {
- private static final String ATTR_DESCRIPTION = "description";
- private static final String ATTR_ID = "id";
- private static final String ATTR_NAME = "name";
- private static final String ATTR_APPLICATION = "application";
+ private static final String ATTR_DESCRIPTION = "description"; //$NON-NLS-1$
+ private static final String ATTR_ID = "id"; //$NON-NLS-1$
+ private static final String ATTR_NAME = "name"; //$NON-NLS-1$
+ private static final String ATTR_APPLICATION = "application"; //$NON-NLS-1$
String application = null;
String name = null;
String id = null;
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IPlatform.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IPlatform.java
index e39dac6..b678c59 100644
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IPlatform.java
+++ b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/IPlatform.java
@@ -88,6 +88,17 @@
public static final String PT_SHUTDOWN_HOOK = "applicationShutdownHook"; //$NON-NLS-1$
/**
+ * The simple identifier constant (value "<code>products</code>") of
+ * the extension point of the Core Runtime plug-in where plug-ins declare
+ * the existence of a product. A plug-in may define any
+ * number of products; however, the platform is only capable
+ * of running one product at a time.
+ *
+ * @see org.eclipse.core.runtime.Platform#getProduct()
+ * @since 3.0
+ */
+ public static final String PT_PRODUCT = "products"; //$NON-NLS-1$
+ /**
* Status code constant (value 1) indicating a problem in a plug-in
* manifest (<code>plugin.xml</code>) file.
*/
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/Platform.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/Platform.java
index dc42123..2c3f8eb 100644
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/Platform.java
+++ b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/runtime/Platform.java
@@ -58,7 +58,6 @@
* number of applications; however, the platform is only capable
* of running one application at a time.
*
- * @see org.eclipse.core.boot.BootLoader#run
*/
public static final String PT_APPLICATIONS = "applications"; //$NON-NLS-1$
@@ -74,6 +73,17 @@
public static final String PT_ADAPTERS = "adapters"; //$NON-NLS-1$
/**
+ * The simple identifier constant (value "<code>products</code>") of
+ * the extension point of the Core Runtime plug-in where plug-ins declare
+ * the existence of a product. A plug-in may define any
+ * number of products; however, the platform is only capable
+ * of running one product at a time.
+ *
+ * @see org.eclipse.core.runtime.Platform#getProduct()
+ * @since 3.0
+ */
+ public static final String PT_PRODUCT = "products"; //$NON-NLS-1$
+ /**
* Debug option value denoting the time at which the platform runtime
* was started. This constant can be used in conjunction with
* <code>getDebugOption</code> to find the string value of