Bug 4793 Canvas.scroll not working when source y around 65536 (1GIXDPD)
Run the code below and press a key. You will see one pixel line of cheese at the top or bottom depending on which sourceY is used. To make this more obvious divide height by 2. This works fine on NT. import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.*; import org.eclipse.swt.widgets.*; public class PR_1GIXDPD { static boolean scrolled = false; public static void main(String[] args) { final Shell shell = new Shell(); shell.addListener(SWT.KeyDown, new Listener() { public void handleEvent(Event e) { Rectangle clientArea = shell.getClientArea(); int height = clientArea.height; int sourceY = 65536 - (height - 3); // int sourceY = 65536 + (height - 1); // does not work if 65536 - (height - 2) < sourceY < 65536 + height shell.scroll(0, 0, 0, sourceY, clientArea.width, clientArea.height, true); scrolled = true; System.out.println(clientArea); } }); shell.addListener(SWT.Paint, new Listener() { public void handleEvent(Event event) { int lineHeight = 15; if (scrolled == false) { for (int i = 0; i < event.y + event.height; i += lineHeight) { event.gc.drawText("Line " + i, 0, i); } } } }); shell.open(); Display display = shell.getDisplay (); while (!shell.isDisposed ()) { if (!display.readAndDispatch ()) display.sleep (); } } } NOTES:
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/SelectionConverter.java
/**
	 * Converts the text selection provided by the given editor a Java element by
	 * asking the user if code reolve returned more than one result. If the selection 
	 * doesn't cover a Java element <code>null</code> is returned.
	 */
	public static IJavaElement codeResolve(JavaEditor editor, Shell shell, String title, String message) throws JavaModelException {
		IJavaElement[] elements= codeResolve(editor);
		if (elements == null || elements.length == 0)
			return null;
		IJavaElement candidate= elements[0];
		if (elements.length > 1) {
			candidate= OpenActionUtil.selectJavaElement(elements, shell, title, message);
		}
		return candidate;
	}
	
	public static IJavaElement[] codeResolveHandled(JavaEditor editor, Shell shell, String title) {
		try {
			return codeResolve(editor);
		} catch (JavaModelException e) {
			ExceptionHandler.handle(e, shell, title, ActionMessages.getString("SelectionConverter.codeResolve_failed")); 
		}
		return null;
	}
	
	public static IJavaElement getElementAtOffset(JavaEditor editor) throws JavaModelException {
		return getElementAtOffset(getInput(editor), (ITextSelection)editor.getSelectionProvider().getSelection());
	}
	
	public static IType getTypeAtOffset(JavaEditor editor) throws JavaModelException {