Bug 6410 File unchanged but dirtied by code assist
1122. Open a Java file. Place the cursor inside the left-most parenthesis of a method call. For example, consider "I" to be the cursor below: Object o = anotherObject.method(I); Press Ctrl-Space. The file is dirtied but not changed, and code assist does not appear. If code assist has nothing to suggest, it should not dirty the file.
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/JavaCompletionProposal.java
if (trigger == (char) 0) {
				document.replace(fReplacementOffset, fReplacementLength, fReplacementString);
			} else {
				StringBuffer buffer= new StringBuffer(fReplacementString);
				
				if ((fReplacementLength < buffer.length() && buffer.charAt(fReplacementLength) != trigger)) {
					buffer.insert(fCursorPosition, trigger);
					++fCursorPosition;
				}
				
				document.replace(fReplacementOffset, fReplacementLength, buffer.toString());
			}
			
			int oldLen= document.getLength();
			applyImports(document);
			fReplacementOffset += document.getLength() - oldLen;
			
		} catch (BadLocationException x) {
			
		}	
	}
	
	/*
	 * @see ICompletionProposal#apply
	 */
	public void apply(IDocument document) {
		apply(document, (char) 0, fReplacementOffset + fReplacementLength);
	}