public override void Attach(ITextEditor editor)
        {
            base.Attach(editor);

            // try to access the ICSharpCode.AvalonEdit.Rendering.TextView
            // of this ITextEditor
            this.textView = editor.GetService(typeof(TextView)) as TextView;

            // if editor is not an AvalonEdit.TextEditor
            // GetService returns null
            if (textView != null)
            {
                if (WorkbenchSingleton.Workbench != null)
                {
                    if (XamlBindingOptions.UseAdvancedHighlighting)
                    {
                        colorizer = new XamlColorizer(editor, textView);
                        // attach the colorizer
                        textView.LineTransformers.Add(colorizer);
                    }
                    // add the XamlOutlineContentHost, which manages the tree view
                    contentHost = new XamlOutlineContentHost(editor);
                    textView.Services.AddService(typeof(IOutlineContentHost), contentHost);
                }
                // add ILanguageBinding
                textView.Services.AddService(typeof(XamlLanguageBinding), this);
            }
        }
Ejemplo n.º 2
0
		public override void Attach(ITextEditor editor)
		{
			base.Attach(editor);
			
			// try to access the ICSharpCode.AvalonEdit.Rendering.TextView
			// of this ITextEditor
			this.textView = editor.GetService(typeof(TextView)) as TextView;
			
			// if editor is not an AvalonEdit.TextEditor
			// GetService returns null
			if (textView != null) {
				if (WorkbenchSingleton.Workbench != null) {
					if (XamlBindingOptions.UseAdvancedHighlighting) {
						colorizer = new XamlColorizer(editor, textView);
						// attach the colorizer
						textView.LineTransformers.Add(colorizer);
					}
					// add the XamlOutlineContentHost, which manages the tree view
					contentHost = new XamlOutlineContentHost(editor);
					textView.Services.AddService(typeof(IOutlineContentHost), contentHost);
				}
				// add ILanguageBinding
				textView.Services.AddService(typeof(XamlLanguageBinding), this);
			}
		}