Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » nsIWebBrowser webBrowser = (nsIWebBrowser)browser.getWebBrowser() NULL on 3.5M6
nsIWebBrowser webBrowser = (nsIWebBrowser)browser.getWebBrowser() NULL on 3.5M6 [message #335423] Tue, 07 April 2009 17:28 Go to next message
Eclipse UserFriend
Originally posted by: chlache.talita.org

I am working on an Mozilla Html Editor.
On Eclipse 3.4.1 (nsIWebBrowser)browser.getWebBrowser() works with no problems.
After moving to 3.5M6 (nsIWebBrowser)browser.getWebBrowser() always returns null, even though
the Mozilla Browser has completely loaded.
The Error seems to occcur when SWT.Browser calls ClassForName("org.mozilla.xpcom"), which returns null.

When I run the same Code as a Snippet in 3.5M6 (as in Snippet267) the call works fine though.

Is this a Bug? Thanks for any help.

Andreas
Re: nsIWebBrowser webBrowser = (nsIWebBrowser)browser.getWebBrowser() NULL on 3.5M6 [message #335424 is a reply to message #335423] Tue, 07 April 2009 19:36 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: chlache.talita.org

Andreas Chlache wrote:
> I am working on an Mozilla Html Editor.
> On Eclipse 3.4.1 (nsIWebBrowser)browser.getWebBrowser() works with no
> problems.
> After moving to 3.5M6 (nsIWebBrowser)browser.getWebBrowser() always
> returns null, even though
> the Mozilla Browser has completely loaded.
> The Error seems to occcur when SWT.Browser calls
> ClassForName("org.mozilla.xpcom"), which returns null.
>
> When I run the same Code as a Snippet in 3.5M6 (as in Snippet267) the
> call works fine though.
>
> Is this a Bug? Thanks for any help.
>
> Andreas

As a test i put some of the SWT.Mozilla initialization code in my plugin:

try {
Class clazz = Class.forName ("org.mozilla.xpcom.Mozilla"); //$NON-NLS-1$
Method method = clazz.getMethod ("getInstance", new Class[0]); //$NON-NLS-1$
Object mozilla = method.invoke (null, new Object[0]);
method = clazz.getMethod ("getComponentManager", new Class[0]); //$NON-NLS-1$
try {
method.invoke (mozilla, new Object[0]);
} catch (InvocationTargetException e) {
}
} catch (ClassNotFoundException e) {
/* JavaXPCOM is not on the classpath */
} catch (NoSuchMethodException e) {
/* the JavaXPCOM on the classpath does not implement initialize() */
} catch (IllegalArgumentException e) {
} catch (IllegalAccessException e) {
} catch (InvocationTargetException e) {
}

and it works perfectly, only to immediately fail when calling

browser = new Browser(parent, SWT.MOZILLA | SWT.BORDER);

in the SWT plugin. Class.forName returning NULL.

How is that possible?
Re: nsIWebBrowser webBrowser = (nsIWebBrowser)browser.getWebBrowser() NULL on 3.5M6 [message #335436 is a reply to message #335424] Wed, 08 April 2009 12:00 Go to previous messageGo to next message
Snjezana Peco is currently offline Snjezana PecoFriend
Messages: 789
Registered: July 2009
Senior Member
org.eclipse.swt.browser.Mozilla can't load org.mozilla.xpcom.Mozilla
because "DynamicImport-Package: org.mozilla.xpcom" is missing in the
MANIFEST.MF file.
There isn't a problem when using SWT out of OSGi (Snippet267, for instance).
The problem is fixed in the Eclipse trunk.

Snjeza

Andreas Chlache wrote:
> Andreas Chlache wrote:
>> I am working on an Mozilla Html Editor.
>> On Eclipse 3.4.1 (nsIWebBrowser)browser.getWebBrowser() works with no
>> problems.
>> After moving to 3.5M6 (nsIWebBrowser)browser.getWebBrowser() always
>> returns null, even though
>> the Mozilla Browser has completely loaded.
>> The Error seems to occcur when SWT.Browser calls
>> ClassForName("org.mozilla.xpcom"), which returns null.
>>
>> When I run the same Code as a Snippet in 3.5M6 (as in Snippet267) the
>> call works fine though.
>>
>> Is this a Bug? Thanks for any help.
>>
>> Andreas
>
> As a test i put some of the SWT.Mozilla initialization code in my plugin:
>
> try {
> Class clazz = Class.forName ("org.mozilla.xpcom.Mozilla");
> //$NON-NLS-1$
> Method method = clazz.getMethod ("getInstance", new
> Class[0]); //$NON-NLS-1$
> Object mozilla = method.invoke (null, new Object[0]);
> method = clazz.getMethod ("getComponentManager", new
> Class[0]); //$NON-NLS-1$
> try {
> method.invoke (mozilla, new Object[0]);
> } catch (InvocationTargetException e) {
> }
> } catch (ClassNotFoundException e) {
> /* JavaXPCOM is not on the classpath */
> } catch (NoSuchMethodException e) {
> /* the JavaXPCOM on the classpath does not implement
> initialize() */
> } catch (IllegalArgumentException e) {
> } catch (IllegalAccessException e) {
> } catch (InvocationTargetException e) {
> }
>
> and it works perfectly, only to immediately fail when calling
>
> browser = new Browser(parent, SWT.MOZILLA | SWT.BORDER);
>
> in the SWT plugin. Class.forName returning NULL.
>
> How is that possible?
Re: nsIWebBrowser webBrowser = (nsIWebBrowser)browser.getWebBrowser() NULL on 3.5M6 [message #335437 is a reply to message #335436] Wed, 08 April 2009 12:20 Go to previous message
Eclipse UserFriend
Originally posted by: chlache.talita.org

Snjezana Peco wrote:
> org.eclipse.swt.browser.Mozilla can't load org.mozilla.xpcom.Mozilla
> because "DynamicImport-Package: org.mozilla.xpcom" is missing in the
> MANIFEST.MF file.
> There isn't a problem when using SWT out of OSGi (Snippet267, for
> instance).
> The problem is fixed in the Eclipse trunk.
>
> Snjeza
>

Thanks a lot for this information. I owe you one.

I will update and I hope that it will work.

Andreas
Previous Topic:Paint error for toolbars with temporary invisible commands
Next Topic:Quick Fix Handler enabled when there are not resolutions
Goto Forum:
  


Current Time: Sat Jul 27 16:15:52 GMT 2024

Powered by FUDForum. Page generated in 0.03840 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top