Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 128425 - [Help] Help button should not show up in dialogs without help context ID
Summary: [Help] Help button should not show up in dialogs without help context ID
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: User Assistance (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.2 M6   Edit
Assignee: Curtis d'Entremont CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-02-17 10:40 EST by Markus Keller CLA
Modified: 2006-03-07 10:40 EST (History)
5 users (show)

See Also:


Attachments
patch (10.31 KB, patch)
2006-02-22 10:20 EST, Curtis d'Entremont CLA
no flags Details | Diff
revised patch (8.29 KB, patch)
2006-02-22 11:34 EST, Curtis d'Entremont CLA
no flags Details | Diff
updated patch (8.28 KB, patch)
2006-03-03 12:38 EST, Curtis d'Entremont CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2006-02-17 10:40:14 EST
I20060216-2000

The Help button should not show up in dialogs without help context ID. Examples in  this build are the 'Source > Clean Up...' wizard or 'plugin context menu > PDE Tools > Organize Manifests...'.
Comment 1 Dejan Glozic CLA 2006-02-17 10:50:44 EST
This is not as easy as it seems. We would need to check the wizard control and recursively try all the children to check for help IDs. 

Some wizards can completely ignore static help ID and instead show help by adding the help listener to controls. 

We would prefer that ALL dialogs have help content. FOr years our context help was spotty - we want this to change. Help button just makes this more obvious.
Comment 2 Curtis d'Entremont CLA 2006-02-17 10:53:41 EST
...so the workaround to the bug is to add useful context help to all your dialogs :-)
Comment 3 Markus Keller CLA 2006-02-17 12:06:58 EST
I know about the "workaround" and I would also prefer that the world was full of up-to-date help text. However, I'm not sure all eclipse plugin providers will be able to spend the resources it needs to add help to every little dialog.

IMO, its a bit a bold decision to force all downstream plugins to add help. Does this enforcement have PMC approval?

Does that mean that every little developer writing a plugin for Eclipse now has to ship with full-fledged help just to not look stupid? 
Comment 4 Curtis d'Entremont CLA 2006-02-17 12:13:16 EST
Products can turn off the "show help everywhere" flag if they desire, so we are not forcing it on downstream products - we just turned it on for the sdk.
Comment 5 Markus Keller CLA 2006-02-17 12:49:01 EST
But if it's enabled in the Eclipse SDK product, then the button still shows up in every dialog of every plugin I download from sourceforge and add to my install, right? That's not too small a burden on every participant in the Eclipse ecosystem.

Note: I can accept that we want to try to become help-complete in the SDK, but I think this obligation should not be imposed on all third-party plugins as well.
Comment 6 Dejan Glozic CLA 2006-02-19 11:23:16 EST
I think I have a simple solution to this problem that would not require any breaking changes:

Right now, the decision to show the help button is based on the following logic:

		// create help control if needed
        if (isHelpAvailable() || isDialogHelpAvailable()) {

where 'isHelpAvailable()' is local variable for each dialog instance, and
'isDialogHelpAvailable()' is static and is currently turned on for the SDK.

I suggest the following change:

1) Prime the initial value of the 'helpAvailable' field by calling 'isDialogHelpAvailable()' static method.

2) Change the logic to only check the local help flag:

		// create help control if needed
        if (isHelpAvailable()) {

Scenarios:

1) Global flag is 'false'. By default, local flag will be false as well. Help button will NOT show unless 'setHelpAvailable(true)' is called by the dialog that extends TrayDialog.

2) Global flag is 'true'. Local flag is initially set to true. Help button WILL show unless 'setHelpAvailable(false)' is called by the dialog that extends TrayDialog.

I think this change will give us the ballance we are looking for. For RCPs, nothing changes since the logic in 3.1. For SDK, the button will be shown by default (this is what we want) but clients can programmatically turn it off by calling 'setHelpAvailable(false)'. This is easier for us than trying to scan the client and try to predict if context help is provided (this is costly and cannot be 100% accurate).
Comment 7 Dejan Glozic CLA 2006-02-19 11:29:38 EST
Note also that 'every litle participant' should still strive to play by the rules of the product it tries to extend. Eclipse SDK sets the standard that every nontrivial dialog (i.e. preference page, wizard etc.) must provide meaningful context help. With the change I propose above, they have a choice of providing this help (the desired outcome), or calling 'setHelpAvailable(false)' as a declaration that they don't want to or don't have time to do so. A formal declaration like this is 100% accurate and has no performance penalties.

