Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » trying to load gif from plugin into SWT browser
trying to load gif from plugin into SWT browser [message #448940] Sat, 15 January 2005 14:40 Go to next message
David Black is currently offline David BlackFriend
Messages: 5
Registered: July 2009
Junior Member
Hi,

I'm creating html on the fly and just using the SWT browser setText
method. I want to include gifs from my plugin in the html e.g.

<img src=\"icons/sample.gif\"/>

I've tried loads of variations of this e.g.

"../icons/sample.gif"
"file://icons/sample.gif"
"file://../icons/sample.gif"

but I have not been able to get anything working yet.

Anyone know how to do this or an alterative?

cheers

David Black
Re: trying to load gif from plugin into SWT browser [message #448993 is a reply to message #448940] Mon, 17 January 2005 15:07 Go to previous messageGo to next message
Christophe Cornu is currently offline Christophe CornuFriend
Messages: 304
Registered: July 2009
Senior Member
Hi David,

See snippet "render HTML that includes relative links from memory". You need
to set a base tag - or specify the full path to your image every time.
http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.sni ppets/src/org/eclipse/swt/snippets/Snippet137.java?rev=HEAD& amp;content-type=text/vnd.viewcvs-markup

Let us know if you need more details,
Chris
Re: trying to load gif from plugin into SWT browser [message #449150 is a reply to message #448993] Tue, 18 January 2005 19:39 Go to previous messageGo to next message
David Black is currently offline David BlackFriend
Messages: 5
Registered: July 2009
Junior Member
thanks Chris, so my base href for a gif in myplugin/icons (or is there a
better / more correct place to put these?) would be what? I'm wondering
is there a relative path to the gif? ... or am I going about this in the
wrong? Is it that I should interrogate eclipse to see where the plugin
resides in the directory tree and make up the base path that way?

cheers
David

Christophe Cornu wrote:
> Hi David,
>
> See snippet "render HTML that includes relative links from memory". You need
> to set a base tag - or specify the full path to your image every time.
> http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.sni ppets/src/org/eclipse/swt/snippets/Snippet137.java?rev=HEAD& amp;content-type=text/vnd.viewcvs-markup
>
> Let us know if you need more details,
> Chris
>
>
Re: trying to load gif from plugin into SWT browser [message #449288 is a reply to message #449150] Thu, 20 January 2005 15:16 Go to previous message
Christophe Cornu is currently offline Christophe CornuFriend
Messages: 304
Registered: July 2009
Senior Member
> Is it that I should interrogate eclipse to see where the plugin
resides in the directory tree and make up the base path that way?

Yes. That's what I did for the plugin
org.eclipse.swt.examples.browser.demos. This plugin is part of the Eclipse
CVS and available in the Eclipse Example plug-ins on the download page. This
plugin contains subfolders css1, css2 etc. that contain the stylesheet, gif
and other required image files for each theme used by the plugin.
I get the plugin path through Eclipse API. Then add the particular subfolder
(css1, css2 ...) that contains my cascading style sheet and images.

In my class that extends AbstractUIPlugin I get the PLUGIN_PATH as in below.

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

I then build absolute paths like:
static String CSS_FOLDER = "css2";
static String URL_CSS = PLUGIN_PATH+CSS_FOLDER+"/style.css";
static String URL_WELCOME =PLUGIN_PATH+CSS_FOLDER+"/welcome.html";

before using it to generate HTML:
html = "<html><header><link rel=\"stylesheet\" type=\"text/css\"
href=\""+URL_CSS+"\"></header><body><div class=\"board\"><table><tbody>";
....
browser.setText(html);


Details on how to get this plugin:
Go to the regular Eclipse download page (e.g. from the Main Eclipse download
site)
section: "Example Plug-ins"
SWT Browser examples are available in either Windows or "All Other
Platforms" downloads - so it does not matter which one you take.

Follow instructions in that section.
Then you can see the Browser plugins from:
Windows > Show View > Others > SWT Examples > Browser Demo
or the other one:
Windows > Show View > Others > SWT Examples > Web Browser
Previous Topic:pocket PC - ScrollBar.setVisible()
Next Topic:Problem with table.getSelection() !?!?
Goto Forum:
  


Current Time: Mon Dec 09 18:53:12 GMT 2019

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

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

Back to the top