예제 #1
0
        /// <summary>Called when the associated data file changed: added/removed assemblies or includes.</summary>
        /// <param name="dataDiff">The difference between the old and new data.</param>
        private void OnFileDataChanged([NotNull] T4DeclaredAssembliesDiff dataDiff)
        {
            ShellLocks.AssertWriteAccessAllowed();
            if (!AssemblyReferenceManager.ProcessDiff(dataDiff))
            {
                return;
            }
            var changeBuilder = new PsiModuleChangeBuilder();

            changeBuilder.AddModuleChange(this, PsiModuleChange.ChangeType.Modified);
            // TODO: get rid of this queuing?
            ShellLocks.ExecuteOrQueueEx(
                "T4PsiModuleChange",
                () => ChangeManager.ExecuteAfterChange(
                    () => ShellLocks.ExecuteWithWriteLock(
                        () =>
            {
                if (!IsValid())
                {
                    return;
                }
                ChangeManager.OnProviderChanged(
                    ChangeProvider,
                    changeBuilder.Result,
                    SimpleTaskExecutor.Instance
                    );
            })
                    )
                );
        }
예제 #2
0
        private void NotifyModuleChange()
        {
            var changeBuilder = new PsiModuleChangeBuilder();

            changeBuilder.AddModuleChange(this, PsiModuleChange.ChangeType.Modified);
            // TODO: get rid of this queuing?
            ShellLocks.ExecuteOrQueueEx(
                "T4PsiModuleChange",
                () => ChangeManager.ExecuteAfterChange(
                    () => ShellLocks.ExecuteWithWriteLock(
                        () => ChangeManager.OnProviderChanged(
                            ChangeProvider,
                            changeBuilder.Result,
                            SimpleTaskExecutor.Instance
                            )
                        )
                    )
                );
        }
예제 #3
0
 private void OnFileDataChanged(Pair <IPsiSourceFile, T4DeclaredAssembliesDiff> pair)
 {
     (IPsiSourceFile first, T4DeclaredAssembliesDiff second) = pair;
     if (first != SourceFile)
     {
         return;
     }
     if (ShellLocks.IsWriteAccessAllowed())
     {
         OnFileDataChanged(second);
     }
     else
     {
         ShellLocks.ExecuteOrQueueEx(
             Lifetime,
             "T4PsiModuleOnFileDataChanged",
             () => ShellLocks.ExecuteWithWriteLock(() => OnFileDataChanged(second))
             );
     }
 }