[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.tools.pdt] Re: Browser Button

OK.
When Web Browser is set to external browser firefox,
org.eclipse.wst.server.ui.internal.webbrowser.OpenBrowserWorkbenchAction creates MozillaBrowser instance and intend to open null url.
IWebBrowser browser =
browserSupport.createBrowser(IWorkbenchBrowserSupport.LOCATION_BAR | IWorkbenchBrowserSupport.NAVIGATION_BAR, null, null, null);
browser.openURL(null);

However, org.eclipse.ui.internal.browser.browsers.MozillaBrowser#openURL doesn't handle null.
public void openURL(URL url2) {
   String url = url2.toExternalForm();
This causes NullPointerException.

This is the reason why I cannot open firefox as external browser.

If I set the file name to other than "firefox.exe" (this literal string consists in plugin.xml of org.eclipse.ui.browser plugin), browserSupport creates ExternalBrowserInstance instead of MozillaBrowser. And it does handle null.
org.eclipse.ui.internal.browser.ExternalBrowserInstance#openURL
public void openURL(URL url) throws PartInitException {
   String urlText = null;

   if (url != null)
       urlText = url.toExternalForm();

This is the reason why I can open renamed firefox as external browser.

The bug is in org.eclipse.ui.internal.browser.browsers.MozillaBrowser.
Over.