Community
Participate
Working Groups
Currently the Browser class has a gigantic "if" to detect the Browser class of choice that connects the actual platform specific Browser implementation: if ((style & SWT.MOZILLA) != 0) { className = "org.eclipse.swt.browser.Mozilla"; //$NON-NLS-1$ } else { if ("win32".equals (platform) || "wpf".equals (platform)) { //$NON-NLS-1$ $NON-NLS-2$ className = "org.eclipse.swt.browser.IE"; //$NON-NLS-1$ } else if ("motif".equals (platform)) { //$NON-NLS-1$ className = "org.eclipse.swt.browser.Mozilla"; //$NON-NLS-1$ } else if ("gtk".equals (platform)) { //$NON-NLS-1$ className = "org.eclipse.swt.browser.Mozilla"; //$NON-NLS-1$ } else if ("carbon".equals (platform) || "cocoa".equals (platform)) { //$NON-NLS-1$ className = "org.eclipse.swt.browser.Safari"; //$NON-NLS-1$ } else if ("photon".equals (platform)) { //$NON-NLS-1$ className = "org.eclipse.swt.browser.Voyager"; //$NON-NLS-1$ } else { dispose (); SWT.error (SWT.ERROR_NO_HANDLES); } } This design makes it unbearable hard for new platforms to add their implementation (and its a pretty bad design anyway). Also using strings and reflection to find a class is the second bad idea that I see here. I propose to use a class BrowserFactory with a single static method createBrowser() which returns an instance of of WebBrowser and then every platform can easily implement its own version of BrowserFactory to retrieve the implementation.
agreed, fixed > 20100820