Beispiel #1
0
        private bool HasAnyFileChangeRec(ProjectModelChange change)
        {
            var file = change.ProjectModelElement as IProjectFile;

            if (file != null && (change.IsAdded || change.IsRemoved || change.IsMovedIn || change.IsMovedOut))
            {
                // Log something
                return(true);
            }

            foreach (var childChange in change.GetChildren())
            {
                if (HasAnyFileChangeRec(childChange))
                {
                    return(true);
                }
            }
            return(false);
        }
Beispiel #2
0
        private void FWithDelta(ProjectModelChange obj)
        {
            var reference = obj as ProjectReferenceTargetChange;

            if (reference != null)
            {
                var assembly = reference.NewReferenceTarget as IAssembly;
                if (assembly != null)
                {
                    var projectElement = reference.ProjectModelElement as IProjectElement;
                    if (projectElement == null)
                    {
                        return;
                    }

                    var project = GetProject(projectElement.GetProject());

                    project.Data = null;

                    using (var loader = new MetadataLoader())
                    {
                        var path = assembly.GetFiles().First().Location;
                        project._libs.Add(new FileLibReference(path.ToString()));
                        var metadataAssembly = loader.LoadFrom(path, x => true);
                        foreach (var a in metadataAssembly.CustomAttributesTypeNames)
                        {
                            if (a.FullName.EqualTo("Nitra.GrammarsAttribute"))
                            {
                                project.TryAddNitraExtensionAssemblyReference(path);
                            }
                        }
                    }

                    if (IsOpened)
                    {
                        project.UpdateProperties();
                    }
                }
            }
        }
Beispiel #3
0
 public IEnumerable <IPsiSourceFile> OnProjectModelChange(ProjectModelChange change)
 {
     return(EmptyList <IPsiSourceFile> .InstanceList);
 }
 public IEnumerable <IPsiSourceFile> OnProjectModelChange(ProjectModelChange change)
 {
     // TODO
     return(Enumerable.Empty <IPsiSourceFile>());
 }
Beispiel #5
0
    private void FWithDelta(ProjectModelChange obj)
    {
      var reference = obj as ProjectReferenceTargetChange;
      if (reference != null)
      {
        var assembly = reference.NewReferenceTarget as IAssembly;
        if (assembly != null)
        {
          var projectElement = reference.ProjectModelElement as IProjectElement;
          if (projectElement == null)
            return;

          var project = GetProject(projectElement.GetProject());

          project.Data = null;

          using (var loader = new MetadataLoader())
          {
            var path = assembly.GetFiles().First().Location;
            project._libs.Add(new FileLibReference(path.ToString()));
            var metadataAssembly = loader.LoadFrom(path, x => true);
            foreach (var a in metadataAssembly.CustomAttributesTypeNames)
              if (a.FullName.EqualTo("Nitra.GrammarsAttribute"))
                project.TryAddNitraExtensionAssemblyReference(path);
          }

          if (IsOpened)
            project.UpdateProperties();
        }
      }
    }
Beispiel #6
0
        private LocalList <IProjectToUnresolvedAssemblyReference> GetUnresolvedReferences(ProjectModelChange projectModelChange)
        {
            var result = new LocalList <IProjectToUnresolvedAssemblyReference>();
            var q      = new Queue <ProjectModelChange>();

            q.Enqueue(projectModelChange);

            while (q.Count > 0)
            {
                var change = q.Dequeue();
                if (change == null)
                {
                    continue;
                }

                var reference = change.ProjectModelElement as IProjectToUnresolvedAssemblyReference;
                if (reference != null &&
                    ProjectExtensions.UnityReferenceNames.Contains(reference.ReferenceTarget.AssemblyName) &&
                    change.IsAdded)
                {
                    result.Add(reference);
                }

                foreach (var c in change.GetChildren())
                {
                    q.Enqueue(c);
                }
            }

            return(result);
        }
 public IEnumerable<IPsiSourceFile> OnProjectModelChange(ProjectModelChange change)
 {
     // TODO
     return Enumerable.Empty<IPsiSourceFile>();
 }
 IEnumerable<IPsiSourceFile> ICache.OnProjectModelChange(ProjectModelChange change)
 {
     return EmptyList<IPsiSourceFile>.InstanceList;
 }