[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[wtp-dev] Opening the internal browser in Eclipse
|
Hi,
I wanted to open the internal web browser to display an SVG file in my plugin. I used the following code snippet in browser invocation logic.
IWorkbenchBrowserSupport browserSupport = PluginActivator.getDefault().getWorkbench().getBrowserSupport();
IWebBrowser browser = browserSupport.createBrowser(IWorkbenchBrowserSupport.LOCATION_BAR, null,"Test", "Test");
URL url = "" URL("the file url address");
browser.openURL(url);
But it failed with the following exception .
org.eclipse.ui.PartInitException: Could not open a Web browser because there are none configured. Check the Web Browser preferences.
at org.eclipse.ui.internal.browser.DefaultBrowserSupport.createBrowser(DefaultBrowserSupport.java:108)
at org.eclipse.ui.internal.browser.WorkbenchBrowserSupport.createBrowser(WorkbenchBrowserSupport.java:97)
So I tried to change the preference using Window-> Preference->General->Web browser in the eclipse application. But strangely the option to select the internal browser was grayed out.
Then the next time I re-runned the eclipse application. Here I was able to change the browser setting to use the internal browser(by default it had been selected to use the external browser)
before invoking my plugin. Then again I tried to run my plugin.
Then I got the following NullPointer exception.
java.lang.NullPointerException
at org.eclipse.ui.internal.browser.DefaultBrowserSupport.getWindowKey(DefaultBrowserSupport.java:76)
at org.eclipse.ui.internal.browser.DefaultBrowserSupport.createBrowser(DefaultBrowserSupport.java:137)
at org.eclipse.ui.internal.browser.WorkbenchBrowserSupport.createBrowser(WorkbenchBrowserSupport.java:97)
Have anyone got this kind of problem before? How can I get this to work? I'm working in Eclipse Ganymede in Ubunutu.
Regards,
Chamith Buddhika.