Community
Participate
Working Groups
Created attachment 118794 [details] snippet that shows the problem If the content control's location of the proposal popup is near the bottom of the screen, the shell location calculation is wrong (over the content control). Please move the popup shell over the top of the content control if the popup shell is to close to the bottom of the screen. Please see the attached snippet and screenshots.
Created attachment 118796 [details] screenshot 1 (wrong)
Created attachment 118797 [details] screenshot 2 (correct)
dirty hack as workaround for this problem: adapter.addContentProposalListener(new IContentProposalListener2() { /* * Copy and paste from ContentProposalAdapter */ private static final int POPUP_OFFSET = 3; public void proposalPopupClosed(ContentProposalAdapter adapter) { // do nothing } public void proposalPopupOpened(ContentProposalAdapter adapter) { try { Field popupField = adapter.getClass().getDeclaredField("popup"); //$NON-NLS-1$ popupField.setAccessible(true); PopupDialog popupDialog = (PopupDialog) popupField.get(adapter); Shell shell = popupDialog.getShell(); Rectangle popupBounds = shell.getBounds(); Control control = adapter.getControl(); Rectangle controlBounds = control.getDisplay().map(control.getParent(), null, control.getBounds()); if (popupBounds.intersects(controlBounds)) { int x = popupBounds.x; int y = (controlBounds.y - popupBounds.height) - POPUP_OFFSET; shell.setLocation(x, y); } } catch (SecurityException e) { // do nothing } catch (NoSuchFieldException e) { // do nothing } catch (IllegalArgumentException e) { // do nothing } catch (IllegalAccessException e) { // do nothing } } });
It should work line in the Java editor: First you should try to reduce the height of the popup to just show less proposals. If reducing the height results in a very small number of proposals shown (e.g. less than 10), then resort to opening the popup on top of the field, upwards, and in full height.
Removing 3.5 target milestone. We are in the end-game now. Please have a look and decide if this should be targeted at 3.6.
This will have to wait, sorry. My bad, it was a tracking/report problem and this feel through the cracks.
Created attachment 135051 [details] Field assist popup location patch v1 This patch should resolve the problem described. With regards to reducing the number of proposals being shown per comment 4, the code seems to be hard coded to show ten proposals at the moment.
Fixed in HEAD >20091015. The patch was too aggressive in deciding to move the popup above the target control. It was using the control's height in conjunction with the control height to determine what to do, but this means that a very tall control (taller than the popup) would always show the popup on top even when there was plenty of room for the popup. Added test cases for the "normal" case and the "move above" case.
verified in WinXP, Build id: I20091027-0100 using find/replace dialog.