Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 102081

Summary: Abandon the combo box of preferenceDialog
Product: [Eclipse Project] Platform Reporter: shujie liao <shujie_liao>
Component: UIAssignee: Karice McIntyre <Karice_McIntyre>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P2 CC: douglas.pollock, gunnar, michaelvanmeekeren, pwebster, susan, thorbjoern, Tod_Creasey
Version: 3.1   
Target Milestone: 3.2 M3   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
A patch for 102081
none
A patch for 102081
none
A patch for 102081
none
A patch based on comment 4
none
A patch to fix problem 3, 5 and 7 in comment 4
none
A patch to fix problem 3, 5 and 7 in comment 4
none
apply patch to org.eclipse.ui.workbench
none
apply to org.eclipse.ui.workbench
none
apply patch to org.eclipse.ui.workbench
none
Reworked patch due to apply problems
none
apply patch to org.eclipse.ui.workbench
none
NullPointerException trace
none
apply patch to org.eclipse.ui.workbench
none
apply patch to orgeclipse.ui.workbench
none
apply patch to org.eclipse.ui.workbench none

Description shujie liao CLA 2005-06-28 15:46:15 EDT
We try to abandon the combo box, and create a reusable component for type-
ahead that supports a drop down list (much like firefox etc...) that we could 
put in places like the "Open View" dialog and others.
Comment 1 shujie liao CLA 2005-07-04 15:06:39 EDT
Created attachment 24326 [details]
A patch for 102081

Apply from:
org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs
Comment 2 shujie liao CLA 2005-07-06 10:55:15 EDT
Created attachment 24383 [details]
A patch for 102081

Apply against :
org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/
Comment 3 Tod Creasey CLA 2005-07-06 14:12:29 EDT
Second patch released
Comment 4 Michael Van Meekeren CLA 2005-07-06 14:49:55 EDT
Some comments on this patch:
1) open the preferences dialog
- type in "a"
- press ok
- return to the dialog and now 'a' is in the list but it was not a successful search
2) enter a search "key", hit enter to cause "key" to be in the history
- now go back to the text and type 'k', arrow down to the list and select "key"
pressing Enter now should select this
NOTE: as I arrow through the list the text in the text widget should not change
until i press enter, if I hit ESC, the drop down list is closed
3) using arrow down after putting the cursor to the far left of some text causes
an exception, see below

----------  SWT Exception -------------
org.eclipse.swt.SWTException: Widget is disposed
at org.eclipse.swt.SWT.error(SWT.java:2942)
at org.eclipse.swt.SWT.error(SWT.java(Inlined Compiled Code))
at org.eclipse.swt.SWT.error(SWT.java(Inlined Compiled Code))
at org.eclipse.swt.widgets.Widget.error(Widget.java(Inlined Compiled Code))
at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java(Compiled Code))
at org.eclipse.swt.widgets.Control.isVisible(Control.java:1327)
at
org.eclipse.ui.internal.dialogs.FilteredTextTree$2.keyReleased(FilteredTextTree.java:118)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:128)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java(Compiled Code))
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java(Inlined Compiled Code))
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java(Compiled Code))
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:852)
at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:880)
at org.eclipse.swt.widgets.Text.sendKeyEvent(Text.java:1154)
at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:876)
at org.eclipse.swt.widgets.Widget.wmKeyUp(Widget.java:1575)
at org.eclipse.swt.widgets.Control.WM_KEYUP(Control.java(Inlined Compiled Code))
at org.eclipse.swt.widgets.Control.windowProc(Control.java(Compiled Code))
at org.eclipse.swt.widgets.Text.windowProc(Text.java(Compiled Code))
at org.eclipse.swt.widgets.Display.windowProc(Display.java(Compiled Code))
at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java(Inlined Compiled Code))
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java(Compiled Code))
at org.eclipse.jface.window.Window.runEventLoop(Window.java(Compiled Code))
at org.eclipse.jface.window.Window.open(Window.java:787)
at org.eclipse.ui.internal.OpenPreferencesAction.run(OpenPreferencesAction.java:66)
at org.eclipse.jface.action.Action.runWithEvent(Action.java:996)
at
org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:538)
at
org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:488)
at
org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:400)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java(Compiled Code))

------- end of Exception ----------

4) It appears that the filtered search in the Colors and Fonts page no longer works.
5) when the text receives focus it should select all text (same as the default
behaviour provided by the combo previously), unless the focus is given by
clicking in the text with the mouse in which case the cursor should be placed at
the location of the click and no selection made.
6) the text matching should not be case sensitive for the drop down list
7) the sizing of the list is not quite right.  It should always try to show all
text in the horizonal space if possible and make the drop down be some maximum
length (7) but this should be configurable.
8) see bug 102911, the popup should always stay on the screen
Comment 5 shujie liao CLA 2005-07-14 15:14:47 EDT
Created attachment 24783 [details]
A patch for 102081

