diff options
author | Grant Gayed <ggayed> | 2010-08-20 18:50:45 +0000 |
---|---|---|
committer | Grant Gayed <ggayed> | 2010-08-20 18:50:45 +0000 |
commit | 06f06dd0c77f0d9a4c38817b6ad1d77e716043a0 (patch) | |
tree | d9564dbf63d96c7d32457e53a1addca1ed489868 | |
parent | 7e2de3fb032496a80dceeae6d06edb14795a7315 (diff) | |
download | eclipse.platform.swt-06f06dd0c77f0d9a4c38817b6ad1d77e716043a0.tar.gz eclipse.platform.swt-06f06dd0c77f0d9a4c38817b6ad1d77e716043a0.tar.xz eclipse.platform.swt-06f06dd0c77f0d9a4c38817b6ad1d77e716043a0.zip |
317163 - Browser dispatching to platform-specific implementation has room for improvement
23 files changed, 224 insertions, 76 deletions
diff --git a/bundles/org.eclipse.swt/.classpath_carbon b/bundles/org.eclipse.swt/.classpath_carbon index 60ccf245a3..3a1e47883d 100644 --- a/bundles/org.eclipse.swt/.classpath_carbon +++ b/bundles/org.eclipse.swt/.classpath_carbon @@ -27,6 +27,7 @@ <classpathentry kind="src" path="Eclipse SWT Program/common"/> <classpathentry kind="src" path="Eclipse SWT Program/carbon"/> <classpathentry kind="src" path="Eclipse SWT Browser/common"/> + <classpathentry kind="src" path="Eclipse SWT Browser/carbon"/> <classpathentry kind="src" path="Eclipse SWT WebKit/carbon"/> <classpathentry kind="src" path="Eclipse SWT Mozilla/common"/> <classpathentry kind="src" path="Eclipse SWT Mozilla/carbon"/> diff --git a/bundles/org.eclipse.swt/.classpath_cocoa b/bundles/org.eclipse.swt/.classpath_cocoa index 752f05d15e..dc8d373a7f 100755 --- a/bundles/org.eclipse.swt/.classpath_cocoa +++ b/bundles/org.eclipse.swt/.classpath_cocoa @@ -27,6 +27,7 @@ <classpathentry kind="src" path="Eclipse SWT Program/common"/> <classpathentry kind="src" path="Eclipse SWT Program/cocoa"/> <classpathentry kind="src" path="Eclipse SWT Browser/common"/> + <classpathentry kind="src" path="Eclipse SWT Browser/cocoa"/> <classpathentry kind="src" path="Eclipse SWT WebKit/cocoa"/> <classpathentry kind="src" path="Eclipse SWT Mozilla/common"/> <classpathentry kind="src" path="Eclipse SWT Mozilla/cocoa"/> diff --git a/bundles/org.eclipse.swt/.classpath_gtk b/bundles/org.eclipse.swt/.classpath_gtk index a455a2054a..c1e7b943ae 100644 --- a/bundles/org.eclipse.swt/.classpath_gtk +++ b/bundles/org.eclipse.swt/.classpath_gtk @@ -30,6 +30,7 @@ <classpathentry kind="src" path="Eclipse SWT Program/cde"/> <classpathentry kind="src" path="Eclipse SWT Custom Widgets/common"/> <classpathentry kind="src" path="Eclipse SWT Browser/common"/> + <classpathentry kind="src" path="Eclipse SWT Browser/gtk"/> <classpathentry kind="src" path="Eclipse SWT Mozilla/common"/> <classpathentry kind="src" path="Eclipse SWT Mozilla/gtk"/> <classpathentry kind="src" path="Eclipse SWT OpenGL/gtk"/> diff --git a/bundles/org.eclipse.swt/.classpath_motif b/bundles/org.eclipse.swt/.classpath_motif index 42051ebea5..7c18c5c6d0 100755 --- a/bundles/org.eclipse.swt/.classpath_motif +++ b/bundles/org.eclipse.swt/.classpath_motif @@ -38,6 +38,7 @@ <classpathentry kind="src" path="Eclipse SWT Program/cde"/> <classpathentry kind="src" path="Eclipse SWT Custom Widgets/common"/> <classpathentry kind="src" path="Eclipse SWT Browser/common"/> + <classpathentry kind="src" path="Eclipse SWT Browser/motif"/> <classpathentry kind="src" path="Eclipse SWT Mozilla/common"/> <classpathentry kind="src" path="Eclipse SWT Mozilla/motif"/> <classpathentry kind="src" path="Eclipse SWT OpenGL/motif"/> diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/carbon/org/eclipse/swt/browser/BrowserFactory.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/carbon/org/eclipse/swt/browser/BrowserFactory.java new file mode 100644 index 0000000000..3944cfbb5f --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT Browser/carbon/org/eclipse/swt/browser/BrowserFactory.java @@ -0,0 +1,24 @@ +/******************************************************************************* + * Copyright (c) 2010 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.swt.browser; + +import org.eclipse.swt.SWT; + +class BrowserFactory { + +WebBrowser createWebBrowser (int style) { + if ((style & SWT.MOZILLA) != 0) { + return new Mozilla (); + } + return new WebKit (); +} + +} diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/cocoa/org/eclipse/swt/browser/BrowserFactory.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/cocoa/org/eclipse/swt/browser/BrowserFactory.java new file mode 100644 index 0000000000..3944cfbb5f --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT Browser/cocoa/org/eclipse/swt/browser/BrowserFactory.java @@ -0,0 +1,24 @@ +/******************************************************************************* + * Copyright (c) 2010 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.swt.browser; + +import org.eclipse.swt.SWT; + +class BrowserFactory { + +WebBrowser createWebBrowser (int style) { + if ((style & SWT.MOZILLA) != 0) { + return new Mozilla (); + } + return new WebKit (); +} + +} diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/common/org/eclipse/swt/browser/Browser.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/common/org/eclipse/swt/browser/Browser.java index a7e2a75ac9..8578a038a5 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT Browser/common/org/eclipse/swt/browser/Browser.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Browser/common/org/eclipse/swt/browser/Browser.java @@ -83,40 +83,15 @@ public Browser (Composite parent, int style) { userStyle = style; String platform = SWT.getPlatform (); - Display display = parent.getDisplay (); - if ("gtk".equals (platform)) display.setData (NO_INPUT_METHOD, null); //$NON-NLS-1$ - String classNames[] = null; - if ((style & SWT.MOZILLA) != 0) { - classNames = new String[] {"org.eclipse.swt.browser.Mozilla"}; //$NON-NLS-1$ - } else { - if ("win32".equals (platform) || "wpf".equals (platform)) { //$NON-NLS-1$ $NON-NLS-2$ - classNames = new String[] {"org.eclipse.swt.browser.IE"}; //$NON-NLS-1$ - } else if ("motif".equals (platform)) { //$NON-NLS-1$ - classNames = new String[] {"org.eclipse.swt.browser.Mozilla"}; //$NON-NLS-1$ - } else if ("gtk".equals (platform)) { //$NON-NLS-1$ - classNames = new String[] {"org.eclipse.swt.browser.WebKit", "org.eclipse.swt.browser.Mozilla"}; //$NON-NLS-1$ //$NON-NLS-2$ - } else if ("carbon".equals (platform) || "cocoa".equals (platform)) { //$NON-NLS-1$ - classNames = new String[] {"org.eclipse.swt.browser.WebKit"}; //$NON-NLS-1$ - } else if ("photon".equals (platform)) { //$NON-NLS-1$ - classNames = new String[] {"org.eclipse.swt.browser.Voyager"}; //$NON-NLS-1$ - } else { - dispose (); - SWT.error (SWT.ERROR_NO_HANDLES); - } + if ("gtk".equals (platform)) { //$NON-NLS-1$ + parent.getDisplay ().setData (NO_INPUT_METHOD, null); } - for (int i = 0; i < classNames.length; i++) { - try { - Class clazz = Class.forName (classNames[i]); - webBrowser = (WebBrowser)clazz.newInstance (); - if (webBrowser != null) { - webBrowser.setBrowser (this); - if (webBrowser.create (parent, style)) return; - } - } catch (ClassNotFoundException e) { - } catch (IllegalAccessException e) { - } catch (InstantiationException e) { - } + webBrowser = new BrowserFactory ().createWebBrowser (style); + if (webBrowser != null) { + webBrowser.setBrowser (this); + webBrowser.create (parent, style); + return; } dispose (); SWT.error (SWT.ERROR_NO_HANDLES); diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/common/org/eclipse/swt/browser/WebBrowser.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/common/org/eclipse/swt/browser/WebBrowser.java index e58a4bed9d..8c1bc7036e 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Browser/common/org/eclipse/swt/browser/WebBrowser.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Browser/common/org/eclipse/swt/browser/WebBrowser.java @@ -300,7 +300,7 @@ static void SetPendingCookies (Vector pendingCookies) { } } -public abstract boolean create (Composite parent, int style); +public abstract void create (Composite parent, int style); static String CreateErrorString (String error) { return ERROR_ID + error; diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/forms/org/eclipse/swt/browser/BrowserFactory.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/forms/org/eclipse/swt/browser/BrowserFactory.java new file mode 100644 index 0000000000..c10a714ca3 --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT Browser/forms/org/eclipse/swt/browser/BrowserFactory.java @@ -0,0 +1,22 @@ +/******************************************************************************* + * Copyright (c) 2010 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.swt.browser; + +import org.eclipse.swt.SWT; + +class BrowserFactory { + +WebBrowser createWebBrowser (int style) { + if ((style & SWT.MOZILLA) != 0) return null; + return new IE (); +} + +} diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/forms/org/eclipse/swt/browser/IE.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/forms/org/eclipse/swt/browser/IE.java index 30f73ebdfe..5384ab91e3 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Browser/forms/org/eclipse/swt/browser/IE.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Browser/forms/org/eclipse/swt/browser/IE.java @@ -28,7 +28,7 @@ class IE extends WebBrowser { }; } -public boolean create(Composite parent, int style) { +public void create(Composite parent, int style) { host = OS.gcnew_WindowsFormsHost(); if (host == 0) SWT.error(SWT.ERROR_NO_HANDLES); webBrowser = OS.gcnew_WebBrowser(); @@ -87,8 +87,6 @@ public boolean create(Composite parent, int style) { }; browser.addListener(SWT.Resize, listener); browser.addListener(SWT.Dispose, listener); - - return true; } public boolean back() { diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/gtk/org/eclipse/swt/browser/BrowserFactory.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/gtk/org/eclipse/swt/browser/BrowserFactory.java new file mode 100644 index 0000000000..36983ab66f --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT Browser/gtk/org/eclipse/swt/browser/BrowserFactory.java @@ -0,0 +1,24 @@ +/******************************************************************************* + * Copyright (c) 2010 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.swt.browser; + +import org.eclipse.swt.SWT; + +class BrowserFactory { + +WebBrowser createWebBrowser (int style) { + if ((style & SWT.MOZILLA) != 0 || !WebKit.isInstalled ()) { + return new Mozilla (); + } + return new WebKit (); +} + +} diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/browser/BrowserFactory.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/browser/BrowserFactory.java new file mode 100644 index 0000000000..a53cff7a0d --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/browser/BrowserFactory.java @@ -0,0 +1,21 @@ +/******************************************************************************* + * Copyright (c) 2010 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.swt.browser; + +import org.eclipse.swt.SWT; + +class BrowserFactory { + +WebBrowser createWebBrowser (int style) { + return new Mozilla (); +} + +} diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/photon/org/eclipse/swt/browser/BrowserFactory.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/photon/org/eclipse/swt/browser/BrowserFactory.java new file mode 100644 index 0000000000..356593522b --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT Browser/photon/org/eclipse/swt/browser/BrowserFactory.java @@ -0,0 +1,22 @@ +/******************************************************************************* + * Copyright (c) 2010 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.swt.browser; + +import org.eclipse.swt.SWT; + +class BrowserFactory { + +WebBrowser createWebBrowser (int style) { + if ((style & SWT.MOZILLA) != 0) return null; + return new Voyager (); +} + +} diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/photon/org/eclipse/swt/browser/Voyager.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/photon/org/eclipse/swt/browser/Voyager.java index 6be7a97633..543e1d7f49 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT Browser/photon/org/eclipse/swt/browser/Voyager.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Browser/photon/org/eclipse/swt/browser/Voyager.java @@ -32,7 +32,7 @@ class Voyager extends WebBrowser { /* Package Name */ static Callback callback; -public boolean create(Composite parent, int style) { +public void create(Composite parent, int style) { /* use Photon's built-in anchoring for resizing */ int[] args = { OS.Pt_ARG_ANCHOR_FLAGS, @@ -108,8 +108,6 @@ public boolean create(Composite parent, int style) { browser.addListener(folderEvents[i], listener); } OS.PtRealizeWidget(webHandle); - - return true; } static int webProc(int handle, int data, int info) { diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/BrowserFactory.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/BrowserFactory.java new file mode 100644 index 0000000000..52d7e8e487 --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/BrowserFactory.java @@ -0,0 +1,24 @@ +/******************************************************************************* + * Copyright (c) 2010 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.swt.browser; + +import org.eclipse.swt.SWT; + +class BrowserFactory { + +WebBrowser createWebBrowser (int style) { + if ((style & SWT.MOZILLA) != 0) { + return new Mozilla (); + } + return new IE (); +} + +} diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/IE.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/IE.java index 1fb993ce6c..c47b1b876f 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/IE.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/IE.java @@ -253,7 +253,7 @@ class IE extends WebBrowser { NativePendingCookies = null; } -public boolean create(Composite parent, int style) { +public void create(Composite parent, int style) { this.style = style; frame = new OleFrame(browser, SWT.NONE); @@ -967,8 +967,6 @@ public boolean create(Composite parent, int style) { int[] rgdispid = auto.getIDsOfNames(new String[] {"RegisterAsDropTarget"}); //$NON-NLS-1$ if (rgdispid != null) auto.setProperty(rgdispid[0], variant); variant.dispose(); - - return true; } public boolean back() { diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/wpf/org/eclipse/swt/browser/BrowserFactory.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/wpf/org/eclipse/swt/browser/BrowserFactory.java new file mode 100644 index 0000000000..c10a714ca3 --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT Browser/wpf/org/eclipse/swt/browser/BrowserFactory.java @@ -0,0 +1,22 @@ +/******************************************************************************* + * Copyright (c) 2010 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.swt.browser; + +import org.eclipse.swt.SWT; + +class BrowserFactory { + +WebBrowser createWebBrowser (int style) { + if ((style & SWT.MOZILLA) != 0) return null; + return new IE (); +} + +} diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/wpf/org/eclipse/swt/browser/IE.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/wpf/org/eclipse/swt/browser/IE.java index 72ac7de203..57c1d5ec5d 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Browser/wpf/org/eclipse/swt/browser/IE.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Browser/wpf/org/eclipse/swt/browser/IE.java @@ -28,7 +28,7 @@ class IE extends WebBrowser { }; } -public boolean create(Composite parent, int style) { +public void create(Composite parent, int style) { frame = OS.gcnew_Frame(); if (frame == 0) SWT.error(SWT.ERROR_NO_HANDLES); OS.Frame_NavigationUIVisibility(frame, OS.NavigationUIVisibility_Hidden); @@ -64,8 +64,6 @@ public boolean create(Composite parent, int style) { }; browser.addListener(SWT.Resize, listener); browser.addListener(SWT.Dispose, listener); - - return true; } public boolean back() { diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/Mozilla.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/Mozilla.java index 0afac15827..4216ebe59a 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/Mozilla.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/Mozilla.java @@ -528,7 +528,7 @@ class Mozilla extends WebBrowser { }; } -public boolean create (Composite parent, int style) { +public void create (Composite parent, int style) { delegate = new MozillaDelegate (browser); final Display display = parent.getDisplay (); @@ -930,8 +930,6 @@ public boolean create (Composite parent, int style) { for (int i = 0; i < folderEvents.length; i++) { browser.addListener (folderEvents[i], listener); } - - return true; } public boolean back () { diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/carbon/org/eclipse/swt/browser/WebKit.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/carbon/org/eclipse/swt/browser/WebKit.java index 6bd8948632..643438f310 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT WebKit/carbon/org/eclipse/swt/browser/WebKit.java +++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/carbon/org/eclipse/swt/browser/WebKit.java @@ -150,7 +150,7 @@ class WebKit extends WebBrowser { NativePendingCookies = null; } -public boolean create (Composite parent, int style) { +public void create (Composite parent, int style) { /* * Note. Loading the webkit bundle on Jaguar causes a crash. * The workaround is to detect any OS prior to 10.30 and fail @@ -401,8 +401,6 @@ public boolean create (Composite parent, int style) { int preferences = Cocoa.objc_msgSend(Cocoa.C_WebPreferences, Cocoa.S_standardPreferences); Cocoa.objc_msgSend(preferences, Cocoa.S_setJavaEnabled, 0); } - - return true; } static int eventProc3(int nextHandler, int theEvent, int userData) { diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/cocoa/org/eclipse/swt/browser/WebKit.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/cocoa/org/eclipse/swt/browser/WebKit.java index 82d38700f8..1112eccf8d 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT WebKit/cocoa/org/eclipse/swt/browser/WebKit.java +++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/cocoa/org/eclipse/swt/browser/WebKit.java @@ -119,7 +119,7 @@ class WebKit extends WebBrowser { NativePendingCookies = null; } -public boolean create (Composite parent, int style) { +public void create (Composite parent, int style) { if (delegateClass == 0) { Class webKitClass = this.getClass(); Callback3 = new Callback(webKitClass, "browserProc", 3); //$NON-NLS-1$ @@ -281,8 +281,6 @@ public boolean create (Composite parent, int style) { /* disable applets */ WebPreferences.standardPreferences().setJavaEnabled(false); } - - return true; } public boolean back() { diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java index 1244c84562..7b2dbe8bfc 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java +++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java @@ -93,6 +93,8 @@ public class WebKit extends WebBrowser { Library.loadLibrary ("swt-webkit"); // $NON-NLS-1$ LibraryLoaded = true; } catch (Throwable e) { + /* do not initialize the Callbacks below */ + return; } Proc2 = new Callback (WebKit.class, "Proc", 2); //$NON-NLS-1$ @@ -209,6 +211,19 @@ static Browser findBrowser (int /*long*/ webView) { return (Browser)Display.getCurrent ().findWidget (parent); } +static boolean isInstalled () { + if (!LibraryLoaded) return false; + // TODO webkit_check_version() should take care of the following, but for some + // reason this symbol is missing from the latest build. If it is present in + // Linux distro-provided builds then replace the following with this call. + int major = WebKitGTK.webkit_major_version (); + int minor = WebKitGTK.webkit_minor_version (); + int micro = WebKitGTK.webkit_micro_version (); + return major > MIN_VERSION[0] || + (major == MIN_VERSION[0] && minor > MIN_VERSION[1]) || + (major == MIN_VERSION[0] && minor == MIN_VERSION[1] && micro >= MIN_VERSION[2]); +} + static int /*long*/ JSObjectCallAsFunctionProc (int /*long*/ ctx, int /*long*/ function, int /*long*/ thisObject, int /*long*/ argumentCount, int /*long*/ arguments, int /*long*/ exception) { if (WebKitGTK.JSValueIsObjectOfClass (ctx, thisObject, ExternalClass) == 0) { return WebKitGTK.JSValueMakeUndefined (ctx); @@ -395,21 +410,8 @@ int /*long*/ webViewProc (int /*long*/ handle, int /*long*/ arg0, int /*long*/ a } } -public boolean create (Composite parent, int style) { - if (!LibraryLoaded) return false; - +public void create (Composite parent, int style) { if (ExternalClass == 0) { - // TODO webkit_check_version() should do the following, but for some reason - // this symbol is missing from the latest build. If it is present in Linux - // distro-provided builds then replace the following with this call. - int major = WebKitGTK.webkit_major_version (); - int minor = WebKitGTK.webkit_minor_version (); - int micro = WebKitGTK.webkit_micro_version (); - boolean success = major > MIN_VERSION[0] || - (major == MIN_VERSION[0] && minor > MIN_VERSION[1]) || - (major == MIN_VERSION[0] && minor == MIN_VERSION[1] && micro >= MIN_VERSION[2]); - if (!success) return false; - if (Device.DEBUG) { System.out.println("WebKit version " + major + "." + minor + "." + micro); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } @@ -557,8 +559,6 @@ public boolean create (Composite parent, int style) { * be changed. */ browser.setData (KEY_CHECK_SUBWINDOW, Boolean.FALSE); - - return true; } void addEventHandlers (boolean top) { diff --git a/bundles/org.eclipse.swt/buildFragment.xml b/bundles/org.eclipse.swt/buildFragment.xml index 8e3d891b57..9073c4ed7b 100644 --- a/bundles/org.eclipse.swt/buildFragment.xml +++ b/bundles/org.eclipse.swt/buildFragment.xml @@ -136,9 +136,9 @@ <fileset dir="${plugindir}/Eclipse SWT AWT/common/"/> <fileset dir="${plugindir}/Eclipse SWT AWT/carbon/"/> <fileset dir="${plugindir}/Eclipse SWT WebKit/carbon/"/> - <fileset dir="${plugindir}/Eclipse SWT Browser/common/"/> - <fileset dir="${plugindir}/Eclipse SWT Mozilla/carbon/"/> + <fileset dir="${plugindir}/Eclipse SWT Browser/common/"/>
<fileset dir="${plugindir}/Eclipse SWT Browser/carbon/"/> <fileset dir="${plugindir}/Eclipse SWT Mozilla/common/"/> + <fileset dir="${plugindir}/Eclipse SWT Mozilla/carbon/"/> <fileset dir="${plugindir}/Eclipse SWT Custom Widgets/common/"/> <fileset dir="${plugindir}/Eclipse SWT Drag and Drop/carbon/"/> <fileset dir="${plugindir}/Eclipse SWT Drag and Drop/common/"/> @@ -173,9 +173,9 @@ <fileset dir="${plugindir}/Eclipse SWT AWT/common/"/> <fileset dir="${plugindir}/Eclipse SWT AWT/cocoa/"/> <fileset dir="${plugindir}/Eclipse SWT WebKit/cocoa/"/> - <fileset dir="${plugindir}/Eclipse SWT Browser/common/"/> - <fileset dir="${plugindir}/Eclipse SWT Mozilla/cocoa/"/> + <fileset dir="${plugindir}/Eclipse SWT Browser/common/"/>
<fileset dir="${plugindir}/Eclipse SWT Browser/cocoa/"/> <fileset dir="${plugindir}/Eclipse SWT Mozilla/common/"/> + <fileset dir="${plugindir}/Eclipse SWT Mozilla/cocoa/"/> <fileset dir="${plugindir}/Eclipse SWT Custom Widgets/common/"/> <fileset dir="${plugindir}/Eclipse SWT Drag and Drop/cocoa/"/> <fileset dir="${plugindir}/Eclipse SWT Drag and Drop/common/"/> @@ -209,7 +209,7 @@ <fileset dir="${plugindir}/Eclipse SWT Accessibility/gtk/"/> <fileset dir="${plugindir}/Eclipse SWT AWT/common/"/> <fileset dir="${plugindir}/Eclipse SWT AWT/gtk/"/> - <fileset dir="${plugindir}/Eclipse SWT Browser/common/"/> + <fileset dir="${plugindir}/Eclipse SWT Browser/common/"/>
<fileset dir="${plugindir}/Eclipse SWT Browser/gtk/"/> <fileset dir="${plugindir}/Eclipse SWT Mozilla/common/"/> <fileset dir="${plugindir}/Eclipse SWT Mozilla/gtk/"/> <fileset dir="${plugindir}/Eclipse SWT Custom Widgets/common/"/> @@ -257,7 +257,7 @@ <fileset dir="${plugindir}/Eclipse SWT Accessibility/emulated/"/> <fileset dir="${plugindir}/Eclipse SWT AWT/common/"/> <fileset dir="${plugindir}/Eclipse SWT AWT/motif/"/> - <fileset dir="${plugindir}/Eclipse SWT Browser/common/"/> + <fileset dir="${plugindir}/Eclipse SWT Browser/common/"/>
<fileset dir="${plugindir}/Eclipse SWT Browser/motif/"/> <fileset dir="${plugindir}/Eclipse SWT Mozilla/common/"/> <fileset dir="${plugindir}/Eclipse SWT Mozilla/motif/"/> <fileset dir="${plugindir}/Eclipse SWT Custom Widgets/common/"/> |