Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Platform - User Assistance (UA) » Using displayHelpResource()
Using displayHelpResource() [message #469605] Tue, 11 September 2007 17:16 Go to next message
Eric Rizzo is currently offline Eric Rizzo
Messages: 2253
Registered: July 2009
Senior Member
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 22:50 Go to previous messageGo to next message
Eric Rizzo is currently offline Eric Rizzo
Messages: 2253
Registered: July 2009
Senior Member
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 18:04 Go to previous messageGo to next message
Chris Goldthorpe is currently offline Chris Goldthorpe
Messages: 815
Registered: July 2009
Senior Member
>
> 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 21:31 Go to previous messageGo to next message
Ruth Stento is currently offline Ruth Stento
Messages: 14
Registered: July 2009
Junior Member
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 16:14 Go to previous message
Eric Rizzo is currently offline Eric Rizzo
Messages: 2253
Registered: July 2009
Senior Member
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 22:50 Go to previous message
Eric Rizzo is currently offline Eric Rizzo
Messages: 2253
Registered: July 2009
Senior Member
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 18:04 Go to previous message
Chris Goldthorpe is currently offline Chris Goldthorpe
Messages: 815
Registered: July 2009
Senior Member
>
> 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 21:31 Go to previous message
Ruth Stento is currently offline Ruth Stento
Messages: 14
Registered: July 2009
Junior Member
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 16:14 Go to previous message
Eric Rizzo is currently offline Eric Rizzo
Messages: 2253
Registered: July 2009
Senior Member
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:Help View vs Help Browser
Next Topic:How do I use bold text in cheat sheet item or subitem elements
Goto Forum:
  


Current Time: Wed Sep 24 04:40:28 GMT 2014

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

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