public ILanguageElementManager GetLanguageElementManager(ITextView textView)
        {
            if (textView == null)
                throw new ArgumentNullException("textView");
            if (!textView.Roles.Contains(PredefinedTextViewRoles.Structured))
                return null;

            return textView.Properties.GetOrCreateSingletonProperty<LanguageElementManager>(
                () =>
                {
                    ITagAggregator<ILanguageElementTag> tagAggregator = TagAggregatorFactory.CreateTagAggregator<ILanguageElementTag>(textView.TextBuffer);
                    LanguageElementManager manager = new LanguageElementManager(textView.TextBuffer, textView.BufferGraph, tagAggregator);
                    textView.Closed += (sender, e) => manager.Dispose();
                    return manager;
                });
        }
        public ILanguageElementManager GetLanguageElementManager(ITextView textView)
        {
            if (textView == null)
            {
                throw new ArgumentNullException("textView");
            }
            if (!textView.Roles.Contains(PredefinedTextViewRoles.Structured))
            {
                return(null);
            }

            return(textView.Properties.GetOrCreateSingletonProperty <LanguageElementManager>(
                       () =>
            {
                ITagAggregator <ILanguageElementTag> tagAggregator = TagAggregatorFactory.CreateTagAggregator <ILanguageElementTag>(textView.TextBuffer);
                LanguageElementManager manager = new LanguageElementManager(textView.TextBuffer, textView.BufferGraph, tagAggregator);
                textView.Closed += (sender, e) => manager.Dispose();
                return manager;
            }));
        }