* fixes
diff --git a/core/plugins/org.eclipse.dltk.core/model/org/eclipse/dltk/internal/core/Buffer.java b/core/plugins/org.eclipse.dltk.core/model/org/eclipse/dltk/internal/core/Buffer.java
index 220741d..3114547 100644
--- a/core/plugins/org.eclipse.dltk.core/model/org/eclipse/dltk/internal/core/Buffer.java
+++ b/core/plugins/org.eclipse.dltk.core/model/org/eclipse/dltk/internal/core/Buffer.java
@@ -110,8 +110,8 @@
 		}
 		notifyChanged(event); // notify outside of synchronized block
 		synchronized (this) { // ensure that no other thread is
-								// adding/removing a listener at the same time
-								// (https://bugs.eclipse.org/bugs/show_bug.cgi?id=126673)
+			// adding/removing a listener at the same time
+			// (https://bugs.eclipse.org/bugs/show_bug.cgi?id=126673)
 			this.changeListeners = null;
 		}
 	}
@@ -363,7 +363,9 @@
 
 			// Special case for UTF-8 BOM files
 			// see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=110576
-			if (encoding != null && encoding.equals(org.eclipse.dltk.compiler.util.Util.UTF_8)) {
+			if (encoding != null
+					&& encoding
+							.equals(org.eclipse.dltk.compiler.util.Util.UTF_8)) {
 				IContentDescription description = this.file
 						.getContentDescription();
 				if (description != null
@@ -400,6 +402,14 @@
 	}
 
 	public void setContents(char[] newContents) {
+
+		// We need to clean content cache.
+		ISourceCodeCache cache = ModelManager.getModelManager()
+				.getSourceCodeCache();
+		if (cache != null && this.file != null) {
+			cache.remove(this.file);
+		}
+
 		// allow special case for first initialization
 		// after creation by buffer factory
 		if (this.contents == null) {
diff --git a/core/plugins/org.eclipse.dltk.core/model/org/eclipse/dltk/internal/core/ISourceCodeCache.java b/core/plugins/org.eclipse.dltk.core/model/org/eclipse/dltk/internal/core/ISourceCodeCache.java
index 6f8b255..342e609 100644
--- a/core/plugins/org.eclipse.dltk.core/model/org/eclipse/dltk/internal/core/ISourceCodeCache.java
+++ b/core/plugins/org.eclipse.dltk.core/model/org/eclipse/dltk/internal/core/ISourceCodeCache.java
@@ -30,4 +30,5 @@
 	 */
 	char[] get(IFileHandle file) throws ModelException;
 
+	void remove(IFile file);
 }
diff --git a/core/plugins/org.eclipse.dltk.core/model/org/eclipse/dltk/internal/core/SourceModuleCodeCache.java b/core/plugins/org.eclipse.dltk.core/model/org/eclipse/dltk/internal/core/SourceModuleCodeCache.java
index 5871797..59d8b79 100644
--- a/core/plugins/org.eclipse.dltk.core/model/org/eclipse/dltk/internal/core/SourceModuleCodeCache.java
+++ b/core/plugins/org.eclipse.dltk.core/model/org/eclipse/dltk/internal/core/SourceModuleCodeCache.java
@@ -137,4 +137,9 @@
 		return result;
 	}
 
+	public void remove(IFile file) {
+		synchronized (resourceMap) {
+			resourceMap.remove(file);
+		}
+	}
 }