Apply against:
 org.eclipse.ui.workbench
Fixed all problems except problem 5) in comment 4,it looks that when the focus
gained by mouse down, method "selectAll()" in Text area has kind of conflict
with the way text works.
Comment 6 shujie liao CLA 2005-07-26 09:44:35 EDT
Created attachment 25296 [details]
A patch based on comment 4
Comment 7 Tod Creasey CLA 2005-07-26 10:13:57 EDT
Problem 3 can be replicated

1) Pull down the list by typing something
2) arrow into the list
3) Hit esc
4) hit down arrow
Comment 8 Tod Creasey CLA 2005-07-26 10:25:11 EDT
This patch fixes 1,2,4,6,8
Comment 9 shujie liao CLA 2005-07-28 15:24:24 EDT
Created attachment 25430 [details]
A patch to fix  problem 3, 5 and 7 in comment 4

Run the patch against:
org.eclipse.ui.workbench
Comment 10 shujie liao CLA 2005-08-02 16:24:40 EDT
Created attachment 25584 [details]
A patch to fix  problem 3, 5 and 7 in comment 4

Run the patch against:
org.eclipse.ui.workbench
Comment 11 Tod Creasey CLA 2005-08-02 17:03:57 EDT
Patch released for build >20050802
Comment 12 Douglas Pollock CLA 2005-08-08 11:41:47 EDT
I would like to recommend a rollback of this bug for 3.2 M1.  Bug 106165 is  
not trivial to fix, and seems to be quite bad on Linux. 
 
Comment 13 Douglas Pollock CLA 2005-08-08 12:05:28 EDT
The fix has been rolled back for I20050808-1200. 
Comment 14 Michael Van Meekeren CLA 2005-09-12 09:43:33 EDT
I propose we take another crack at this.  How about:

step 1 - we start by removing the combo in favour of a text
step 2 - add support for an optional dropdown with completions

Comment 15 Michael Van Meekeren CLA 2005-09-27 10:11:25 EDT
Karice this is the bug I mentioned with the code to replace the combo with a
text box in the filtered list
Comment 16 Karice McIntyre CLA 2005-09-28 16:46:10 EDT
Created attachment 27648 [details]
apply patch to org.eclipse.ui.workbench

This patch changes the combo to a text in the preferences dialog and the show
view dialog.  Micheal, can you take a look at this patch and let me know if
this is what you had in mind?
Comment 17 Michael Van Meekeren CLA 2005-09-28 16:58:25 EDT
there seems to be a missing FilteredTextTree class in this patch
Comment 18 Michael Van Meekeren CLA 2005-09-28 17:01:56 EDT
oops... the patch did not apply properly... let me try again
Comment 19 Karice McIntyre CLA 2005-09-28 17:25:55 EDT
Created attachment 27653 [details]
apply to org.eclipse.ui.workbench

Try this patch.  I didn't make any changes to the generated patch file.
Comment 20 Karice McIntyre CLA 2005-09-28 17:27:48 EDT
upping priority since this is part of an M3 plan item.
Comment 21 Karice McIntyre CLA 2005-10-04 18:03:31 EDT
Created attachment 27838 [details]
apply patch to org.eclipse.ui.workbench

Some refinements to my original patch (attachments 27648 and 27653).  This
should select the first relevant selectable element in the tree, fixed a
scrolling problem, and general re-factoring.  Still need to integrate with
filtered text on New Keys preference page (it has a grouping combo).
Comment 22 Karice McIntyre CLA 2005-10-04 18:05:43 EDT
Oops, I was supposed to make this a P2 in comment #20, not a P1.
Comment 23 Tod Creasey CLA 2005-10-05 11:05:47 EDT
Created attachment 27868 [details]
Reworked patch due to apply problems
Comment 24 Karice McIntyre CLA 2005-10-05 11:36:11 EDT
Doug, can you check this patch?  Use the one Tod attached.  
Comment 25 Karice McIntyre CLA 2005-10-06 13:49:50 EDT
Created attachment 27957 [details]
apply patch to org.eclipse.ui.workbench

Added bold label provider to show view dialog
Comment 26 Douglas Pollock CLA 2005-10-06 15:49:52 EDT
Created attachment 27967 [details]
NullPointerException trace

