Is it possible to get events from "browser support" [message #327685] |
Mon, 28 April 2008 23:45  |
Eclipse User |
|
|
|
Hi,
what I want to do is to react to certain URLs being clicked in the
internal browser, and ideally take an alternative action "inside
Eclipse" when user clicks on these links.
I am currently using the workbench browser support, and my guess is that
it is very difficult to hook actions that take place in the browser.
After looking at the source (but I can't say I figured out how the
pieces fit together), it seems like the SWT Browser has support for
adding listeners to location. But nothing like this is available on the
IWebBrowser interface returned from IWorkbenchBrowserSupport.
Somehow listening must take place, since the Eclipse status bar at the
bottom shows URLs.
It also seems possible to react to events, as an "Eclipse menu" with
"back, and some more actions" is displayed on a right mouse click in the
browser window.
How can I hook into these mechanisms?
If I can't turn clicks into something useful right away, I can perhaps
listen to other things, and pop additional information in a side view.
Grateful for for any ideas or pointers.
Regards
- henrik
|
|
|
|
Re: Is it possible to get events from "browser support" [message #327692 is a reply to message #327685] |
Tue, 29 April 2008 03:14   |
Eclipse User |
|
|
|
You have full control. Eclipse is the best platform for embedding Firefox
(XulRunner).
You need xpcom.jar the Java bindings for XPCOM, the internal object model
of Xulrunner, and xulrunner for your platform.
You have to create the browser with the SWT.MOZILLA style, and get access
to the browser internals through:
(nsIWebBrowser)browser.getWebBrowser();
For some features you should use another entry point, the service manager.
Here is an example of how to access the coookies through the service
manager:
nsICookieManager cookieManager = (nsICookieManager)
Mozilla.getInstance().getServiceManager()
getServiceByContractID("@mozilla.org/cookiemanager;1",
nsICookieManager.NS_ICOOKIEMANAGER_IID);
Look at xulplanet.com for further info.
---------------------------------
In addition you have a lot of control for embedding IE as Eclipse support
COM, the underlying used object model. There is an example of this
(download the platform examples).
------------------------------------
Also you have generic browser support, like location events:
browser.addLocationListener(new LocationListener() {
public void changed(LocationEvent event) {
.....
}
public void changing(LocationEvent event) {
.....
}
});
Henrik Lindberg wrote:
> Hi,
> what I want to do is to react to certain URLs being clicked in the
> internal browser, and ideally take an alternative action "inside
> Eclipse" when user clicks on these links.
> I am currently using the workbench browser support, and my guess is that
> it is very difficult to hook actions that take place in the browser.
> After looking at the source (but I can't say I figured out how the
> pieces fit together), it seems like the SWT Browser has support for
> adding listeners to location. But nothing like this is available on the
> IWebBrowser interface returned from IWorkbenchBrowserSupport.
> Somehow listening must take place, since the Eclipse status bar at the
> bottom shows URLs.
> It also seems possible to react to events, as an "Eclipse menu" with
> "back, and some more actions" is displayed on a right mouse click in the
> browser window.
> How can I hook into these mechanisms?
> If I can't turn clicks into something useful right away, I can perhaps
> listen to other things, and pop additional information in a side view.
> Grateful for for any ideas or pointers.
> Regards
> - henrik
|
|
|
Re: Is it possible to get events from "browser support" [message #327712 is a reply to message #327685] |
Tue, 29 April 2008 09:49   |
Eclipse User |
|
|
|
Unfortunately I don't know this level too well, but surely there's a way to
get hold of the underlying Browser object that is being used, no? (anyone?).
If there really isn't a way then the IWebBrowserSupport path may not be the
right one for embedding a Browser that you want to have this amount of
control over. Once you have a Browser instance by some means then listeners
can be added to it like in
http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/org. eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet128 .java .
Grant
"Henrik Lindberg" <henrik.lindberg@cloudsmith.com> wrote in message
news:fv65ld$2mk$1@build.eclipse.org...
> Hi,
> what I want to do is to react to certain URLs being clicked in the
> internal browser, and ideally take an alternative action "inside
> Eclipse" when user clicks on these links.
>
> I am currently using the workbench browser support, and my guess is that
> it is very difficult to hook actions that take place in the browser.
>
> After looking at the source (but I can't say I figured out how the
> pieces fit together), it seems like the SWT Browser has support for
> adding listeners to location. But nothing like this is available on the
> IWebBrowser interface returned from IWorkbenchBrowserSupport.
>
> Somehow listening must take place, since the Eclipse status bar at the
> bottom shows URLs.
>
> It also seems possible to react to events, as an "Eclipse menu" with
> "back, and some more actions" is displayed on a right mouse click in the
> browser window.
>
> How can I hook into these mechanisms?
>
> If I can't turn clicks into something useful right away, I can perhaps
> listen to other things, and pop additional information in a side view.
>
> Grateful for for any ideas or pointers.
> Regards
> - henrik
|
|
|
|
Powered by
FUDForum. Page generated in 0.04154 seconds