Exemplo n.º 1
0
        public virtual IEnumerable <T> GetContents <T> () where T : class
        {
            if (typeof(T) == typeof(TextEditor))
            {
                yield return((T)(object)textEditor);

                yield break;
            }
            var result = this as T;

            if (result != null)
            {
                yield return(result);
            }
            var ext = textEditorImpl.EditorExtension;

            while (ext != null)
            {
                result = ext as T;
                if (result != null)
                {
                    yield return(result);
                }
                ext = ext.Next;
            }
            foreach (var cnt in textEditorImpl.GetContents <T> ())
            {
                yield return(cnt);
            }
        }
Exemplo n.º 2
0
        protected override IEnumerable <object> OnGetContents(Type type)
        {
            foreach (var r in base.OnGetContents(type))
            {
                yield return(r);
            }

            if (textEditorImpl != null)
            {
                if (type == typeof(ITextBuffer))
                {
                    yield return(textEditor.TextView.TextBuffer);

                    yield break;
                }
                if (type == typeof(ITextView))
                {
                    yield return(textEditor.TextView);

                    yield break;
                }
                if (type.IsAssignableFrom(typeof(TextEditor)))
                {
                    yield return(textEditor);

                    yield break;
                }

                var ext = textEditorImpl.EditorExtension;
                while (ext != null)
                {
                    foreach (var r in ext.OnGetContents(type))
                    {
                        yield return(r);
                    }
                    ext = ext.Next;
                }

                foreach (var r in textEditorImpl.GetContents(type))
                {
                    yield return(r);
                }
            }
        }