void SetPreCreatedItem(uint itemid)
        {
            if (!_loaded)
                return;

            ISccProjectWalker walker = _context.GetService<ISccProjectWalker>();

            if (walker == null)
                return;

            if (itemid != VSItemId.Nil)
                walker.SetPrecreatedFilterItem(ProjectHierarchy, itemid);
            else
                walker.SetPrecreatedFilterItem(null, VSItemId.Nil);

        }
Exemplo n.º 2
0
        public void AddPath(string path)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            if (ExcludedFromScc)
            {
                return;
            }

            bool alreadyLoaded = _loaded && !_inLoad;

            if (alreadyLoaded && WebLikeFileHandling)
            {
                uint fid = VSItemId.Nil;

                if (TryGetProjectFileId(path, out fid))
                {
                    // OK: Websites try to add everything they see below their directory
                    // We only add these files if they are actually SCC items

                    bool add = false;
                    ISccProjectWalker walker = GetService <ISccProjectWalker>();

                    foreach (string file in walker.GetSccFiles(ProjectHierarchy, fid, ProjectWalkDepth.SpecialFiles, null))
                    {
                        if (string.Equals(file, path, StringComparison.OrdinalIgnoreCase))
                        {
                            add = true;
                            break;
                        }
                    }

                    if (!add)
                    {
                        return;
                    }
                }
                else
                {
                    // File is either not in project or a scc special file
                    // Pass
                }
            }

            if (alreadyLoaded && GetService <IAnkhConfigurationService>().Instance.AutoAddEnabled)
            {
                GetService <IFileStatusMonitor>().ScheduleAddFile(path);
            }

            SccProjectFileReference reference;

            if (_files.TryGetValue(path, out reference))
            {
                reference.AddReference();
            }
            else
            {
                reference = new SccProjectFileReference(_context, this, Map.GetFile(path));
                _files.Add(reference);

                if (alreadyLoaded)
                {
                    GetService <IFileStatusMonitor>().ScheduleGlyphUpdate(path);
                }
            }

            if (string.Equals(path, ProjectFile, StringComparison.OrdinalIgnoreCase))
            {
                reference.IsProjectFile = true;
            }

            if (alreadyLoaded && !string.IsNullOrEmpty(ProjectFile))
            {
                ISccProjectWalker walker = GetService <ISccProjectWalker>();

                if (walker != null)
                {
                    walker.SetPrecreatedFilterItem(null, VSItemId.Nil);
                }

                ClearIdCache();

                SetDirty();
            }
        }