Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
AW: [cdt-dev] Context sensitive help

Harish,
 

> Can I show specific help depending upon on which word F1 is pressed.

 
this is what ICHelpProvider is for. When pressing F1 you get called in
 
 public ICHelpResourceDescriptor[] getHelpResources(ICHelpInvocationContext context, ICHelpBook[] helpBooks, String name)
 
The name parameter contains the word upon which F1 was pressed. You can now put together a html page(s) whose URL(s) you should return wrapped in the  ICHelpResourceDescriptor[].
 
Registering a help context is for UI elements and is not normally done in the help provider.
 
 
Norbert Ploett



Von: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx] Im Auftrag von Harish Dewan
Gesendet: Donnerstag, 16. Februar 2006 06:16
An: cdt-dev@xxxxxxxxxxx
Betreff: [cdt-dev] Context sensitive help

Hi All,

I have a managed C project, in which I have to provide context sensitive help in the text editor.

 

For this I have created my plug-in            ‘test.contextsensitivehelp’

I have used an extension point    ‘org.eclipse.help.contexts’ and defined new ‘contexts’

Below is the code for that.

 

<extension

         point="org.eclipse.help.contexts">

      <contexts

            file="context_help.xml"

            plugin="org.eclipse.cdt.ui"/>

   </extension>

 

In context_help.xml I have defined

<contexts>

<context id="test_help" title="my test help">

                        <description>my test help.</description>

                        <topic href="" label="test Help"/>

            </context>

</contexts>

 

Also I have used one more extension point ‘org.eclipse.cdt.ui.CHelpProvider’  in which I have registered contextID in the java class.

I am not sure if this is correct, but after implementing ICHelpProvider ,its function gets called after F1 is pressed.

<extension

         point="org.eclipse.cdt.ui.CHelpProvider">

      <provider

            class="test.contextsensitivehelp.ContextSensetiveHelp"

            id="test_help"/>

   </extension>

And in class ContextSensetiveHelp.java which implements ICHelpProvider I have registered contextID with setHelp method.

PlatformUI.getWorkbench().getHelpSystem().setHelp(sh,HelpConstants.TEST_HELP);

 

Now if F1 is clicked any where inside the editor it shows test.html along with ‘Editor view’ ‘s html file.

 

Can I show specific help depending upon on which word F1 is pressed.

For example :

In eclipse if there is a code

String test = null;

And if my cursor is there on keyword string and I press F1, it shows

 

Java help:

Javadoc for 'java.lang.String'

In similar manner how can I achieve similar type of functionality for my C code.

 

 

Thanks in advance.

 

Best Regards,

Harish Dewan

System Executive , Advanced Technology Solutions - Semiconductor Solutions Group | KPIT Cummins Infosystems Ltd. | +91 020 2538 2358 x 421 | harishd@xxxxxxxxxxxxxxx | www.kpitcummins.com

 


Back to the top