The most recent patch causes this NPE when hitting enter to close the dialog.
Comment 27 Karice McIntyre CLA 2005-10-06 16:31:43 EDT
Created attachment 27979 [details]
apply patch to org.eclipse.ui.workbench

I couldn't actually replicate the NPE but I think I found/fixed the problem. 
Unless you can replicate the problem in the Show View dialog.
Comment 28 Douglas Pollock CLA 2005-10-07 18:34:51 EDT
Sorry this took so long, but this is a large section of code.  I found a few 
problems, but in general it's good.  I'm not sure that all of them have to be 
fixed before committing this code, but at the very least bugs should be opened 
to track any issues that won't be fixed immediately. 
 
 
General Comment 
+ Code should be formatted.  New classes should be entirely formatted.  Old 
classes should have the sections that have been modified formatted. 
 
FilteredTree 
+ Why is the KeyAdapater responding to keyReleased and not keyPressed? 
+ textChanged is being called even if the key pressed was an arrow_down.  This 
results is an extraneous scheduling of the refresh job. 
+ The traverse listener clears the text field if there are no matches.  Is 
this intentional? 
+ I believe there is a race condition between the refresh job and the effects 
of pressing enter.  It's possible that the refresh job has not yet run (in 
response to filter text changes) when the "enter" key is handled by the 
traverse listener. 
+ getElementFont should probably describe what the parameters are 
 
PatternFilter 
+ isElementMatch is missing some javadoc and is a bit rough (e.g., the double 
blind casting) 
 
PreferencePatternFilter 
+ It is possible for an IPreferenceNode to return null from getLabelText, 
which can lead to an NPE as wordMatches(String) does not handle null.  This 
problem occurs twice. 
 
Comment 29 Susan McCourt CLA 2005-10-11 18:02:02 EDT
mvm - I'm looking at step 2 in comment #14 (optional dropdown with 
completions) as a use case for my work on task assistance in text fields (bug 
#106199).

My question is - is the intention that the dropdown contain a list of the 
previous filters that have been used (as the combo did before), or is the 
intention that the dropdown contain the currently filtered list of 
possibilities so that the user can navigate quickly to the item of interest 
(such as the type-ahead mentioned in comment #0)?
Comment 30 Susan McCourt CLA 2005-10-13 17:30:52 EDT
I don't mean to throw a wrench in this, but I've got some general 
questions/concerns about this approach for the Show View dialog (not Karice's 
code, but the UI intent).  

1) In the preference dialog, filtering the list can be useful for reducing the 
tree and then browsing the remaining elements in the tree to find just the 
preference you want.  But in ShowView there is nothing to "browse" when you 
click on the view name, so I'm not sure all the noise of bolded expressions in 
the filtered tree is a good model for selecting the view you want.  And if the 
view category matches the filter, but none of its views match the filter, 
should it be shown at all?  There's nothing to choose or see if you select it 
(unlike preferences where there is page associated with each element in the 
tree).  In this case, it seems like a content proposal dropdown should show 
all views that match the filter and you could just select from there, without 
filtering the tree.  The tree is still there if you are truly browsing the 
categories to see what's available in general, but I'm not even sure that 
filtering it is useful if you have the proposals in a popup.

2) I don't think we should assume that content proposal is a simple 
replacement for a combo.  For example, the text find/replace dialog provides 
both a combo for showing previous search expressions, as well as content 
assist for completing/inserting special expressions in the current field.  In 
both the preferences and show view case, is the intent of content proposal to 
show you things you've typed in there before, or to show you the list of 
results that match the filter?  I think I prefer the latter.  If you really 
wanted to remember previous filters, you could keep the combo.  In a type-
ahead completion model, the proposals could show all preference 
page/preference node names (or view names) that match the filter, and you 
could select directly from the proposals.  You could still filter the tree in 
the preferences to support browsing reduced choices.
Comment 31 Michael Van Meekeren CLA 2005-10-14 10:25:38 EDT
But in ShowView there is nothing to "browse" when you 
click on the view name, so I'm not sure all the noise of bolded expressions in 
the filtered tree is a good model for selecting the view you want. 

> agree, it is overkill to bold in the show view scenario as the hierarchy is
not deep 

 And if the 
view category matches the filter, but none of its views match the filter, 
should it be shown at all?  

> no, this is a bug

In this case, it seems like a content proposal dropdown should show 
all views that match the filter and you could just select from there, without 
filtering the tree.  

> we tried this with preferences and it led to some success, in the end we just
kept it simpler by modifying the actual list, I think duplicating the content in
a drop down makes sense when the amount of content is so huge that you can't
possibly update it in realtime.

