Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 336833 - [ltk][refactoring] Allow for context help on DIALOG_BASED_USER_INTERFACE
Summary: [ltk][refactoring] Allow for context help on DIALOG_BASED_USER_INTERFACE
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.6.1   Edit
Hardware: PC Windows Vista
: P3 normal (vote)
Target Milestone: 3.7 M6   Edit
Assignee: Markus Keller CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-10 10:45 EST by Chris Gross CLA
Modified: 2011-03-07 12:13 EST (History)
1 user (show)

See Also:


Attachments
Proposed fix (5.36 KB, patch)
2011-02-10 13:24 EST, Markus Keller CLA
no flags Details | Diff
Proposed fix 2 (5.36 KB, patch)
2011-02-11 08:37 EST, Markus Keller CLA
no flags Details | Diff
Fix 3 (5.96 KB, patch)
2011-03-07 12:12 EST, Markus Keller CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Gross CLA 2011-02-10 10:45:04 EST
Currently you have to use a wizard (WIZARD_BASED_USER_INTERFACE) to show any context sensitive help in a refactoring dialog.  This is cumbersome particularly when your refactoring dialog is quite large already and you don't want to add the title area.  

Also since many refactoring dialogs are quite complex, adding the title area tends to clutter the UI and make it harder on users.

On a cursory glance, RefactoringWizardDialog2 would just need extend TrayDialog.
Comment 1 Markus Keller CLA 2011-02-10 13:24:43 EST
Created attachment 188709 [details]
Proposed fix

The lightweight style has been added to remove as much noise as possible from dialogs. Always adding a help button would counter that effort.

But we can make this configurable: With the attached patch, you just have to add the SHOW_HELP_BUTTON flag in your call to the constructor of RefactoringWizard.

Would that suit your needs?
Comment 2 Chris Gross CLA 2011-02-10 13:48:31 EST
That would certainly work but couldn't it be

(Instead of)

setHelpAvailable(wizard.internalShowHelpButton(InternalAPI.INSTANCE));

(could be)

setHelpAvailable(wizard.isHelpAvailable());
Comment 3 Markus Keller CLA 2011-02-11 08:37:21 EST
Created attachment 188772 [details]
Proposed fix 2

I don't see why access to RefactoringWizard#fFlags needs to be hidden at all. Rather than adding an extra method for the new flag, I'll just add a getter for the field.

I didn't choose getFlags() as method name because RefactoringWizard is to be extended by clients and I want to avoid accidental name clashes.
Comment 4 Chris Gross CLA 2011-02-11 08:54:15 EST
I'm a bit confused (not uncommon ;)

Why not reuse the existing isHelpAvailable method on the wizard class?  I believe its intended purpose is exactly the same.  So instead of creating a new flag, getFlags(), etc just call the existing isHelpAvailable().  

If I'm creating a new refactoring wizard I just need to make sure to setHelpAvailable(true) in the constructor.  I think thats true today if I used WIZARD_BASED_USER_INTERFACE.  

-Chris
Comment 5 Markus Keller CLA 2011-02-11 13:50:28 EST
Looks like I was also a bit confused, since I didn't even see that RefactoringWizard already inherits an isHelpAvailable() method ;-)

Unfortunately, the WizardDialog implements two kinds of help:

A) A legacy "Help" button that shows up in the button bar with a text label. This one is controlled by Wizard#set/isHelpAvailable(). For this button to work, each IDialogPage has to implement a performHelp() method. This style is rarely used nowadays.

B) The TrayDialog-style "?" button at the very left of the dialog.
This one is controlled by TrayDialog#set/isHelpAvailable(). This button just invokes the standard Eclipse help (via the SWT.Help event).

Since we don't want the old text button in the lightweight refactoring dialog, (B) is the preferred solution. We could theoretically abuse the helpAvailable bit from the RefactoringWizard to toggle the button, but I think that would be even more confusing.
Comment 6 Chris Gross CLA 2011-02-11 14:25:49 EST
I agree we don't want the "Help" button.  Its sort of cludgy the way it is right now in with the Wizard/TrayDialog both having is/setHelpAvailable and it does different things.  Without knowing better, I would assume Wizard#set/isHelpAvailable would also control the "?".  

I'm of the opinion to abuse RefactoringWizard#is/setHelpAvailable for the "?" on the DIALOG_BASED_USER_INTERFACE.  IMO its quicker, doesn't add any new API, and probably adheres better to a user's expectation.  But the existing legacy handling of Wizard#is/setHelpAvailable does make the whole thing cluttered.  

I'm definitely not going to complain either way - if we get the help working at all I'll be happy :)
Comment 7 Markus Keller CLA 2011-03-07 12:12:53 EST
Created attachment 190570 [details]
Fix 3

I don't want to add even more confusion by changing the meaning of the outdated Wizard#setHelpAvailable(boolean) to something different depending on the RefactoringWizard style.

To ease the pain, I've deprecated RefactoringWizard#setHelpAvailable(boolean) and we'll go with a new flag RefactoringWizard.SHOW_HELP_CONTROL.
Comment 8 Markus Keller CLA 2011-03-07 12:13:33 EST
Fixed in HEAD.