private static ICollection <INTriplesSymbol> Build(INTriplesFile file)
        {
            var ret = new NTriplesCacheBuilder(file);

            file.ProcessDescendants(ret);
            return(ret.GetSymbols());
        }
예제 #2
0
        public void Save(IProgressIndicator progress, bool enablePersistence)
        {
            if (!enablePersistence)
            {
                return;
            }

            Assertion.Assert(this.myPersistentCache != null, "myPersistentCache != null");
            this.myPersistentCache.Save(
                progress,
                this.myPersistentIdIndex,
                (writer, file, data) =>
                NTriplesCacheBuilder.Write(data, writer));
            this.myPersistentCache.Dispose();
            this.myPersistentCache = null;
        }
예제 #3
0
        public void SyncUpdate(bool underTransaction)
        {
            this.myShellLocks.AssertReadAccessAllowed();

            if (this.myDirtyFiles.Count > 0)
            {
                foreach (IPsiSourceFile projectFile in new List <IPsiSourceFile>(this.myDirtyFiles))
                {
                    using (WriteLockCookie.Create())
                    {
                        ICollection <INTriplesSymbol> ret = NTriplesCacheBuilder.Build(projectFile);
                        ((ICache)this).Merge(
                            projectFile,
                            ret != null
                                ? ret.ToList()
                                : null);
                    }
                }
            }
        }
예제 #4
0
        public object Load(IProgressIndicator progress, bool enablePersistence)
        {
            if (!enablePersistence)
            {
                return(null);
            }

            Assertion.Assert(this.myPersistentCache == null, "myPersistentCache == null");

            using (ReadLockCookie.Create())
            {
                this.myPersistentCache = new NTriplesPersistentCache <NTriplesFileCache>(
                    this.myShellLocks, Version, "NTriplesCache", this.myPsiConfiguration);
            }

            var data = new Dictionary <IPsiSourceFile, NTriplesFileCache>();

            if (this.myPersistentCache.Load(
                    progress,
                    this.myPersistentIdIndex,
                    (file, reader) =>
            {
                using (ReadLockCookie.Create())
                {
                    return(NTriplesCacheBuilder.Read(reader, file));
                }
            },
                    (projectFile, psiSymbols) =>
            {
                if (projectFile != null)
                {
                    data[projectFile] = psiSymbols;
                }
            }) != LoadResult.OK)
            {
                // clear all...
                return(null);
            }
            return(data);
        }
예제 #5
0
 public object Build(IPsiSourceFile sourceFile, bool isStartup)
 {
     return(NTriplesCacheBuilder.Build(sourceFile));
 }