Bug 84194 [content assist] Code assist in import statements insert at the end
Build: I-20050201 Open any Java file that contains > 1 import statements. Let's say the first import statement reads: import org.eclipse.core.runtime.*; delete the '*;' from the end and try to use code assist to insert IRunnableWithProgress for example. You will see that upon pressing Enter to select, the text gets inserted several lines down under all the import statements. the cursor is now in a random position also.
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/JavaTypeCompletionProposal.java
impStructure.getResultingEdits(document, new NullProgressMonitor()).apply(document, TextEdit.UPDATE_REGIONS);
				setReplacementOffset(getReplacementOffset() + document.getLength() - oldLen);
			}
		} catch (CoreException e) {
			JavaPlugin.log(e);
		} catch (BadLocationException e) {
			JavaPlugin.log(e);
		}
	}
	/*
	 * @see org.eclipse.jface.text.contentassist.ICompletionProposalExtension2#validate(org.eclipse.jface.text.IDocument, int, org.eclipse.jface.text.DocumentEvent)
	 * see http://dev.eclipse.org/bugs/show_bug.cgi?id=39439
	 */
	public boolean validate(IDocument document, int offset, DocumentEvent event) {
		boolean isValid= super.validate(document, offset, event);
		if (isValid)
			return true;
		return
			(fUnqualifiedTypeName != null && startsWith(document, offset, fUnqualifiedTypeName)) ||
			(fFullyQualifiedTypeName != null && startsWith(document, offset, fFullyQualifiedTypeName));
	}
	
	/*
	 * @see org.eclipse.jdt.internal.ui.text.java.JavaCompletionProposal#getCompletionText()
	 */
	public CharSequence getPrefixCompletionText(IDocument document, int completionOffset) {
		return fUnqualifiedTypeName;
	}
}