예제 #1
0
 public UsesTreeNode(DelphiFile file, UsesSection section)
 {
     if (file == null)
         throw new ArgumentNullException("file");
     this.file = file;
     this.section = section;
     this.LazyLoading = true;
 }
예제 #2
0
 public void Resolve(DelphiAnalysis container)
 {
     TargetFile = container.ResolveUnitName(ParentFile.FileName, Name);
     // TODO : split 'Resolve' and add to list and parallelise
     if (TargetFile != null) {
         TargetFile.UsedByFiles.Add(ParentFile);
         ParentFile.UsesFiles.Add(TargetFile);
     }
 }
예제 #3
0
        public DelphiFileTreeNode(DelphiFile file)
        {
            if (file == null)
                throw new ArgumentNullException("file");
            this.file = file;

            Children.Add(new UsesTreeNode(file, UsesSection.Both));
            Children.Add(new UsedByTreeNode(file, UsesSection.Both));
        }
예제 #4
0
 public UsesClause(DelphiFile file, string name, string @namespace = null, string inLocation = null)
 {
     if (file == null)
         throw new ArgumentNullException("file");
     this.ParentFile = file;
     this.Name = name;
     this.Namespace = @namespace;
     this.InLocation = inLocation;
 }
예제 #5
0
 public static MenuItem CreateAnalyzeThis(DelphiFile file)
 {
     if (file == null)
         throw new ArgumentNullException("file");
     var item = new MenuItem {
         Header = "Analyze this!"
     };
     item.Click += (sender, e) => Window1.AnalyzeThis(file);
     return item;
 }
예제 #6
0
 public void AddResult(DelphiFile endPoint, DelphiFile result, Dictionary<DelphiFile, DelphiFile> parent)
 {
     var comparer = KeyComparer.Create<SharpTreeNode, Package>(n => { var pNode = n as PackageTreeNode; if (pNode != null) return pNode.Package; return null; }, Window1.CurrentAnalysis.PackageOrderComparer);
     foreach (var package in endPoint.DirectlyInPackages) {
         var p = package;
         var packageNode = Children.OfType<PackageTreeNode>().FirstOrDefault(n => n.Package == p);
         if (packageNode == null) {
             packageNode = new PackageTreeNode(p, result);
             Children.OrderedInsert(packageNode, comparer, 2);
         }
         packageNode.AddResult(endPoint, parent);
     }
 }
예제 #7
0
 public ResultTreeNode(DelphiFile result)
     : base(result)
 {
 }
예제 #8
0
 void UpdateChildren(DelphiFile[] path)
 {
     var nextNode = path.ElementAtOrDefault(current + 1);
     if (nextNode == null)
         return;
     var pathTreeNode = Children.OfType<PathTreeNode>().FirstOrDefault(n => n.node == nextNode);
     if (pathTreeNode == null) {
         pathTreeNode = new PathTreeNode(path, current + 1);
         Children.OrderedInsert(pathTreeNode, NodeTextComparer);
     } else {
         pathTreeNode.AddPath(path);
     }
 }
예제 #9
0
 public void AddPath(DelphiFile[] path)
 {
     this.paths.Add(path);
     if (!IsVisible) {
         Children.Clear();
         LazyLoading = true;
         return;
     }
     UpdateChildren(path);
     RaisePropertyChanged("Text");
 }
예제 #10
0
 public PathTreeNode(DelphiFile[] path, int current)
 {
     if (path == null)
         throw new ArgumentNullException("path");
     if (path.Length <= current)
         throw new ArgumentException();
     Debug.Assert(current > 0);
     this.paths.Add(path);
     this.current = current;
     this.node = path[current];
     this.LazyLoading = current < path.Length - 1;
 }
예제 #11
0
 public void AddResult(DelphiFile endPoint, Dictionary<DelphiFile, DelphiFile> parents)
 {
     Debug.Assert(target != null);
     results.Add(Tuple.Create(endPoint, parents));
 }
예제 #12
0
 public PackageTreeNode(Package package, DelphiFile target = null)
 {
     if (package == null)
         throw new ArgumentNullException("package");
     this.package = package;
     this.target = target;
     LazyLoading = true;
 }
예제 #13
0
 public static MenuItem CreateCopyUnitName(DelphiFile file)
 {
     if (file == null)
         throw new ArgumentNullException("file");
     var item = new MenuItem {
         Header = "Copy unit name"
     };
     item.Click += (sender, e) => Clipboard.SetText(file.UnitName);
     return item;
 }