A note (in case this was not obvious): 'setHelpAvailable(false)' must be called in the constructor i.e. before the contents is created.
Comment 8 Tod Creasey CLA 2006-02-20 09:02:57 EST
I agree that we do not want to be crawling controls to determine if any of them have a help context - that would be really slow. I am not sure that I am crazy about having another field added to the dialog for this support.

First off we should limit this to the TrayDialog as that is the only type where this is relevant. Also the tray may be used for more than help - perhaps we should think more in terms of "isTrayAvailable()" and not limit it to the help system (although that is how we will use it).
Comment 9 Dejan Glozic CLA 2006-02-20 09:51:02 EST
Tod, my proposal does not involve adding more fields or methods. It only changes the logic used to determine when to show the help button and how the EXISTING field is initialized.
Comment 10 Tod Creasey CLA 2006-02-20 10:06:57 EST
My mistake - I was looking in Dialog not TrayDialog.

It sounds fine to me then.
Comment 11 Dejan Glozic CLA 2006-02-20 10:33:25 EST
Markus, what's your take? Do you think that calling 'setHelpAvailable(false)' is reasonable for SDK plug-in authors that don't have time or resources to provide context help.
Comment 12 Markus Keller CLA 2006-02-21 04:29:04 EST
With the changes proposed in comment 6, clients would have the possibility to opt out of getting a help button. That's certainly better than what we have today.

Still, plug-ins that have been written for < 3.2 M5 will get the button unless they release a new version. I'm still not convinced that showing a non-functional button is the best way to urge developers to provide context help. While it may be helpful in the development phase, I think the switch should be turned off in the final release. Dialog providers should explicitly opt in to have the button enabled.
Comment 13 Dejan Glozic CLA 2006-02-21 08:08:34 EST
The reason we want to do it is is because the availability of 'F1' (or Ctrl+F1 on Linus or 'Help' key on Mac) was not self-evident up to now. We had an accelerator for a function that was not available in a first-class way. Our feedback indicates that people cannot stop pressing the button :-) and that it made them avare of the wealth of information they have in the new help tray.

Curtis, perhaps what we can do it attach a default help Id to the tray dialog so that even if the client itself does not have it, we will open the help tray with some generic blurb (similar to the workbench where it opens the 'catch all' help about workbench parts). At least this way users can switch to the search page and look for stuff, or browse help topics, and the button will not appear to be broken.
Comment 14 Markus Keller CLA 2006-02-21 09:23:29 EST
+1 for a generic blurb. And if the blurb was a wiki-style editable help page, users could add missing help contents and send us a patch for it. ;-)
Comment 15 Curtis d'Entremont CLA 2006-02-21 16:41:49 EST
Upon further investigation, I see that the current default behavior of traversing the widget tree to find the first help listener does not stop at the dialog shell but continues to the parent workbench shell. So in many cases where you have dialogs that are missing context help, it still shows up with the generic workbench help. The two examples in the bug description are actually happening for two other reasons:

Organize Manifests... - This one does not show help because it is using a context help id that is not defined anywhere. This case can be handled in general by modifying the workbench help listener to show default help content if it can't find the context id definition.

Clean up... - This one does not show help because WizardDialog always adds a help listener to the shell that delegates to the pages' performHelp(). However the default is to do nothing here. Unfortunately I can't just use the API to summon a default context help because that's in workbench, and we're in jface. I would need to add API for some sort of default help listener. I also can't change the default behavior in DialogPage#performHelp to continue traversing the widget tree because the javadoc says the default implementation does nothing. I can, however, override this in WizardPage to keep crawling up the tree. I don't think this change breaks any API contract...

Dejan and Tod, do you have any concerns about this approach?
Comment 16 Tod Creasey CLA 2006-02-21 16:49:32 EST
Other than it is the opposite of what Dejan suggested no <grin>. We should not be traversing anything - we will be in conflict with with SWT who already do that with the API for setting help listeners.

I think the idea of the generic blurb is fine but the only changes we really want to make should involve whether or not we show the ? button - we should not try and fight the SWT behaviour.

I suspect I am missing something here. Dejan or Curtis could you outline what you are thinking of doing now?
Comment 17 Curtis d'Entremont CLA 2006-02-21 16:58:53 EST
I guess I should clarify my solution is on how to get the generic blurb. Dejan suggested adding a context help id to TrayDialog but we can't do this because it's in jface, and contributing context help to a control is more than just putting an id.. you have to add a listener that does something concrete.. and there's nothing concrete we can do at the jface level.

