public YouTrackTreeViewController(ISolution solution, TreeSimpleModel treeModel)
     : base(solution)
 {
     this.treeModel  = treeModel;
     this.solution = solution;
     this.presenter = new YouTrackIssuePresenter();
 }
        private TreeSimpleModel PrepareTreeModel(IEnumerable<Issue> issues)
        {
            var model = new TreeSimpleModel();

            var parent = new IssueItem();

            model.Insert(null, parent);

            foreach (var issue in issues)
            {
                var issueItem = new IssueItem
                                {
                                    Id = issue.Id,
                                    Priority = this.youTrackServer.GetPriortyByName(issue.Priority),
                                    Summary = issue.Summary,
                                    IsResolved = false,
                                    State = issue.State,
                        };

                foreach (var closedIssue in this.youTrackServer.ResolvedStates)
                {
                    if (closedIssue.Name == issue.State)
                    {
                        issueItem.IsResolved = true;
                        break;
                    }
                }

                model.Insert(parent, issueItem);
            }

            return model;
        }
        static TreeSimpleModel BuildModel(IEnumerable<FileAssociation> fileAssociations)
        {
            var model = new TreeSimpleModel();

              foreach (var association in fileAssociations ?? EmptyArray<FileAssociation>.Instance)
              {
            model.Insert(null, association);
              }

              return model;
        }
예제 #4
0
        private TreeSimpleModel BuildModel()
        {
            var model = new TreeSimpleModel();

            var indices = myFileAssociations.Keys.ToList();

            foreach (var association in indices.Select(i => myFileAssociations[i]))
            {
                model.Insert(null, association);
            }

            return(model);
        }
예제 #5
0
        public SimianResultsDescriptor(ISolution solution, IList <ISet> sim_sets, string title) : base(solution)
        {
            this.title = title;
            // Create the list of roots, one for each identified set of matching lines.
            List <TreeSection> set_sections = new List <TreeSection>();

            if (sim_sets.Count == 0)
            {
                set_sections.Add(new TreeSection(new TreeSimpleModel(), "No duplication found!"));
            }
            else
            {
                List <ISet> l = new List <ISet>(sim_sets);
                l.Sort(delegate(ISet s1, ISet s2)
                {
                    if (s2.LineCount > s1.LineCount)
                    {
                        return(1);
                    }
                    else if (s2.LineCount == s1.LineCount)
                    {
                        return(0);
                    }
                    else
                    {
                        return(-1);
                    }
                });

                foreach (ISet set in l)
                {
                    // Each set is composed of actual file sections containing an instance of the match.  Create
                    // a node for each of those.
                    TreeSimpleModel tsm = new TreeSimpleModel();

                    foreach (IBlock block in set.Blocks)
                    {
                        tsm.Insert(null, block);
                    }

                    set_sections.Add(new TreeSection(tsm, set.FriendlyText));
                }
            }

            myModel.Sections = set_sections;
            RequestUpdate(UpdateKind.Structure, true);
        }
        public SimianResultsDescriptor(ISolution solution, IList<ISet> sim_sets, string title)
            : base(solution)
        {
            this.title = title;
            // Create the list of roots, one for each identified set of matching lines.
            List<TreeSection> set_sections = new List<TreeSection>();

            if(sim_sets.Count == 0)
            {
                set_sections.Add(new TreeSection(new TreeSimpleModel(), "No duplication found!"));
            }
            else
            {
                List<ISet> l = new List<ISet>(sim_sets);
                l.Sort(delegate (ISet s1, ISet s2)
                           {
                               if (s2.LineCount > s1.LineCount)
                                   return 1;
                               else if (s2.LineCount == s1.LineCount)
                                   return 0;
                               else return -1;
                           });

                foreach (ISet set in l)
                {
                    // Each set is composed of actual file sections containing an instance of the match.  Create
                    // a node for each of those.
                    TreeSimpleModel tsm = new TreeSimpleModel();

                    foreach (IBlock block in set.Blocks)
                    {
                        tsm.Insert(null, block);
                    }

                    set_sections.Add(new TreeSection(tsm, set.FriendlyText));
                }
            }

            myModel.Sections = set_sections;
            RequestUpdate(UpdateKind.Structure, true);
        }
    /// <summary>
    /// Update descriptor's sections (sorting, titling, adding new sections) and return them.
    /// </summary>
    /// <param name="descriptor"/>
    /// <returns/>
    public override ICollection<TreeSection> GetTreeSections(OccurenceBrowserDescriptor descriptor)
    {
      var searchDescriptor = descriptor as GotoDeclaredElementsBrowserDescriptor;
      if (searchDescriptor == null)
      {
        return EmptyList<TreeSection>.InstanceList;
      }

      var model = new TreeSimpleModel();

      foreach (var result in descriptor.Items.OfType<ItemOccurence>())
      {
        model.Insert(null, result);
      }

      var tree = new TreeSection(model, "Sitecore Items");

      var list = new List<TreeSection>()
      {
        tree
      };

      return list;
    }
    private TreeSimpleModel BuildModel()
    {
      var model = new TreeSimpleModel();

      var indices = myFileAssociations.Keys.ToList();

      foreach (var association in indices.Select(i => myFileAssociations[i]))
      {
        model.Insert(null, association);
      }

      return model;
    }