Java – Adding Help Contents, Search Help using Command Framework

eclipsejavarcp

My colleagues and I are building a new RCP application and trying to find our footing in RCP. My coworker managed to get the Eclipse Help framework working pretty quickly – but he used the old style Actions and ActionBarAdvisor.makeActions() to do it. All of the RCP Menu creation tutorials I've read (the ones that were written post Eclipse 3.3 anyway) advocate depreciating Actions and switching over completely to Commands. So I'm trying to do this. However, I cannot get the help Commands to work – not without using the help actions.

Specifically, I'm attempting to figure out how to add the default Eclipse help menu commands org.eclipse.ui.help.helpContents and org.eclipse.ui.help.helpSearch to my help menu. I've created the menu contribution, and added the commands. But they remain greyed out. I can't find any mention of anything else I have to do to hook them up to the help framework my coworker had working before using actions. If I add the actions for them and register them in make Action, they still work. But I'm trying to do this without Actions. How is this done? What am I not doing?

Best Answer

According to the Command tutorial on vogella.de some common commands need some ActionFactories registered:

Standard commands sometimes map to actions which are contributed via ActionFactory in the class ApplicationActionBarAdvisor. If the ActionFactory returns an IAction you need to register this action. If not these commands are inactive in your menu. For example the following made the reset perspective and welcome command active.

I think, this might be the case with the Help command as well - but I have not tested it. The other possibility would be that there is no enabled handler for the command...