Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » links in a Browser widget
links in a Browser widget [message #454453] Thu, 21 April 2005 05:45 Go to next message
Eugene Kuleshov is currently offline Eugene KuleshovFriend
Messages: 504
Registered: July 2009
Senior Member
Folks!

Can someone help me with Browser widget?

In my plugin I need to show html content and using Browser widget for
this. content is actually reside inside plugin and I'm using

Platform.find( Platform.getBundle( pluginId), new Path( resourceName));

to get URL to the resource.

Unfortunately url returned from this call require special content
handler and I can't pass it to the Browser widget (well' it is IE on
Windows). So, I'm loading data from this url into a string and using
Browser.setText() method to show it to the user.

The problem is that content may have links (a href=""...) and these
links does not work.

Can anybody advise how to work around this issue?

Thanks in advance.

Eugene
Re: links in a Browser widget [message #454467 is a reply to message #454453] Thu, 21 April 2005 14:32 Go to previous messageGo to next message
Christophe Cornu is currently offline Christophe CornuFriend
Messages: 304
Registered: July 2009
Senior Member
Hi Eugene,

You can have a look at the org.eclipse.swt.examples.browser.demos plugin.
This is one way to do it.

All resources need to be accessible through file:// or http://. As a result,
this plugin contains different folders 'css1' 'css2' etc. that contain HTML
content, cascading style sheets and image resources.
HTML content is then loaded through code like:
Browser.setUrl("PLUGIN_PATH/css2/welcome.html");

where PLUGIN_PATH was initialized in the plugin class:

public void start(BundleContext context) throws Exception {
super.start(context);
PLUGIN_PATH =
Platform.resolve(plugin.getBundle().getEntry(".")).toString();
}

This demo plugin is part of the 'Example Plug-ins' section on the regular
Eclipse SDK download page.
The actual source code is at:
http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.exa mples.browser.demos/src/org/eclipse/swt/examples/browser/dem os/views/PawnTab.java?rev=HEAD&content-type=text/vnd.vie wcvs-markup
(search for Browser.setUrl(URL_WELCOME) )

The HTML content and resources pointed to by the HTML content (css,
images...) are stored in folders under your plugin
e.g.
http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.exa mples.browser.demos/css2/

The plugin itself is not jar'ed. Its structure is like:
org.eclipse.swt.examples.browser.demos/
/css1/
welcome.html, style.css etc.

To run this plugin, install it into your eclipse, restart, Window > show
view > SWT Examples > Browser Demo
The welcome.html page is then displayed in the plugin's view.

Chris
Re: links in a Browser widget [message #454471 is a reply to message #454467] Thu, 21 April 2005 15:41 Go to previous message
Eugene Kuleshov is currently offline Eugene KuleshovFriend
Messages: 504
Registered: July 2009
Senior Member
Hi Christophe,

Thanks for the answer. I'll try that.

It seems that using this approach it will not be possible to use
jar'ed plugin. On Windows IE-based widget will not understand urls like
jar:name but on Linux that should work since Mozilla support such urls.

I was thinking to use help server, so make all content awailable as
help and then somehow get an URL of the published help topic. That
should work for jared plugins, but I can't find a way how to resolve
help url from the help topic name. Do you have any idea if it is possible?

regards,
Eugene


Christophe Cornu wrote:
> Hi Eugene,
>
> You can have a look at the org.eclipse.swt.examples.browser.demos plugin.
> This is one way to do it.
>
> All resources need to be accessible through file:// or http://. As a result,
> this plugin contains different folders 'css1' 'css2' etc. that contain HTML
> content, cascading style sheets and image resources.
> HTML content is then loaded through code like:
> Browser.setUrl("PLUGIN_PATH/css2/welcome.html");
>
> where PLUGIN_PATH was initialized in the plugin class:
>
> public void start(BundleContext context) throws Exception {
> super.start(context);
> PLUGIN_PATH =
> Platform.resolve(plugin.getBundle().getEntry(".")).toString();
> }
>
> This demo plugin is part of the 'Example Plug-ins' section on the regular
> Eclipse SDK download page.
> The actual source code is at:
> http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.exa mples.browser.demos/src/org/eclipse/swt/examples/browser/dem os/views/PawnTab.java?rev=HEAD&content-type=text/vnd.vie wcvs-markup
> (search for Browser.setUrl(URL_WELCOME) )
>
> The HTML content and resources pointed to by the HTML content (css,
> images...) are stored in folders under your plugin
> e.g.
> http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.exa mples.browser.demos/css2/
>
> The plugin itself is not jar'ed. Its structure is like:
> org.eclipse.swt.examples.browser.demos/
> /css1/
> welcome.html, style.css etc.
>
> To run this plugin, install it into your eclipse, restart, Window > show
> view > SWT Examples > Browser Demo
> The welcome.html page is then displayed in the plugin's view.
>
> Chris
>
>
Previous Topic:BUG in 3.1M6: NoClassDefFoundError/TabFolderLayout
Next Topic:Figure#setFont does not dispose the existing font
Goto Forum:
  


Current Time: Fri Apr 26 22:05:05 GMT 2024

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

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

Back to the top