public IEnumerable <OpenedFile> GetSourceFiles(out OpenedFile designerCodeFile)
        {
            // get new initialize components
            ParseInformation info = ParserService.ParseFile(this.viewContent.PrimaryFileName, this.viewContent.PrimaryFileContent);
            ICompilationUnit cu   = info.CompilationUnit;

            foreach (IClass c in cu.Classes)
            {
                if (FormsDesignerSecondaryDisplayBinding.BaseClassIsFormOrControl(c))
                {
                    this.currentClassPart     = c;
                    this.initializeComponents = FormsDesignerSecondaryDisplayBinding.GetInitializeComponents(c);
                    if (this.initializeComponents != null)
                    {
                        string designerFileName = this.initializeComponents.DeclaringType.CompilationUnit.FileName;
                        if (designerFileName != null)
                        {
                            designerCodeFile = FileService.GetOrCreateOpenedFile(designerFileName);

                            CompoundClass compound = c.GetCompoundClass() as CompoundClass;
                            if (compound == null)
                            {
                                return(new [] { designerCodeFile });
                            }
                            else
                            {
                                return(compound.Parts
                                       .Select(cl => FileService.GetOrCreateOpenedFile(cl.CompilationUnit.FileName))
                                       .Distinct());
                            }
                        }
                    }
                }
            }

            throw new FormsDesignerLoadException("Could not find InitializeComponent method in any part of the open class.");
        }
        protected void Reparse()
        {
            Dictionary <OpenedFile, ParseInformation> parsings = new Dictionary <OpenedFile, ParseInformation>();
            ParseInformation info;
            ICompilationUnit cu;

            // Reparse all source files for the designed form
            foreach (KeyValuePair <OpenedFile, IDocument> entry in this.ViewContent.SourceFiles)
            {
                parsings.Add(entry.Key, ParserService.ParseFile(entry.Key.FileName, entry.Value));
            }

            // Update currentClassPart from PrimaryFile
            this.currentClassPart = null;
            if (this.ViewContent.PrimaryFile != null && parsings.TryGetValue(this.ViewContent.PrimaryFile, out info))
            {
                cu = info.CompilationUnit;
                foreach (IClass c in cu.Classes)
                {
                    if (FormsDesignerSecondaryDisplayBinding.BaseClassIsFormOrControl(c))
                    {
                        if (FormsDesignerSecondaryDisplayBinding.GetInitializeComponents(c) != null)
                        {
                            this.currentClassPart = c;
                            break;
                        }
                    }
                }
                if (this.currentClassPart == null)
                {
                    LoggingService.Warn("AbstractDesignerGenerator.Reparse: Could not find designed class in primary file '" + this.ViewContent.PrimaryFile.FileName + "'");
                }
            }
            else
            {
                LoggingService.Debug("AbstractDesignerGenerator.Reparse: Primary file is unavailable");
            }

            // Update initializeComponents, completeClass and formClass
            // from designer code file
            this.completeClass        = null;
            this.formClass            = null;
            this.initializeComponents = null;
            if (this.ViewContent.DesignerCodeFile == null ||
                !parsings.TryGetValue(this.ViewContent.DesignerCodeFile, out info))
            {
                LoggingService.Warn("AbstractDesignerGenerator.Reparse: Designer source code file is unavailable");
                if (this.currentClassPart != null)
                {
                    this.completeClass = this.currentClassPart.GetCompoundClass();
                }
                return;
            }

            cu = info.CompilationUnit;
            foreach (IClass c in cu.Classes)
            {
                if (FormsDesignerSecondaryDisplayBinding.BaseClassIsFormOrControl(c))
                {
                    this.initializeComponents = FormsDesignerSecondaryDisplayBinding.GetInitializeComponents(c);
                    if (this.initializeComponents != null)
                    {
                        using (StringReader r = new StringReader(this.ViewContent.DesignerCodeFileContent)) {
                            int count = this.initializeComponents.Region.BeginLine;
                            for (int i = 1; i < count; i++)
                            {
                                r.ReadLine();
                            }
                            string line = r.ReadLine();
                            tabs = GetIndentation(line);
                        }
                        this.completeClass = c.GetCompoundClass();
                        this.formClass     = this.initializeComponents.DeclaringType;
                        break;
                    }
                }
            }

            if (this.completeClass == null || this.formClass == null)
            {
                LoggingService.Warn("AbstractDesignerGenerator.Reparse: Could not find InitializeComponents in designer source code file '" + this.ViewContent.DesignerCodeFile.FileName + "'");
            }
        }