void HandleTextOptionsChanged (object sender, EventArgs e)
		{
			var policy = Policy.CreateOptions ();
			var options = Editor.CreateNRefactoryTextEditorOptions ();
			options.IndentBlankLines = true;
			IStateMachineIndentEngine indentEngine;
			try {
				var csharpIndentEngine = new CSharpIndentEngine (textEditorData.Document, options, policy);
				//csharpIndentEngine.EnableCustomIndentLevels = true;
				foreach (var symbol in MonoDevelop.CSharp.Highlighting.CSharpSyntaxMode.GetDefinedSymbols (document.Project)) {
					csharpIndentEngine.DefineSymbol (symbol);
				}
				indentEngine = csharpIndentEngine;
			} catch (Exception ex) {
				LoggingService.LogError ("Error while creating the c# indentation engine", ex);
				indentEngine = new NullIStateMachineIndentEngine (textEditorData.Document);
			}
			stateTracker = new CacheIndentEngine (indentEngine);
			textEditorData.IndentationTracker = new IndentVirtualSpaceManager (textEditorData, stateTracker);


			if (textEditorData.Options.IndentStyle == IndentStyle.Auto || textEditorData.Options.IndentStyle == IndentStyle.None) {
				textEditorData.TextPasteHandler = null;
			} else {
				textEditorData.TextPasteHandler = new TextPasteIndentEngine (stateTracker, options, policy);
			}
		}
        void HandleTextOptionsChanged(object sender, EventArgs e)
        {
            var policy  = Policy.CreateOptions();
            var options = Editor.CreateNRefactoryTextEditorOptions();

            options.IndentBlankLines = true;
            IStateMachineIndentEngine indentEngine;

            try {
                indentEngine = new CSharpIndentEngine(textEditorData.Document, options, policy);
            } catch (Exception ex) {
                LoggingService.LogError("Error while creating the c# indentation engine", ex);
                indentEngine = new NullIStateMachineIndentEngine(textEditorData.Document);
            }
            if (stateTracker != null)
            {
                stateTracker.Dispose();
            }
            stateTracker = new CacheIndentEngine(indentEngine);
            textEditorData.IndentationTracker = new IndentVirtualSpaceManager(textEditorData, stateTracker);
            textEditorData.TextPasteHandler   = new TextPasteIndentEngine(stateTracker, options, policy);
        }