The tree is still there if you are truly browsing the 
categories to see what's available in general, but I'm not even sure that 
filtering it is useful if you have the proposals in a popup.

> see above, I think in the end what the user gets is similar

2) I don't think we should assume that content proposal is a simple 
replacement for a combo.  

> agree, the combo also implies you want to remember how you did something
before, i.e. you have a clearer sense of what you might want to do again.

For example, the text find/replace dialog provides 
both a combo for showing previous search expressions, as well as content 
assist for completing/inserting special expressions in the current field.  In 
both the preferences and show view case, is the intent of content proposal to 
show you things you've typed in there before, or to show you the list of 
results that match the filter?  

> no surprise that preferences are having the combo removed because it does not
make sense to show previous entries (which is what it is intended to do) 
> I believe that in general the intent could be to do either case, but for both
prefs. and show view that is not necessary as the scenario is just not complex
enough... others might be .. like where you have the Keys preference page
allowing a user to filter on 100s of commands.


I think I prefer the latter.  If you really 
wanted to remember previous filters, you could keep the combo.  In a type-
ahead completion model, the proposals could show all preference 
page/preference node names (or view names) that match the filter, and you 
could select directly from the proposals.  You could still filter the tree in 
the preferences to support browsing reduced choices.

> see above, I'd vote we start by not supporting proposals in either of those
two cases to begin with, proposals will make more sense in a wizard where you're
entering a package name for example for a class... 

Comment 32 Michael Van Meekeren CLA 2005-10-14 10:44:32 EDT
oh. and I just read comment #29 , I guess the answer is that we could put them
in the preferences or show view dialog as completions on the existing items
which could then be selected, and NOT filter the list in that case, but I'd
rather see a popup used in a more sensible place... how about the new file
dialog where you are entering a workspace path for the parent folder of the
file?  We could do completion based on the folders... much like many save/open
dialogs do.
Comment 33 Susan McCourt CLA 2005-10-14 11:30:08 EDT
Thanks for the explanation.  I won't worry about these scenarios anymore for my 
text field/assistance work.  I'll crawl back to bug #106199 and look for other 
interesting use cases, such as those you mention.
Comment 34 Karice McIntyre CLA 2005-10-18 14:39:20 EDT
Created attachment 28401 [details]
apply patch to orgeclipse.ui.workbench 

This patch addresses the feedback from comment #28, except for the race
condition.  Also the bold fonts in the show view dialog were removed.  The bug
where a matching category appears but has no children in the show view dialog
was not yet addressed.
Comment 35 Karice McIntyre CLA 2005-10-18 14:54:26 EDT
Doug, can you take a look at the latest patch?
Comment 36 Douglas Pollock CLA 2005-10-20 12:52:30 EDT
Paul: Can you look at Karice's patch? 
Comment 37 Paul Webster CLA 2005-10-20 15:07:24 EDT
The patch looks good ... PreferencePatternFilter and ViewPatternFilter need to
have the IBM copyright added to the front ... it should be ready to go once we
add those.


Additional comments:

It looks like the NPE was fixed, also from comment #28:

+ I believe there is a race condition between the refresh job and the effects 
of pressing enter.  It's possible that the refresh job has not yet run (in 
response to filter text changes) when the "enter" key is handled by the 
traverse listener. 

We should open a new bug to track this ... should the traverse listener cancel
any outstanding refresh jobs?

+ isElementMatch is missing some javadoc and is a bit rough (e.g., the double 
blind casting) 

The double blind casting is still there, possibly updated if this class needs to
be refactored to support different content types?

Later,
PW
Comment 38 Karice McIntyre CLA 2005-10-21 10:51:30 EDT
Created attachment 28603 [details]
apply patch to org.eclipse.ui.workbench

Added copyrights.

As for the double-blind casting in PatternFilter.java, since we are only using
this class for filtering trees it should be fine for now.  Note this code was
present in the orignal version of the class (Apr 2004), this patch just moved
it to another method.  

Remaining issues: investigate race condition, make filtered tree work with
categories (example, experimental Keys preference page), identify other useful
places to use a filtered tree.
Comment 39 Paul Webster CLA 2005-10-21 13:23:19 EDT
Released in HEAD >20051021

PW
Comment 40 Karice McIntyre CLA 2005-10-26 18:15:14 EDT
bug 113908 was opened to address the remaining issues.
Comment 41 Karice McIntyre CLA 2005-11-01 12:02:48 EST
verified in 20051101
Comment 42 Nick Edgar CLA 2005-11-03 10:22:21 EST
*** Bug 87901 has been marked as a duplicate of this bug. ***