Bug 5877 Rename package -> selection incorrect
1. select text in a .java file 2. rename the package of that file using the rename menu option 3. notice that the selection has moved Perhaps because selection index isn't updated when the .java file text changes to reflect the new package.
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/CompilationUnitEditor.java
if (sourceViewer == null || fOutlinePage == null)
			return;
			
		StyledText styledText= sourceViewer.getTextWidget();
		if (styledText == null)
			return;
		
		int offset= sourceViewer.getVisibleRegion().getOffset();
		int caret= offset + styledText.getCaretOffset();
		
		IJavaElement element= getElementAt(caret, false);
		ISourceReference reference= getSourceReference(element, caret);
		if (reference != null)
			fOutlinePage.select(reference);
	}
	
	private ISourceReference getSourceReference(IJavaElement element, int offset) {
		
		if ( !(element instanceof ISourceReference))
			return null;
		
		if (element.getElementType() == IJavaElement.IMPORT_DECLARATION) {
			
			IImportDeclaration declaration= (IImportDeclaration) element;
			IImportContainer container= (IImportContainer) declaration.getParent();
			ISourceRange srcRange= null;
			
			try {
				srcRange= container.getSourceRange();
			} catch (JavaModelException e) {