Example #1
0
        protected void DoInvalidateAssemblies([NotNull] IT4File t4File)
        {
            var sourceFile = t4File.PhysicalPsiSourceFile;

            if (sourceFile?.LanguageType.Is <T4ProjectFileType>() != true)
            {
                return;
            }
            var newData = new T4DeclaredAssembliesInfo(t4File);
            var existingDeclaredAssembliesInfo = sourceFile.GetDeclaredAssembliesInfo();

            sourceFile.SetDeclaredAssembliesInfo(newData);
            var diff = newData.DiffWith(existingDeclaredAssembliesInfo);

            if (diff == null)
            {
                return;
            }
            FileDataChanged.Fire(Pair.Of(sourceFile, diff));
        }
        public T4DeclaredAssembliesDiff DiffWith([CanBeNull] T4DeclaredAssembliesInfo oldDeclaredAssembliesInfo)
        {
            if (oldDeclaredAssembliesInfo == null)
            {
                if (ReferencedAssemblies.Count == 0)
                {
                    return(null);
                }
                return(new T4DeclaredAssembliesDiff(ReferencedAssemblies, EmptyList <IT4PathWithMacros> .InstanceList));
            }

            oldDeclaredAssembliesInfo.ReferencedAssemblies.Compare(
                ReferencedAssemblies,
                out JetHashSet <IT4PathWithMacros> addedAssemblies,
                out JetHashSet <IT4PathWithMacros> removedAssemblies
                );

            if (addedAssemblies.Count == 0 && removedAssemblies.Count == 0)
            {
                return(null);
            }
            return(new T4DeclaredAssembliesDiff(addedAssemblies, removedAssemblies));
        }
Example #3
0
 public static void SetDeclaredAssembliesInfo(
     [NotNull] this IPsiSourceFile file,
     [NotNull] T4DeclaredAssembliesInfo fileSystemPath
     ) => file.PutData(DeclaredAssembliesInfoKey, fileSystemPath);