Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Display HTML content into IEditorPart with SWT browser widget by fetching the content from the docum
Display HTML content into IEditorPart with SWT browser widget by fetching the content from the docum [message #503119] Thu, 10 December 2009 22:51 Go to next message
Alex Le is currently offline Alex Le
Messages: 649
Registered: July 2009
Senior Member
Hi,

I have a documentation plug-in that has all the HTML contents. Here is
what I am trying to do: Display HTML content from the documentation plug-in.

Below is what I have done so far.

Bundle bundle = Platform.getBundle(DOCUMENTATION_PLUGIN_ID); //$NON-NLS-1$
URL url = bundle.getResource(HTML_FILE);

// Read the content off the URL
String content = readContent(URL);


I dump 'content' into my IEditorPart whose control is the SWT Browser
widget rather than the StyledText widget. That is, my IEditorPart is
like the class org.eclipse.ui.internal.browser.WebBrowserEditor.

The content is display; HOWEVER, there is one problem. And references
to images, that are from the documentation plug-in, are not displayed.
I have the feeling that the HREFs must be relative to the documentation
plug-in somehow.

How would I solve this?

Thanks.
Re: Display HTML content into IEditorPart with SWT browser widget by fetching the content from the d [message #503120 is a reply to message #503119] Thu, 10 December 2009 23:07 Go to previous messageGo to next message
Alex Le is currently offline Alex Le
Messages: 649
Registered: July 2009
Senior Member
AL wrote:
> Hi,
>
> I have a documentation plug-in that has all the HTML contents. Here is
> what I am trying to do: Display HTML content from the documentation
> plug-in.
>
> Below is what I have done so far.
>
> Bundle bundle = Platform.getBundle(DOCUMENTATION_PLUGIN_ID); //$NON-NLS-1$
> URL url = bundle.getResource(HTML_FILE);
>
> // Read the content off the URL
> String content = readContent(URL);
>
>
> I dump 'content' into my IEditorPart whose control is the SWT Browser
> widget rather than the StyledText widget. That is, my IEditorPart is
> like the class org.eclipse.ui.internal.browser.WebBrowserEditor.
>
> The content is display; HOWEVER, there is one problem. And references
> to images, that are from the documentation plug-in, are not displayed. I
> have the feeling that the HREFs must be relative to the documentation
> plug-in somehow.
>

Sorry, I didn't get the above correctly and let me clarify the above a
bit more.

So, I have a plug-in (let's call it pluginA) that has an IEditorPart,
whose control is the SWT browser widget. I would like to diplay HTML
content into the IEditorPart. The HTML content has an HREF that is
displayed as an icon stored in the pluginA's jar file. When the icon is
clicked upon, a browser is supposed to open with the HREF linked into
the documentation plug-in's HTML file.

My problems are:

1. The icon is NOT displayed at all.

2. Clicking on the icon will not open the browser the HREF linked into
the documentation plug-in.


> How would I solve this?
>
Re: Display HTML content into IEditorPart with SWT browser widget by fetching the content from the d [message #503127 is a reply to message #503120] Fri, 11 December 2009 00:25 Go to previous message
Alex Le is currently offline Alex Le
Messages: 649
Registered: July 2009
Senior Member
AL wrote:
> AL wrote:
>> Hi,
>>
>> I have a documentation plug-in that has all the HTML contents. Here
>> is what I am trying to do: Display HTML content from the documentation
>> plug-in.
>>
>> Below is what I have done so far.
>>
>> Bundle bundle = Platform.getBundle(DOCUMENTATION_PLUGIN_ID);
>> //$NON-NLS-1$
>> URL url = bundle.getResource(HTML_FILE);
>>
>> // Read the content off the URL
>> String content = readContent(URL);
>>
>>
>> I dump 'content' into my IEditorPart whose control is the SWT Browser
>> widget rather than the StyledText widget. That is, my IEditorPart is
>> like the class org.eclipse.ui.internal.browser.WebBrowserEditor.
>>
>> The content is display; HOWEVER, there is one problem. And references
>> to images, that are from the documentation plug-in, are not displayed.
>> I have the feeling that the HREFs must be relative to the
>> documentation plug-in somehow.
>>
>
> Sorry, I didn't get the above correctly and let me clarify the above a
> bit more.
>
> So, I have a plug-in (let's call it pluginA) that has an IEditorPart,
> whose control is the SWT browser widget. I would like to diplay HTML
> content into the IEditorPart. The HTML content has an HREF that is
> displayed as an icon stored in the pluginA's jar file. When the icon is
> clicked upon, a browser is supposed to open with the HREF linked into
> the documentation plug-in's HTML file.
>
> My problems are:
>
> 1. The icon is NOT displayed at all.
>
> 2. Clicking on the icon will not open the browser the HREF linked into
> the documentation plug-in.
>

Here is the HTML content to be dumped into the IEditorPart. Note of the
href statements.

<html><body style="margin:0;overflow:auto;" text="#000000"
bgcolor="#ffffe1"><A
href="file:plugins\com.abc.eclipse.doc_plugin_1.0.0\html/toc.html "
TITLE="Help"><IMG
SRC=" file:plugins\com.abc.eclipse.doc_plugin_1.0.0\icons/obj16/he lp.gif "
BORDER="0" ALIGN="RIGHT"></A><font size=2><b><u>some
text</b></u></font></body></html>

One more correction from my previous post. The icon to be displayed is
from the documentation plug-in not pluginA, as I mentioned previously.
Still, the problem is the same.

Thanks.

>
>> How would I solve this?
>>
Previous Topic:Eclipse Command farmework
Next Topic:Dealing with sources which already contain a .project file
Goto Forum:
  


Current Time: Fri Oct 24 20:52:21 GMT 2014

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

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