Ejemplo n.º 1
0
        /// <summary>
        /// Treats given ProjectItem as a VB code file, using VBCodeExplorer to examine the file. LookInVB method is called as a callback,
        /// given plain methods text.
        /// </summary>
        protected virtual void ProcessVB(ProjectItem projectItem, Predicate <CodeElement> exploreable, bool verbose)
        {
            bool           fileOpened;
            FileCodeModel2 codeModel = projectItem.GetCodeModel(false, true, out fileOpened);

            if (fileOpened)
            {
                VLDocumentViewsManager.AddInvisibleWindow(projectItem.GetFullPath(), invisibleWindowsAuthor);
                VLOutputWindow.VisualLocalizerPane.WriteLine("\tForce opening {0} in background in order to obtain code model", projectItem.Name);
            }

            if (codeModel == null)
            {
                if (verbose)
                {
                    VLOutputWindow.VisualLocalizerPane.WriteLine("\tCannot process {0}, file code model does not exist.", projectItem.Name);
                }
                return;
            }
            if (verbose)
            {
                VLOutputWindow.VisualLocalizerPane.WriteLine("\tProcessing {0}", projectItem.Name);
            }

            currentlyProcessedItem = projectItem;

            try {
                VBCodeExplorer.Instance.Explore(this, exploreable, codeModel);
            } catch (COMException ex) {
                if (ex.ErrorCode == -2147483638)
                {
                    VLOutputWindow.VisualLocalizerPane.WriteLine("\tError occured during processing {0} - the file is not yet compiled.", projectItem.Name);
                }
                else
                {
                    throw;
                }
            }

            currentlyProcessedItem = null;
        }