Also, we are already traversing in TrayDialog for the help button. See helpPressed(). This is necessary to emulate the OS's behavior of F1/Ctrl-F1/Help. We need to send a help event on something that has a listener, otherwise our event is ignored. Thus we traverse up the tree..
Comment 18 Dejan Glozic CLA 2006-02-21 17:32:32 EST
To further clarify :-), all discussion about crawling is IN ADDITION to my proposal. My proposal still stands and is for people who want to explicitly make the help button go away. This covers plug-ins currently developing on top of 3.2.

'Generic id' idea is just a twist to this to cover plug-ins that have already been developed and have been dropped in 3.2's plug-ins directory. They have no context help and didn't have a chance to call 'setHelpAvailable(false)'. For them we want to show something, anything really in order to avoid a 'broken' feel when you press the Help button and nothing happens.
Comment 19 Dejan Glozic CLA 2006-02-21 17:34:50 EST
My idea is still hazy but we can add a Shell listener to the Display in the workbench and attach a Help listener to all dialogs that extend TrayDialog.
Comment 20 Tod Creasey CLA 2006-02-22 08:50:59 EST
Dejan why don't you try and hack something up so that we are clearer on what you are doing. It sounds like you are going to use the SWT API which is I think the right decision but it would help to see code so that we can understand it.
Comment 21 Curtis d'Entremont CLA 2006-02-22 10:20:50 EST
Created attachment 35145 [details]
patch

Here's a patch for you to look at. Note - not fully tested or complete yet.
Comment 22 Dejan Glozic CLA 2006-02-22 10:37:04 EST
Curtis, we could save one call to 'setHelpAvailable' in the TrayDialog constructor if you initialize 'helpAvailable' field directly in declaration:

boolean helpAvailable = isDialogHelpAvailable();

It is OK to make this call because 'isDialogHelpAvailable()' is static.
Comment 23 Curtis d'Entremont CLA 2006-02-22 11:14:24 EST
After discussing with Dejan, I've come to the conclusion that we can't solve this for all cases without touching API. The case we can't solve is with multi-page dialogs like wizards and preferences. Please ignore my last patch, I will post a new one soon.
Comment 24 Curtis d'Entremont CLA 2006-02-22 11:34:46 EST
Created attachment 35151 [details]
revised patch

Tod, can you submit the jface and workbench parts of this patch?

This patch fixes:
- Context help id is set on widget but not defined anywhere (e.g. PDE Tools -> Organize Manifests)
- Allows dialogs to explicitly turn off help button

This patch does not fix:
- Missing context help on multi-page dialogs (e.g. Source -> Clean Up...)
Comment 25 Curtis d'Entremont CLA 2006-03-02 18:51:45 EST
Tod, can you apply? (see previous comment)
Comment 26 Tod Creasey CLA 2006-03-03 08:59:21 EST
The SelectionStatusDialog part of the patch is out of date so I can't apply it.

One thing I am not sure about - in createButtonBar of TrayDialog

if (isHelpAvailable()

became
 
if (isHelpAvailable() || isDialogHelpAvailable()) 

shouldn't this be an && - this condition is actually less restrictive than before
Comment 27 Curtis d'Entremont CLA 2006-03-03 12:38:51 EST
Created attachment 35685 [details]
updated patch

Here's the updated patch. Tod, the change actually goes in the opposite way, i.e.:

if (isHelpAvailable() || isDialogHelpAvailable()) 

becomes

if (isHelpAvailable()

This way, you can set help to false for the dialog and it will not show the help button.
Comment 28 Tod Creasey CLA 2006-03-06 11:20:44 EST
JFace and Workbench portions have been released for build >20050306
Comment 29 Curtis d'Entremont CLA 2006-03-06 12:15:52 EST
Benno, Markus, or Daniel, can you submit the search portion of this patch? I'm hoping one of you has access..
Comment 30 Curtis d'Entremont CLA 2006-03-06 12:17:18 EST
Darin, could you submit the debug.ui portion of this patch? It's a one-line change to react to the change in TrayDialog that allows you to turn off the help button.
Comment 31 Markus Keller CLA 2006-03-06 12:31:38 EST
(In reply to comment #29)
> Benno, Markus, or Daniel, can you submit the search portion of this patch? I'm
> hoping one of you has access..

Too bad ;-). Only Dani would have access, but he's not around. CCing Martin as the last available Search committer.
Comment 32 Darin Wright CLA 2006-03-06 12:43:11 EST
Applied debug portion.
Comment 33 Martin Aeschlimann CLA 2006-03-07 03:23:01 EST
released the search part of the patch > 20060307
Comment 34 Curtis d'Entremont CLA 2006-03-07 10:40:22 EST
All the pieces are in.. marking as fixed. Thanks everyone