Bug 512479 - AssertionError in HandlyXtextEditorCallback#connectWorkingCopy0
diff --git a/org.eclipse.handly.xtext.ui/src/org/eclipse/handly/xtext/ui/editor/HandlyXtextEditorCallback.java b/org.eclipse.handly.xtext.ui/src/org/eclipse/handly/xtext/ui/editor/HandlyXtextEditorCallback.java
index e8b77f7..d50c3d1 100644
--- a/org.eclipse.handly.xtext.ui/src/org/eclipse/handly/xtext/ui/editor/HandlyXtextEditorCallback.java
+++ b/org.eclipse.handly.xtext.ui/src/org/eclipse/handly/xtext/ui/editor/HandlyXtextEditorCallback.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2014, 2016 1C-Soft LLC and others.
+ * Copyright (c) 2014, 2017 1C-Soft LLC and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -364,7 +364,8 @@
                 throw new AssertionError();
             try (IBuffer buffer = Elements.getBuffer(workingCopy))
             {
-                if (buffer.getDocument() != editor.getDocument())
+                if (buffer.getDocument() != editor.getDocumentProvider().getDocument(
+                    editor.getEditorInput()))
                 {
                     releaseWorkingCopy(editor, workingCopy);
                     throw new AssertionError();