Author: yradtsevich
Date: 2011-10-26 07:45:06 -0400 (Wed, 26 Oct 2011)
New Revision: 36007
Added:
workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim.webkit.gtk.linux.x86_64/
workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim.webkit.gtk.linux.x86_64/.classpath
workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim.webkit.gtk.linux.x86_64/.project
workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim.webkit.gtk.linux.x86_64/.settings/
workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim.webkit.gtk.linux.x86_64/.settings/org.eclipse.jdt.core.prefs
workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim.webkit.gtk.linux.x86_64/.settings/org.eclipse.pde.core.prefs
workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim.webkit.gtk.linux.x86_64/META-INF/
workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim.webkit.gtk.linux.x86_64/META-INF/MANIFEST.MF
workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim.webkit.gtk.linux.x86_64/build.properties
workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim.webkit.gtk.linux.x86_64/src/
workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim.webkit.gtk.linux.x86_64/src/org/
workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim.webkit.gtk.linux.x86_64/src/org/jboss/
workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim.webkit.gtk.linux.x86_64/src/org/jboss/tools/
workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim.webkit.gtk.linux.x86_64/src/org/jboss/tools/browsersim/
workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim.webkit.gtk.linux.x86_64/src/org/jboss/tools/browsersim/webkit/
workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim.webkit.gtk.linux.x86_64/src/org/jboss/tools/browsersim/webkit/WebKitBrowser.java
Log:
https://issues.jboss.org/browse/JBIDE-9539 : Browsersim app for testing mobile/desktop web
apps
- added Linux x86_64 fragment
Property changes on:
workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim.webkit.gtk.linux.x86_64
___________________________________________________________________
Added: svn:ignore
+ bin
Added:
workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim.webkit.gtk.linux.x86_64/.classpath
===================================================================
---
workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim.webkit.gtk.linux.x86_64/.classpath
(rev 0)
+++
workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim.webkit.gtk.linux.x86_64/.classpath 2011-10-26
11:45:06 UTC (rev 36007)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con"
path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added:
workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim.webkit.gtk.linux.x86_64/.project
===================================================================
---
workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim.webkit.gtk.linux.x86_64/.project
(rev 0)
+++
workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim.webkit.gtk.linux.x86_64/.project 2011-10-26
11:45:06 UTC (rev 36007)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.browsersim.webkit.gtk.linux.x86_64</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added:
workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim.webkit.gtk.linux.x86_64/.settings/org.eclipse.jdt.core.prefs
===================================================================
---
workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim.webkit.gtk.linux.x86_64/.settings/org.eclipse.jdt.core.prefs
(rev 0)
+++
workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim.webkit.gtk.linux.x86_64/.settings/org.eclipse.jdt.core.prefs 2011-10-26
11:45:06 UTC (rev 36007)
@@ -0,0 +1,12 @@
+#Wed Oct 26 14:35:24 EEST 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
Added:
workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim.webkit.gtk.linux.x86_64/.settings/org.eclipse.pde.core.prefs
===================================================================
---
workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim.webkit.gtk.linux.x86_64/.settings/org.eclipse.pde.core.prefs
(rev 0)
+++
workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim.webkit.gtk.linux.x86_64/.settings/org.eclipse.pde.core.prefs 2011-10-26
11:45:06 UTC (rev 36007)
@@ -0,0 +1,4 @@
+#Wed Oct 26 14:30:24 EEST 2011
+eclipse.preferences.version=1
+pluginProject.extensions=false
+resolve.requirebundle=false
Added:
workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim.webkit.gtk.linux.x86_64/META-INF/MANIFEST.MF
===================================================================
---
workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim.webkit.gtk.linux.x86_64/META-INF/MANIFEST.MF
(rev 0)
+++
workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim.webkit.gtk.linux.x86_64/META-INF/MANIFEST.MF 2011-10-26
11:45:06 UTC (rev 36007)
@@ -0,0 +1,8 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: WebKit
+Bundle-SymbolicName: org.jboss.tools.browsersim.webkit.gtk.linux.x86_64;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Fragment-Host: org.jboss.tools.browsersim.webkit;bundle-version="1.0.0"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Eclipse-PlatformFilter: (& (osgi.ws=gtk)(osgi.os=linux)(osgi.arch=x86_64))
Added:
workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim.webkit.gtk.linux.x86_64/build.properties
===================================================================
---
workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim.webkit.gtk.linux.x86_64/build.properties
(rev 0)
+++
workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim.webkit.gtk.linux.x86_64/build.properties 2011-10-26
11:45:06 UTC (rev 36007)
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
Added:
workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim.webkit.gtk.linux.x86_64/src/org/jboss/tools/browsersim/webkit/WebKitBrowser.java
===================================================================
---
workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim.webkit.gtk.linux.x86_64/src/org/jboss/tools/browsersim/webkit/WebKitBrowser.java
(rev 0)
+++
workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim.webkit.gtk.linux.x86_64/src/org/jboss/tools/browsersim/webkit/WebKitBrowser.java 2011-10-26
11:45:06 UTC (rev 36007)
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.browsersim.webkit;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import org.eclipse.swt.browser.Browser;
+import org.eclipse.swt.internal.Converter;
+import org.eclipse.swt.internal.gtk.OS;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * @author Yahor Radtsevich (yradtsevich)
+ */
+public class WebKitBrowser extends AbstractWebKitBrowser {
+ private static final byte[] USER_AGENT; // = WebKitGTK.user_agent
+ static {
+ int length = "user-agent".length();
+ char [] chars = new char[length];
+ "user-agent".getChars(0, length, chars, 0);
+ USER_AGENT = new byte[length + 1];
+ for (int i = 0; i < length; i++) {
+ USER_AGENT[i] = (byte) chars [i];
+ }
+ }
+
+ public WebKitBrowser(Composite parent, int style) {
+ super(parent, style);
+ }
+
+ protected void setCustomUserAgent(String userAgent) {
+ try {
+ Field webBrowserField = Browser.class.getDeclaredField("webBrowser");
+ webBrowserField.setAccessible(true);
+ Object webKit = webBrowserField.get(this);
+
+ Field webViewField = webKit.getClass().getDeclaredField("webView");
+ webViewField.setAccessible(true);
+ long webView = (Long) webViewField.get(webKit);
+
+// long settings = WebKitGTK.webkit_web_view_get_settings(webView);
+ Class webKitGTKClass =
Browser.class.getClassLoader().loadClass("org.eclipse.swt.internal.webkit.WebKitGTK");
+ Method webkit_web_view_get_settingsMethod =
webKitGTKClass.getDeclaredMethod("webkit_web_view_get_settings", long.class);
+ long settings = (Long) webkit_web_view_get_settingsMethod.invoke(null, webView);
+
+ if (userAgent == null) {
+ OS.g_object_set(settings, USER_AGENT, 0, 0);
+ } else {
+ byte[] bytes = Converter.wcsToMbcs(null, userAgent, true);
+ OS.g_object_set(settings, USER_AGENT, bytes, 0);
+ }
+ } catch (SecurityException e) {
+ e.printStackTrace();
+ } catch (NoSuchFieldException e) {
+ e.printStackTrace();
+ } catch (IllegalArgumentException e) {
+ e.printStackTrace();
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ } catch (ClassNotFoundException e) {
+ e.printStackTrace();
+ } catch (NoSuchMethodException e) {
+ e.printStackTrace();
+ } catch (InvocationTargetException e) {
+ e.printStackTrace();
+ }
+ }
+}