Bug 62703 refactoring & source quick menus location should be confined to workbench [quick menu]
I20040518 M9 testpass 1. Use eclipse without it covering the entire screen, but merely the lower left 2. Open JavaEditor.java 3. Put the editor caret somewhere on AbstractSelectionChangedListener::install 4. Without changing the selection, scroll to the very end of the end of the file 5. Press Alt+Shift+T/S to bring up the quick menu -> expected: the menu shows up somewhere in the eclipse workbench -> actual: the menu shows up on the very top of the screen, over other applications.
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/QuickMenuAction.java
return binding.getKeySequence().format();
			}
		}
		return null; 
	}
	
	private Point computeMenuLocation(Control focus) {
		if (focus instanceof StyledText) {
			return computeMenuLocation((StyledText)focus);
		} else if (focus instanceof Tree) {
			return computeMenuLocation((Tree)focus);
		} else if (focus instanceof Table) {
			return computeMenuLocation((Table)focus);
		}
		return null;
	}
	
	/**
	 * Hook to compute the menu location if the focus widget is
	 * a styled text widget.
	 * 
	 * @param text the styled text widget that has the focus
	 * 
	 * @return a display relative position of the menu to pop up
	 */
	protected Point computeMenuLocation(StyledText text) {
		Point result= text.getLocationAtOffset(text.getCaretOffset());
		result.y+= text.getLineHeight();
		return text.toDisplay(result);
	}