diff options
author | Eike Stepper | 2011-08-03 08:31:17 +0000 |
---|---|---|
committer | Eike Stepper | 2011-08-03 08:31:17 +0000 |
commit | b07671015f701c31a81ce190c586c983cdb174ee (patch) | |
tree | 71e81e55d7a50cb16f69ebc4053cdecf2410dcc3 | |
parent | 2bc5d232450829e7efca6ef9c342498dae2c5795 (diff) | |
download | cdo-b07671015f701c31a81ce190c586c983cdb174ee.tar.gz cdo-b07671015f701c31a81ce190c586c983cdb174ee.tar.xz cdo-b07671015f701c31a81ce190c586c983cdb174ee.zip |
[347381] OMPlatform should provide the command line args of an application
https://bugs.eclipse.org/bugs/show_bug.cgi?id=347381
4 files changed, 46 insertions, 0 deletions
diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/LegacyPlatform.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/LegacyPlatform.java index e71c29d108..d06f0bd06f 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/LegacyPlatform.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/LegacyPlatform.java @@ -11,6 +11,7 @@ package org.eclipse.net4j.internal.util.om; import org.eclipse.net4j.internal.util.bundle.AbstractPlatform; +import org.eclipse.net4j.util.om.LegacyUtil; import org.eclipse.net4j.util.om.OMBundle; import java.util.Map; @@ -49,4 +50,9 @@ public class LegacyPlatform extends AbstractPlatform { debugOptions.put(bundleID + "/" + option, value); //$NON-NLS-1$ } + + public String[] getCommandLineArgs() + { + return LegacyUtil.getCommandLineArgs(); + } } diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/OSGiPlatform.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/OSGiPlatform.java index 0741c702d2..025cb7aa95 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/OSGiPlatform.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/OSGiPlatform.java @@ -57,6 +57,16 @@ public class OSGiPlatform extends AbstractPlatform return property != null ? property : defaultValue; } + public String[] getCommandLineArgs() + { + return Platform.getCommandLineArgs(); + } + + public void setCommandLineArgs(String[] args) + { + throw new UnsupportedOperationException("Set command line arguements inside the OSGi enviorment is not needed."); + } + @Override protected OMBundle createBundle(String bundleID, Class<?> accessor) { diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/LegacyUtil.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/LegacyUtil.java index f5b805ea2a..a9839f3fb1 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/LegacyUtil.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/LegacyUtil.java @@ -17,10 +17,35 @@ import org.eclipse.net4j.internal.util.om.LegacyBundle; */ public final class LegacyUtil { + private static final String[] UNINITIALIZED = {}; + + private static String[] commandLineArgs = UNINITIALIZED; + private LegacyUtil() { } + /** + * @since 3.2 + */ + public static String[] getCommandLineArgs() throws IllegalStateException + { + if (commandLineArgs == UNINITIALIZED) + { + throw new IllegalStateException("Command line argumentshave not been set"); + } + + return commandLineArgs; + } + + /** + * @since 3.2 + */ + public static void setCommandLineArgs(String[] commandLineArgs) + { + LegacyUtil.commandLineArgs = commandLineArgs; + } + public static void startBundles(OMBundle[] bundles) throws Exception { for (int i = 0; i < bundles.length; i++) diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/OMPlatform.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/OMPlatform.java index d309934ee0..0e13dd1de2 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/OMPlatform.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/OMPlatform.java @@ -65,4 +65,9 @@ public interface OMPlatform * @since 3.0 */ public String getProperty(String key, String defaultValue); + + /** + * @since 3.2 + */ + public String[] getCommandLineArgs() throws IllegalStateException; } |