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
ICompilationUnit cu= (ICompilationUnit) JavaModelUtil.findElementOfKind(fImportDeclaration, IJavaElement.COMPILATION_UNIT);
		if (cu != null) {
			try {
				IType[] types= cu.getTypes();
				if (types.length == 0 || types[0].getSourceRange().getOffset() > fReplacementOffset) {
					
					return;
				}
				String[] prefOrder= ImportOrganizePreferencePage.getImportOrderPreference();
				int threshold= ImportOrganizePreferencePage.getImportNumberThreshold();					
				ImportsStructure impStructure= new ImportsStructure(cu, prefOrder, threshold, true);
				impStructure.addImport(fImportDeclaration.getElementName());
				
				impStructure.create(false, null);
			} catch (CoreException e) {
				JavaPlugin.log(e);
			}
		}
	}
	
	/*
	 * @see ICompletionProposalExtension#apply(IDocument, char, int)
	 */
	public void apply(IDocument document, char trigger, int offset) {
		try {
			
			
			int delta= offset - (fReplacementOffset + fReplacementLength);
			if (delta > 0)
				fReplacementLength += delta;