Categories
Articles

Eclipse Context Help – Complete

You may be confused as why I am posting about the feature which is covered by so many posts/articles/documentation. Though there are many sites which does this job, I found one or the other configuration aspect is missing from either of the site. I personally followed many articles and could never able to get the context help worked. I had to visit many sites and understand what are all combined configuration aspects are required to get it done. This provoked a thought to put all those things together. Here we go

Prerequisites
I am using Eclipse 3.5 – Galileo due the project requirements. Yes its too old, but due to certain constraint I can’t upgrade it at this stage. Additionally, there is only one RCP product with no additional plugins. Entire source code is part of one project. The product is named as MyRCP

Dependencies
This is the most important part of getting context help activated. Following dependencies should be added to the plugin.xml file.

  • org.eclipse.help
  • org.eclipse.help.ui
  • org.eclipse.help.webapp
  • org.eclipse.equinox.http.jetty

Once the dependencies are added and if you run the product, you may encounter error. If so, open the “Run configuration” for the product, go to Plug-ins tab and Click Add Required Plug-ins button.

Context
Context file is required to define the context identifiers that can be associated with the individual controls. The file should be defined using following



  
    Hi there!!! Good to see you guys. I am happy to help you.
  

Associate help with controls
This is bit simple but tricky part. You need to indicate help system that a control has a context associated with it. This context is used by help system, whenever user presses F1 key.

PlatformUI.getWorkbench().getHelpSystem().setHelp(text, Activator.PLUGIN_ID + ".helloName");

Note that the first argument is the name of the control, while second argument is combination of

  • Plug-in id containing help
  • Context id defined in context file

That is all you need to do, to associate help. Run the application and focus on the control. Press F1 and Tadaaaa!!!

By Carbon Rider

Hi this is Yogesh, welcome to my world. Being passionate about learning new technologies and building frameworks, I end up spending most of my time in front of computer. But over last few months, I realised apart from being good coder and designer (Yes I am) I have something hidden in me. And thats called ART.

Leave a Reply