Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 374058 - Quick Access drop-down list is overly wide
Summary: Quick Access drop-down list is overly wide
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: IDE (show other bugs)
Version: 4.2   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 4.2 M7   Edit
Assignee: Curtis Windatt CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 351474 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-03-13 07:01 EDT by Rüdiger Herrmann CLA
Modified: 2012-05-01 14:33 EDT (History)
3 users (show)

See Also:


Attachments
Screenshot of Quick Access dop-down (154.70 KB, image/png)
2012-03-13 07:01 EDT, Rüdiger Herrmann CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Rüdiger Herrmann CLA 2012-03-13 07:01:44 EDT
Created attachment 212541 [details]
Screenshot of Quick Access dop-down

When starting to type in the "Quick Access" field, a drop-down with matching items appears. Only the width is way wider than necessary. See the attached screenshot.

Reproducible with 4.2 M5
Comment 1 Curtis Windatt CLA 2012-03-22 10:44:06 EDT
*** Bug 351474 has been marked as a duplicate of this bug. ***
Comment 2 Curtis Windatt CLA 2012-04-03 16:41:38 EDT
There doesn't seem to be a problem with the actual window sizing.  The shell size is persisted with a default of 350 wide (which is quite reasonable).  You can resize the popup shell to be more reasonable.

I suspect anyone reusing a workspace from 3.x will see a much larger popup as the same dialog settings id was used.  If we are concerned about this, simply changing the dialog settings constant would fix it.

However, the positioning of the popup leaves something to be desired.  Unlike context menus and popup menu's, the quick access shell does not respect the edge of my monitor or attempt to open inside the parent shell.  Several jface methods to do the sizing/positioning were copied into SearchField.  I will try to modify these methods to be a little smarter.
Comment 3 Curtis Windatt CLA 2012-04-03 17:50:13 EDT
Here is a possible improvement, replacing layoutShell() in SearchField with the following improves the placement to use more of the shell space.

	void layoutShell() {
		Display display = text.getDisplay();
		Rectangle tempBounds = text.getBounds();
		Rectangle compBounds = display.map(text, null, tempBounds);
		int preferredWidth = dialogWidth == -1 ? 350 : dialogWidth;
		int width = Math.max(preferredWidth, compBounds.width);
		int height = dialogHeight == -1 ? 250 : dialogHeight;
		
		// If size would extend past the right edge of the shell, try to move it
		// to the left of the text
		Rectangle shellBounds = text.getShell().getBounds();
		if (compBounds.x + width > shellBounds.x + shellBounds.width){
			compBounds.x = Math.max(shellBounds.x, (compBounds.x + compBounds.width - width));
		}
		
		shell.setBounds(getConstrainedShellBounds(display, new Rectangle(compBounds.x, compBounds.y
				+ compBounds.height, width, height)));
		shell.layout();
	}
Comment 4 Michael Rennie CLA 2012-04-05 11:43:03 EDT
(In reply to comment #3)
> Here is a possible improvement, replacing layoutShell() in SearchField with the

Testing in windows and I found that the loadDialog / storeDialog methods that actually save / restore the sizings are only called when the workbench starts and shuts down. Feels like we need to call loadDialog each time time the widget will show and storeDailog each time the widget will hide. My two cents.
Comment 5 Michael Rennie CLA 2012-04-05 12:40:55 EDT
(In reply to comment #4)
> (In reply to comment #3)
> > Here is a possible improvement, replacing layoutShell() in SearchField with the
> 
> Testing in windows and I found that the loadDialog / storeDialog methods that
> actually save / restore the sizings are only called when the workbench starts
> and shuts down. Feels like we need to call loadDialog each time time the widget
> will show and storeDailog each time the widget will hide. My two cents.

Perhaps we should toast the asyncExec in checkFocusLost? I removed it and the dialog is much more responsive on Win7 and the sizings started working.
Comment 6 Michael Rennie CLA 2012-04-05 13:11:44 EDT
(In reply to comment #5)
> (In reply to comment #4)
> > (In reply to comment #3)
> > > Here is a possible improvement, replacing layoutShell() in SearchField with the
> > 
> > Testing in windows and I found that the loadDialog / storeDialog methods that
> > actually save / restore the sizings are only called when the workbench starts
> > and shuts down. Feels like we need to call loadDialog each time time the widget
> > will show and storeDailog each time the widget will hide. My two cents.
> 
> Perhaps we should toast the asyncExec in checkFocusLost? I removed it and the
> dialog is much more responsive on Win7 and the sizings started working.

It would also be very cool if you could tab from the text box to the shell...
Comment 7 Eric Moffatt CLA 2012-04-05 13:47:28 EDT
Curtis, sorry...I was unaware that there was so much shared code. For my money I'd forget how it's currently being done and simply save the location and size info in the MToolControl's 'persistentData' field...

That will make the timing of the current save / restore no longer relevant...
Comment 8 Curtis Windatt CLA 2012-04-05 17:17:40 EDT
Fix for positioning:
https://github.com/mrennie/eclipse.platform.ui/commit/eedb494743dfe13161780167422fd1bb5dc7f4cd

This fix corrects the positioning and clarifies the code in a few places that caused a lot of confusion while debugging.  I still haven't reproduced the sizing issue in linux so I will have to do some additional testing in Windows.  

Eric, if you see the resizing again, please take a guess at steps.
Comment 9 Curtis Windatt CLA 2012-04-05 17:20:18 EDT
> It would also be very cool if you could tab from the text box to the shell...

This is possible using a traverse listener, but in practice is useless since the arrow keys, enter and escape already work.

> Testing in windows and I found that the loadDialog / storeDialog methods that
> actually save / restore the sizings are only called when the workbench starts
> and shuts down. Feels like we need to call loadDialog each time time the widget
> will show and storeDailog each time the widget will hide. My two cents.

As the shell is not closing when focus is lost, there is no need to write out the dialog settings.  The fields should be good enough.  The way the code is structured certainly leaves something to be desired.  So this is a good candidate for refactoring in the future.

> Perhaps we should toast the asyncExec in checkFocusLost? I removed it and the
> dialog is much more responsive on Win7 and the sizings started working.

Without the async, the popup will fail to close on focus lost as the focus event needs time to complete.  I made a few attempts to find an alternative that would be faster, but each attempt caused the shell to close unexpectedly (bad) or stay open indefinitely (really bad).
Comment 10 Michael Rennie CLA 2012-04-09 12:09:21 EDT
(In reply to comment #9)
> > It would also be very cool if you could tab from the text box to the shell...
> 
> This is possible using a traverse listener, but in practice is useless since
> the arrow keys, enter and escape already work.
> 

Yeah, once I realized the up / down arrow keys worked like that, the tab key use is bogus.

I tested the changes in the branch and they work fine for me on Win7 x64.
Comment 12 Michael Rennie CLA 2012-05-01 14:33:36 EDT
verified in 

Version: 4.2.0
Build id: I20120430-1800