remove references to the document from EclipseContext on editor closing

Signed-off-by: Florian Thienel <florian@thienel.org>
diff --git a/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/editor/DocumentContextSourceProvider.java b/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/editor/DocumentContextSourceProvider.java
index dfc0abe..6f4f513 100644
--- a/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/editor/DocumentContextSourceProvider.java
+++ b/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/editor/DocumentContextSourceProvider.java
@@ -108,6 +108,16 @@
 		return currentState;
 	}
 
+	public void resetContext() {
+		currentNode = null;
+		caretArea = null;
+
+		final Map<String, Object> changes = new HashMap<String, Object>();
+		changes.put(CURRENT_NODE, currentNode);
+		changes.put(CARET_AREA, caretArea);
+		fireSourceChanged(ISources.WORKBENCH, changes);
+	}
+
 	/**
 	 * Synchronizes the variable values which will be exposed by this service with the specified {@link VexWidget}.
 	 *
diff --git a/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/editor/VexEditor.java b/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/editor/VexEditor.java
index 9d4bc69..343fd12 100644
--- a/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/editor/VexEditor.java
+++ b/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/editor/VexEditor.java
@@ -233,10 +233,14 @@
 			document.removeDocumentListener(documentListener);
 		}
 
-		if (style != null) {
+		if (style != null && document != null) {
 			style.getStyleSheet().flushAllStyles(document);
 		}
 
+		final ISourceProviderService service = (ISourceProviderService) getEditorSite().getWorkbenchWindow().getService(ISourceProviderService.class);
+		final DocumentContextSourceProvider contextProvider = (DocumentContextSourceProvider) service.getSourceProvider(DocumentContextSourceProvider.IS_COLUMN);
+		contextProvider.resetContext();
+
 		getEditorSite().getSelectionProvider().removeSelectionChangedListener(selectionChangedListener);
 
 		if (parentControl != null) {