Ejemplo n.º 1
0
        protected static IVsTextLines GetTextBufferForFile(string fileName, IList <IVsInvisibleEditor> openedInvisibleEditors)
        {
            // If the file is in RDT, get the text lines from RDT cookie.
            // If the file is not is RDT, it will open that file in invisible editor and
            // get text lines from the invisible editor docdata.
            IVsTextLines textBuffer = null;

            if (RdtManager.IsFileInRdt(fileName))
            {
                // File is in RDT
                textBuffer = RdtManager.Instance.GetTextLines(fileName);
            }
            else
            {
                IVsInvisibleEditor invisibleEditor = null;
                // File is not in RDT, open it in invisible editor.
                if (RdtManager.Instance.TryGetTextLinesAndInvisibleEditor(fileName, out invisibleEditor, out textBuffer))
                {
                    openedInvisibleEditors.Add(invisibleEditor);
                }
                else
                {
                    // Failed to get text lines or invisible editor.
                    textBuffer = null;
                }
            }
            return(textBuffer);
        }
Ejemplo n.º 2
0
        /////////////////////////////////////////////////////////////////////////////
        // Overriden Package Implementation
        #region Package Members

        /// <summary>
        /// Initialization of the package; this method is called right after the package is sited, so this is the place
        /// where you can put all the initilaization code that rely on services provided by VisualStudio.
        /// </summary>
        protected override void Initialize()
        {
            base.Initialize();
            rdtManager = new RdtManager(this);
            rdtManager.SavedProjectItem += new EventHandler <SavedProjectItemEventArgs>(rdtManager_SavedProjectItem);
        }