Skip to main content



      Home
Home » Eclipse Projects » Platform - User Assistance (UA) » Using displayHelpResource()
Using displayHelpResource() [message #469605] Tue, 11 September 2007 13:16 Go to next message
Eclipse UserFriend
I would like the functionality of displayHelpResource() (that is,
launching the help viewer in a separate widow and directing it to a
particular topic/page). However, all examples of usage of that method I
can find in the Eclipse source basically hard-code the href path to the
HTML files, either in the code (yuck!) or in a messages.properties file.
What I'd ideally like to do is use context IDs that are already being
defined by our help plugin.
Is there any way to resolve from context ID to href expected by
displayHelpResource()? From digging into the source it looks like you
can prepend "contextId=" to the href String, but that is just taking me
to the home page of Help instead of the topic defined for that ID.

Thanks in advance,
Eric
Re: Using displayHelpResource() [message #469614 is a reply to message #469605] Tue, 11 September 2007 18:50 Go to previous messageGo to next message
Eclipse UserFriend
Eric Rizzo wrote:
> I would like the functionality of displayHelpResource() (that is,
> launching the help viewer in a separate widow and directing it to a
> particular topic/page). However, all examples of usage of that method I
> can find in the Eclipse source basically hard-code the href path to the
> HTML files, either in the code (yuck!) or in a messages.properties file.
> What I'd ideally like to do is use context IDs that are already being
> defined by our help plugin.
> Is there any way to resolve from context ID to href expected by
> displayHelpResource()? From digging into the source it looks like you
> can prepend "contextId=" to the href String, but that is just taking me
> to the home page of Help instead of the topic defined for that ID.

So I found that I can do this, and it works:
HelpSystem.getContext(myContextID).getRelatedTopics()[0].get Href()

But surely there is a better way to map from a context ID to an href
that can be passed to IWorkbenchHelpSystem.displayHelpResource()...

....right?

Eric
Re: Using displayHelpResource() [message #469623 is a reply to message #469614] Wed, 12 September 2007 14:04 Go to previous messageGo to next message
Eclipse UserFriend
>
> So I found that I can do this, and it works:
> HelpSystem.getContext(myContextID).getRelatedTopics()[0].get Href()
>
> But surely there is a better way to map from a context ID to an href
> that can be passed to IWorkbenchHelpSystem.displayHelpResource()...
>
> ...right?
>
> Eric

A context may have no links, one link or more than one link, which means
that you have to do something like the code above. Be sure to check that
there is at least one link to avoid an exception.
Re: Using displayHelpResource() [message #469646 is a reply to message #469614] Wed, 26 September 2007 17:31 Go to previous messageGo to next message
Eclipse UserFriend
Hi Eric,

I gave your snippet to a developer who tried it for our start page editor.
The existing code looked like:
} else if (event.location
.startsWith("http://com.progress.dataxtend.si/showHelpTopic?id="))
{

// Open a help window to display the specified
help topic.

String topicId = event.location;

topicId = topicId.substring(topicId.indexOf('=') + 1);

PlatformUI.getWorkbench().getHelpSystem()

.displayHelpResource(topicId);

event.doit = false;



He commented out the line starting with PlatformUI... and replaced it with:

HelpSystem.getContext(topicID).getRelatedTopics()[0].getHref ()

In the start page HTML source, he used this URL, where ModelObjectEditor
equals an existing Context ID:

<a href= http://com.progress.dataxtend.si/showHelpTopic?id=ModelObjec tEditor>

It launched the help window but gave a page not found error. Any
suggestions?

thanks!
Ruth Stento



"Eric Rizzo" <eclipse5@rizzoweb.com> wrote in message
news:fc7638$esl$1@build.eclipse.org...
> Eric Rizzo wrote:
>> I would like the functionality of displayHelpResource() (that is,
>> launching the help viewer in a separate widow and directing it to a
>> particular topic/page). However, all examples of usage of that method I
>> can find in the Eclipse source basically hard-code the href path to the
>> HTML files, either in the code (yuck!) or in a messages.properties file.
>> What I'd ideally like to do is use context IDs that are already being
>> defined by our help plugin.
>> Is there any way to resolve from context ID to href expected by
>> displayHelpResource()? From digging into the source it looks like you can
>> prepend "contextId=" to the href String, but that is just taking me to
>> the home page of Help instead of the topic defined for that ID.
>
> So I found that I can do this, and it works:
> HelpSystem.getContext(myContextID).getRelatedTopics()[0].get Href()
>
> But surely there is a better way to map from a context ID to an href that
> can be passed to IWorkbenchHelpSystem.displayHelpResource()...
>
> ...right?
>
> Eric
Re: Using displayHelpResource() [message #469647 is a reply to message #469646] Thu, 27 September 2007 12:14 Go to previous message
Eclipse UserFriend
Ruth Stento wrote:
> Hi Eric,
>
> I gave your snippet to a developer who tried it for our start page editor.
> The existing code looked like:
> } else if (event.location
> .startsWith("http://com.progress.dataxtend.si/showHelpTopic?id="))
> {
>
> // Open a help window to display the specified
> help topic.
>
> String topicId = event.location;
>
> topicId = topicId.substring(topicId.indexOf('=') + 1);
>
> PlatformUI.getWorkbench().getHelpSystem()
>
> .displayHelpResource(topicId);
>
> event.doit = false;
>
>
>
> He commented out the line starting with PlatformUI... and replaced it with:
>
> HelpSystem.getContext(topicID).getRelatedTopics()[0].getHref ()
>
> In the start page HTML source, he used this URL, where ModelObjectEditor
> equals an existing Context ID:
>
> <a href= http://com.progress.dataxtend.si/showHelpTopic?id=ModelObjec tEditor>
>
> It launched the help window but gave a page not found error. Any
> suggestions?

The only thinng I can think of is to check that the topicID is correctly
listed in the help table of contents file (toc.xml) and that the URL
references there actually exists in the help project.

Eric



> "Eric Rizzo" <eclipse5@rizzoweb.com> wrote in message
> news:fc7638$esl$1@build.eclipse.org...
>> Eric Rizzo wrote:
>>> I would like the functionality of displayHelpResource() (that is,
>>> launching the help viewer in a separate widow and directing it to a
>>> particular topic/page). However, all examples of usage of that method I
>>> can find in the Eclipse source basically hard-code the href path to the
>>> HTML files, either in the code (yuck!) or in a messages.properties file.
>>> What I'd ideally like to do is use context IDs that are already being
>>> defined by our help plugin.
>>> Is there any way to resolve from context ID to href expected by
>>> displayHelpResource()? From digging into the source it looks like you can
>>> prepend "contextId=" to the href String, but that is just taking me to
>>> the home page of Help instead of the topic defined for that ID.
>> So I found that I can do this, and it works:
>> HelpSystem.getContext(myContextID).getRelatedTopics()[0].get Href()
>>
>> But surely there is a better way to map from a context ID to an href that
>> can be passed to IWorkbenchHelpSystem.displayHelpResource()...
>>
>> ...right?
>>
>> Eric
>
>
Re: Using displayHelpResource() [message #576631 is a reply to message #469605] Tue, 11 September 2007 18:50 Go to previous message
Eclipse UserFriend
Eric Rizzo wrote:
> I would like the functionality of displayHelpResource() (that is,
> launching the help viewer in a separate widow and directing it to a
> particular topic/page). However, all examples of usage of that method I
> can find in the Eclipse source basically hard-code the href path to the
> HTML files, either in the code (yuck!) or in a messages.properties file.
> What I'd ideally like to do is use context IDs that are already being
> defined by our help plugin.
> Is there any way to resolve from context ID to href expected by
> displayHelpResource()? From digging into the source it looks like you
> can prepend "contextId=" to the href String, but that is just taking me
> to the home page of Help instead of the topic defined for that ID.

So I found that I can do this, and it works:
HelpSystem.getContext(myContextID).getRelatedTopics()[0].get Href()

But surely there is a better way to map from a context ID to an href
that can be passed to IWorkbenchHelpSystem.displayHelpResource()...

....right?

Eric
Re: Using displayHelpResource() [message #576671 is a reply to message #469614] Wed, 12 September 2007 14:04 Go to previous message
Eclipse UserFriend
>
> So I found that I can do this, and it works:
> HelpSystem.getContext(myContextID).getRelatedTopics()[0].get Href()
>
> But surely there is a better way to map from a context ID to an href
> that can be passed to IWorkbenchHelpSystem.displayHelpResource()...
>
> ...right?
>
> Eric

A context may have no links, one link or more than one link, which means
that you have to do something like the code above. Be sure to check that
there is at least one link to avoid an exception.
Re: Using displayHelpResource() [message #586006 is a reply to message #469614] Wed, 26 September 2007 17:31 Go to previous message
Eclipse UserFriend
Hi Eric,

I gave your snippet to a developer who tried it for our start page editor.
The existing code looked like:
} else if (event.location
.startsWith("http://com.progress.dataxtend.si/showHelpTopic?id="))
{

// Open a help window to display the specified
help topic.

String topicId = event.location;

topicId = topicId.substring(topicId.indexOf('=') + 1);

PlatformUI.getWorkbench().getHelpSystem()

.displayHelpResource(topicId);

event.doit = false;



He commented out the line starting with PlatformUI... and replaced it with:

HelpSystem.getContext(topicID).getRelatedTopics()[0].getHref ()

In the start page HTML source, he used this URL, where ModelObjectEditor
equals an existing Context ID:

<a href= http://com.progress.dataxtend.si/showHelpTopic?id=ModelObjec tEditor>

It launched the help window but gave a page not found error. Any
suggestions?

thanks!
Ruth Stento



"Eric Rizzo" <eclipse5@rizzoweb.com> wrote in message
news:fc7638$esl$1@build.eclipse.org...
> Eric Rizzo wrote:
>> I would like the functionality of displayHelpResource() (that is,
>> launching the help viewer in a separate widow and directing it to a
>> particular topic/page). However, all examples of usage of that method I
>> can find in the Eclipse source basically hard-code the href path to the
>> HTML files, either in the code (yuck!) or in a messages.properties file.
>> What I'd ideally like to do is use context IDs that are already being
>> defined by our help plugin.
>> Is there any way to resolve from context ID to href expected by
>> displayHelpResource()? From digging into the source it looks like you can
>> prepend "contextId=" to the href String, but that is just taking me to
>> the home page of Help instead of the topic defined for that ID.
>
> So I found that I can do this, and it works:
> HelpSystem.getContext(myContextID).getRelatedTopics()[0].get Href()
>
> But surely there is a better way to map from a context ID to an href that
> can be passed to IWorkbenchHelpSystem.displayHelpResource()...
>
> ...right?
>
> Eric
Re: Using displayHelpResource() [message #586023 is a reply to message #469646] Thu, 27 September 2007 12:14 Go to previous message
Eclipse UserFriend
Ruth Stento wrote:
> Hi Eric,
>
> I gave your snippet to a developer who tried it for our start page editor.
> The existing code looked like:
> } else if (event.location
> .startsWith("http://com.progress.dataxtend.si/showHelpTopic?id="))
> {
>
> // Open a help window to display the specified
> help topic.
>
> String topicId = event.location;
>
> topicId = topicId.substring(topicId.indexOf('=') + 1);
>
> PlatformUI.getWorkbench().getHelpSystem()
>
> .displayHelpResource(topicId);
>
> event.doit = false;
>
>
>
> He commented out the line starting with PlatformUI... and replaced it with:
>
> HelpSystem.getContext(topicID).getRelatedTopics()[0].getHref ()
>
> In the start page HTML source, he used this URL, where ModelObjectEditor
> equals an existing Context ID:
>
> <a href= http://com.progress.dataxtend.si/showHelpTopic?id=ModelObjec tEditor>
>
> It launched the help window but gave a page not found error. Any
> suggestions?

The only thinng I can think of is to check that the topicID is correctly
listed in the help table of contents file (toc.xml) and that the URL
references there actually exists in the help project.

Eric



> "Eric Rizzo" <eclipse5@rizzoweb.com> wrote in message
> news:fc7638$esl$1@build.eclipse.org...
>> Eric Rizzo wrote:
>>> I would like the functionality of displayHelpResource() (that is,
>>> launching the help viewer in a separate widow and directing it to a
>>> particular topic/page). However, all examples of usage of that method I
>>> can find in the Eclipse source basically hard-code the href path to the
>>> HTML files, either in the code (yuck!) or in a messages.properties file.
>>> What I'd ideally like to do is use context IDs that are already being
>>> defined by our help plugin.
>>> Is there any way to resolve from context ID to href expected by
>>> displayHelpResource()? From digging into the source it looks like you can
>>> prepend "contextId=" to the href String, but that is just taking me to
>>> the home page of Help instead of the topic defined for that ID.
>> So I found that I can do this, and it works:
>> HelpSystem.getContext(myContextID).getRelatedTopics()[0].get Href()
>>
>> But surely there is a better way to map from a context ID to an href that
>> can be passed to IWorkbenchHelpSystem.displayHelpResource()...
>>
>> ...right?
>>
>> Eric
>
>
Previous Topic:launch help url in internal browser
Next Topic:Form layout correct only during resizing?
Goto Forum:
  


Current Time: Wed May 21 02:07:12 EDT 2025

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

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

Back to the top