Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2008-02-19 18:17:02 +0000
committerThomas Watson2008-02-19 18:17:02 +0000
commitb6ff1309b02d4a49e0585b364f5ed0dccf264280 (patch)
tree4be83c63b1fb984ebbcf0bcb629191397ae2be12 /bundles/org.eclipse.equinox.app/src
parentc234ea4d1d06e2ba8d4a982514daae46cac8015d (diff)
downloadrt.equinox.bundles-b6ff1309b02d4a49e0585b364f5ed0dccf264280.tar.gz
rt.equinox.bundles-b6ff1309b02d4a49e0585b364f5ed0dccf264280.tar.xz
rt.equinox.bundles-b6ff1309b02d4a49e0585b364f5ed0dccf264280.zip
Use EnvironmentInfo to set exitcode property.
Diffstat (limited to 'bundles/org.eclipse.equinox.app/src')
-rwxr-xr-xbundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/Activator.java25
-rwxr-xr-xbundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/EclipseAppHandle.java7
2 files changed, 24 insertions, 8 deletions
diff --git a/bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/Activator.java b/bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/Activator.java
index 801a8c8c1..748b263bf 100755
--- a/bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/Activator.java
+++ b/bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/Activator.java
@@ -91,15 +91,24 @@ public class Activator implements BundleActivator, ServiceTrackerCustomizer {
context.ungetService(debugRef);
}
- private void processCommandLineArgs(BundleContext bc) {
+ private static EnvironmentInfo getEnvironmentInfo() {
+ BundleContext bc = Activator.getContext();
+ if (bc == null)
+ return null;
ServiceReference infoRef = bc.getServiceReference(EnvironmentInfo.class.getName());
if (infoRef == null)
- return;
+ return null;
EnvironmentInfo envInfo = (EnvironmentInfo) bc.getService(infoRef);
if (envInfo == null)
- return;
+ return null;
bc.ungetService(infoRef);
- CommandLineArgs.processCommandLine(envInfo);
+ return envInfo;
+ }
+
+ private void processCommandLineArgs(BundleContext bc) {
+ EnvironmentInfo envInfo = Activator.getEnvironmentInfo();
+ if (envInfo != null)
+ CommandLineArgs.processCommandLine(envInfo);
}
public Object addingService(ServiceReference reference) {
@@ -225,4 +234,12 @@ public class Activator implements BundleActivator, ServiceTrackerCustomizer {
if (log != null)
log.log(entry);
}
+
+ static void setProperty(String key, String value) {
+ EnvironmentInfo envInfo = getEnvironmentInfo();
+ if (envInfo != null)
+ envInfo.setProperty(key, value);
+ else
+ System.getProperties().setProperty(key, value);
+ }
}
diff --git a/bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/EclipseAppHandle.java b/bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/EclipseAppHandle.java
index 878aba591..9789be5b4 100755
--- a/bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/EclipseAppHandle.java
+++ b/bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/EclipseAppHandle.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 2008 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
@@ -207,9 +207,8 @@ public class EclipseAppHandle extends ApplicationHandle implements ApplicationRu
// only set the exit code property if this is the default application
if (isDefault()) {
int exitCode = tempResult instanceof Integer ? ((Integer) tempResult).intValue() : 0;
- // use the long way to set the property to compile against eeminimum
- // TODO strange that this is done here instead of by EclipseStarter
- System.getProperties().setProperty(PROP_ECLIPSE_EXITCODE, Integer.toString(exitCode));
+ // Use the EnvironmentInfo Service to set properties
+ Activator.setProperty(PROP_ECLIPSE_EXITCODE, Integer.toString(exitCode));
}
if (Activator.DEBUG)
System.out.println(NLS.bind(Messages.application_returned, (new String[] {getApplicationDescriptor().getApplicationId(), tempResult == null ? "null" : tempResult.toString()}))); //$NON-NLS-1$

Back to the top