Community
Participate
Working Groups
Because it is difficult to create and debug CSH, it would be nice if we had tools to help with this task. Particularly, it would be nice if there was a tool that did the following: 1. Identify the context ID for a particular focus spot in the UI at runtime. 2. Search through a code plugin and provide a list of context IDs, possibly identify duplicate IDs. 3. Compare the IDs used in the code plugin to the IDs used in the doc plugin 4. Inline CSH creation/editing tool.
Created attachment 148933 [details] Patch V1 OK, I took a stab at this one, but it doesn't do everything on the list. Right now I took a simple approach. This patch print out the list of registered CSH id's on a failed lookup. For example, I press F1 on a menu item with a context id of 'com.ibm.ccl.help.test.csh.action_csh'. In the log (when the Context Debugging flag is turned on) this is what I would see : ContextManager.getContext("com.ibm.ccl.help.test.csh.action_csh") ContextManager.getContext - no context found Registered Context Provider IDs: -------------------------------- com.ibm.etools.webtools.webpage.template com.ibm.datatools.core.ui.infopop com.ibm.datatools.derbymigration.infopop com.ibm.datatools.xml.schema.infopop com.ibm.etools.ejb.sbf.ui ... -------------------------------- thoughts?
I notice that some code was added to ContextManager.addContext() which is never called, see Bug 291639. One common problem when writing contexts is that users don't realize that a context string is plugin-id.context or how to create it correctly. Maybe we can add the following debug lines a) If the context does not contain a '.' write a message to that effect, otherwise write a message like "plug-in id = my.plugin, context id = myId". b) If there are no context providers for a plug-in write a message to that effect.
Do I have to test each CSH individually? Is there a way to run this tool on all of the IDs in a plugin?.
I have made some changes to org.eclipse.ui.workbench, tracking in Bug 296042. I have amended my approach to a 3 step process, enabled by debug flags (yet to be determined). Step 1: Determine if any UI controls are setting context help to the same context id. If so, log a warning. Step 2: Determine if any context help has the same context id. If so, log a warning. Step 3: If CSH fails to come up when requested, log the missing id, and the list of registered ids.
Deferred to M5
Created attachment 155133 [details] Patch V2 As we wait for Bug 296042 to be resolved, I have continued ahead with the UA side of this bug. Patch V2 does items 2 and 3 of the list in comment 4. CSH debug must be enabled to see these changes: 1) Create a .options file in the working directory with the contents: org.eclipse.help/debug=true org.eclipse.help/debug/context=true 2)Run eclipse as "eclipse.exe -debug" and watch the System.out.prints When debug is on, we will see warnings if a context id exists twice in the same context.xml file, or if a context id exists twice in seperate context.xml files for a given plugin. If a csh event is fired, and no csh id is found, we print out the list of known ids.
Created attachment 155134 [details] Sample output from Patch V2
Created attachment 155268 [details] Patch V3 Patch Version 3: Also adds some case insensitive searching to see if the contextId in question is similar to existing context ids in other plugins. Example Output: The ID searched is foo.TEST_CONTEXT. Did you mean to call setHelp with: [bar.test_context]
Patch committed to HEAD, Fixed.