Author: yradtsevich
Date: 2011-11-15 09:24:53 -0500 (Tue, 15 Nov 2011)
New Revision: 36347
Modified:
workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim.eclipse/src/org/jboss/tools/browsersim/eclipse/util/BrowserSimLauncher.java
workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim.webkit/src/org/jboss/tools/browsersim/webkit/PlatformUtil.java
workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/BrowserSim.java
Log:
https://issues.jboss.org/browse/JBIDE-9539 : Browsersim app for testing mobile/desktop web
apps
- added detection of used platform
Modified:
workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/BrowserSim.java
===================================================================
---
workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/BrowserSim.java 2011-11-15
13:07:09 UTC (rev 36346)
+++
workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/BrowserSim.java 2011-11-15
14:24:53 UTC (rev 36347)
@@ -66,6 +66,10 @@
private DevicesManager devicesManager;
public static void main(String[] args) {
+
+
+
+
String initialUrl;
if (args.length > 0) {
String lastArg = args[args.length - 1];
Modified:
workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim.eclipse/src/org/jboss/tools/browsersim/eclipse/util/BrowserSimLauncher.java
===================================================================
---
workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim.eclipse/src/org/jboss/tools/browsersim/eclipse/util/BrowserSimLauncher.java 2011-11-15
13:07:09 UTC (rev 36346)
+++
workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim.eclipse/src/org/jboss/tools/browsersim/eclipse/util/BrowserSimLauncher.java 2011-11-15
14:24:53 UTC (rev 36347)
@@ -13,7 +13,6 @@
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
-import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
@@ -41,11 +40,7 @@
commandElements.add("-d32");
}
}
- commandElements.add("-Dosgi.os=" + Platform.getOS());
- commandElements.add("-Dosgi.arch=" + Platform.getOSArch());
- if (Platform.getWS() != null) {
- commandElements.add("-Dosgi.ws=" + Platform.getWS());
- }
+
commandElements.add("-cp");
commandElements.add(classPath);
commandElements.add("org.jboss.tools.browsersim.BrowserSim");
Modified:
workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim.webkit/src/org/jboss/tools/browsersim/webkit/PlatformUtil.java
===================================================================
---
workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim.webkit/src/org/jboss/tools/browsersim/webkit/PlatformUtil.java 2011-11-15
13:07:09 UTC (rev 36346)
+++
workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim.webkit/src/org/jboss/tools/browsersim/webkit/PlatformUtil.java 2011-11-15
14:24:53 UTC (rev 36347)
@@ -10,6 +10,8 @@
******************************************************************************/
package org.jboss.tools.browsersim.webkit;
+import org.eclipse.swt.SWT;
+
/**
* @author "Yahor Radtsevich (yradtsevich)"
*/
@@ -17,13 +19,41 @@
public static final String CURRENT_PLATFORM;
static {
- String ws = System.getProperty("osgi.ws");
- ws = (ws == null) ? "" : ws;
- String os = System.getProperty("osgi.os");
- os = (os == null) ? "" : os;
- String arch = System.getProperty("osgi.arch");
- arch = (arch == null) ? "" : arch;
-
+ String os = getOs();
+ String ws = getWs();
+ String arch = getArch();
+
CURRENT_PLATFORM = ws + '.' + os + ("macosx".equals(os) ?
"" : '.' + arch);
}
+
+
+ /*
+ * Copy of org.eclipse.swt.internal.Library.arch()
+ */
+ private static String getArch() {
+ String osArch = System.getProperty("os.arch"); //$NON-NLS-1$
+ if (osArch.equals ("i386") || osArch.equals ("i686")) return
"x86"; //$NON-NLS-1$ $NON-NLS-2$ $NON-NLS-3$
+ if (osArch.equals ("amd64")) return "x86_64"; //$NON-NLS-1$
$NON-NLS-2$
+ if (osArch.equals ("IA64N")) return "ia64_32"; //$NON-NLS-1$
$NON-NLS-2$
+ if (osArch.equals ("IA64W")) return "ia64"; //$NON-NLS-1$
$NON-NLS-2$
+ return osArch;
+ }
+
+ /*
+ * Copy of org.eclipse.swt.internal.Library.os()
+ */
+ private static String getOs() {
+ String osName = System.getProperty("os.name"); //$NON-NLS-1$
+ if (osName.equals ("Linux")) return "linux"; //$NON-NLS-1$
$NON-NLS-2$
+ if (osName.equals ("AIX")) return "aix"; //$NON-NLS-1$ $NON-NLS-2$
+ if (osName.equals ("Solaris") || osName.equals ("SunOS")) return
"solaris"; //$NON-NLS-1$ $NON-NLS-2$ $NON-NLS-3$
+ if (osName.equals ("HP-UX")) return "hpux"; //$NON-NLS-1$
$NON-NLS-2$
+ if (osName.equals ("Mac OS X")) return "macosx"; //$NON-NLS-1$
$NON-NLS-2$
+ if (osName.startsWith ("Win")) return "win32"; //$NON-NLS-1$
$NON-NLS-2$
+ return osName;
+ }
+
+ private static String getWs() {
+ return SWT.getPlatform();
+ }
}