Beispiel #1
0
        object IChangeProvider.Execute(IChangeMap changeMap)
        {
            var projectModelChange = changeMap.GetChange <ProjectModelChange>(mySolution);

            if (projectModelChange == null)
            {
                return(null);
            }

            // ReSharper hasn't necessarily processed all references when it adds the IProject
            // to the IViewableProjectsCollection. Keep an eye on reference changes, add the
            // project settings if/when the project becomes a unity project
            var projects = new JetHashSet <IProject>();
            var changes  = ReferencedAssembliesService.TryGetAssemblyReferenceChanges(projectModelChange, ProjectExtensions.UnityReferenceNames);

            foreach (var change in changes)
            {
                projects.Add(change.GetNewProject());
            }

            foreach (var project in projects)
            {
                myChangeManager.ExecuteAfterChange(() =>
                {
                    if (project.IsUnityProject())
                    {
                        Handle(project);
                    }
                });
            }

            return(null);
        }
Beispiel #2
0
        object IChangeProvider.Execute(IChangeMap changeMap)
        {
            var projectModelChange = changeMap.GetChange <ProjectModelChange>(mySolution);

            if (projectModelChange == null)
            {
                return(null);
            }

            var changes = ReferencedAssembliesService.TryGetAssemblyReferenceChanges(projectModelChange,
                                                                                     ourUnityReferenceNameInfos, myLogger);

            var newUnityProjects = new List <KeyValuePair <IProject, Lifetime> >();

            foreach (var change in changes)
            {
                if (change.IsAdded)
                {
                    var project = change.GetNewProject();
                    if (HasUnityReferenceOrFlavour(project))
                    {
                        Assertion.Assert(myAllProjectLifetimes.ContainsKey(project), "project is not added");
                        if (myAllProjectLifetimes.TryGetValue(project, out var projectLifetime))
                        {
                            newUnityProjects.Add(JetKeyValuePair.Of(project, projectLifetime));
                            if (!myUnityProjects.Contains(project))
                            {
                                myUnityProjects.Add(projectLifetime, project);
                            }
                        }
                    }
                }
            }

            if (newUnityProjects.Count > 0)
            {
                myChangeManager.ExecuteAfterChange(() =>
                {
                    NotifyHasUnityReference();
                    NotifyOnUnityProjectAdded(newUnityProjects);
                });
            }

            return(null);
        }
Beispiel #3
0
        object IChangeProvider.Execute(IChangeMap changeMap)
        {
            var projectModelChange = changeMap.GetChange <ProjectModelChange>(mySolution);

            if (projectModelChange == null)
            {
                return(null);
            }

            var changes = ReferencedAssembliesService.TryGetAssemblyReferenceChanges(projectModelChange,
                                                                                     ProjectExtensions.UnityReferenceNames, myLogger);

            var newUnityProjects = new JetHashSet <IProject>();

            foreach (var change in changes)
            {
                if (change.IsAdded)
                {
                    var project = change.GetNewProject();
                    if (project.IsUnityProject())
                    {
                        newUnityProjects.Add(project);
                    }
                }
            }

            myChangeManager.ExecuteAfterChange(() =>
            {
                foreach (var project in newUnityProjects)
                {
                    OnUnityProjectAdded(project);
                }
            });

            return(null);
        }