Example #1
0
        //[MenuItem ("CONTEXT/Change/Delete Empty Changeset", true)]
        static bool DeleteChangeSetTest(int userData)
        {
            ListControl l   = ListControl.FromID(userData);
            ChangeSets  set = l.SelectedChangeSets;

            if (set.Count == 0)
            {
                return(false);
            }
            ChangeSet change = GetChangeSet(set);

            if (change.id == "-1")
            {
                return(false);
            }

            ListItem item = l.GetChangeSetItem(change);
            // TODO: Make changelist cache nonmanaged side to fix this!
            bool hasAssets = item != null && item.HasChildren && item.FirstChild.Asset != null && item.FirstChild.Name != ListControl.c_emptyChangeListMessage;

            if (!hasAssets)
            {
                Task task = Provider.ChangeSetStatus(change);
                task.Wait();
                hasAssets = task.assetList.Count != 0;
            }

            return(!hasAssets && Provider.DeleteChangeSetsIsValid(set));
        }
        private static bool DeleteChangeSetTest(int userData)
        {
            ListControl listControl        = ListControl.FromID(userData);
            ChangeSets  selectedChangeSets = listControl.SelectedChangeSets;

            if (selectedChangeSets.Count == 0)
            {
                return(false);
            }
            ChangeSet changeSet = ChangeSetContextMenu.GetChangeSet(selectedChangeSets);

            if (changeSet.id == "-1")
            {
                return(false);
            }
            ListItem changeSetItem = listControl.GetChangeSetItem(changeSet);
            bool     flag          = changeSetItem != null && changeSetItem.HasChildren && changeSetItem.FirstChild.Asset != null && changeSetItem.FirstChild.Name != "Empty change list";

            if (!flag)
            {
                Task task = Provider.ChangeSetStatus(changeSet);
                task.Wait();
                flag = (task.assetList.Count != 0);
            }
            return(!flag && Provider.DeleteChangeSetsIsValid(selectedChangeSets));
        }
Example #3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="other"></param>
 /// <returns></returns>
 public override bool Equals(Issue other)
 {
     if (other == null)
     {
         return(false);
     }
     return(Id == other.Id &&
            Project == other.Project &&
            Tracker == other.Tracker &&
            Status == other.Status &&
            Priority == other.Priority &&
            Author == other.Author &&
            Category == other.Category &&
            Subject == other.Subject &&
            Description == other.Description &&
            StartDate == other.StartDate &&
            DueDate == other.DueDate &&
            DoneRatio == other.DoneRatio &&
            EstimatedHours == other.EstimatedHours &&
            (CustomFields != null ? CustomFields.Equals <IssueCustomField>(other.CustomFields) : other.CustomFields == null) &&
            CreatedOn == other.CreatedOn &&
            UpdatedOn == other.UpdatedOn &&
            AssignedTo == other.AssignedTo &&
            FixedVersion == other.FixedVersion &&
            Notes == other.Notes &&
            (Watchers != null ? Watchers.Equals <Watcher>(other.Watchers) : other.Watchers == null) &&
            ClosedOn == other.ClosedOn &&
            SpentHours == other.SpentHours &&
            PrivateNotes == other.PrivateNotes &&
            (Attachments != null ? Attachments.Equals <Attachment>(other.Attachments) : other.Attachments == null) &&
            (ChangeSets != null ? ChangeSets.Equals <ChangeSet>(other.ChangeSets) : other.ChangeSets == null) &&
            (Children != null ? Children.Equals <IssueChild>(other.Children) : other.Children == null) &&
            (Journals != null ? Journals.Equals <Journal>(other.Journals) : other.Journals == null) &&
            (Relations != null ? Relations.Equals <IssueRelation>(other.Relations) : other.Relations == null));
 }
        private static void RevertUnchanged(int userData)
        {
            ChangeSets selectedChangeSets = ListControl.FromID(userData).SelectedChangeSets;

            Provider.RevertChangeSets(selectedChangeSets, RevertMode.Unchanged).SetCompletionAction(CompletionAction.UpdatePendingWindow);
            Provider.InvalidateCache();
        }
 private static ChangeSet GetChangeSet(ChangeSets changes)
 {
     if (changes.Count == 0)
     {
         return(null);
     }
     return(changes[0]);
 }
Example #6
0
        public void AddChangeSet(string name, string revision)
        {
            Changelist cl = new Changelist();

            cl.SetDescription(name);
            cl.SetRevision(revision);
            ChangeSets.Add(cl);
        }
 private static ChangeSet GetChangeSet(ChangeSets changes)
 {
     if (changes.Count == 0)
     {
         return null;
     }
     return changes[0];
 }
Example #8
0
        private static bool EditChangeSetTest(int userData)
        {
            ChangeSets selectedChangeSets = ListControl.FromID(userData).SelectedChangeSets;

            if (selectedChangeSets.Count == 0)
            {
                return(false);
            }
            return((GetChangeSet(selectedChangeSets).id != "-1") && Provider.SubmitIsValid(selectedChangeSets[0], null));
        }
Example #9
0
        //[MenuItem ("CONTEXT/Change/Revert...", false, 200)]
        static void Revert(int userData)
        {
            ChangeSets set    = ListControl.FromID(userData).SelectedChangeSets;
            ChangeSet  change = GetChangeSet(set);

            if (change != null)
            {
                WindowRevert.Open(change);
            }
        }
Example #10
0
        //[MenuItem ("CONTEXT/Change/Submit...", false, 100)]
        static void Submit(int userData)
        {
            ChangeSets set    = ListControl.FromID(userData).SelectedChangeSets;
            ChangeSet  change = GetChangeSet(set);

            if (change != null)
            {
                WindowChange.Open(change, new AssetList(), true);
            }
        }
Example #11
0
        public void BeginChangeSet()
        {
            ChangeSet _changeSet = new ChangeSet();

            _changeSet.UserId     = _userId.Value;
            _changeSet.ChangeDate = DateTime.Now;
            ChangeSets.Add(_changeSet);
            SaveChanges();
            ChangeSetId = _changeSet.ChangeSetId;
        }
        private static void Resolve(int userData)
        {
            ChangeSets selectedChangeSets = ListControl.FromID(userData).SelectedChangeSets;
            ChangeSet  changeSet          = ChangeSetContextMenu.GetChangeSet(selectedChangeSets);

            if (changeSet != null)
            {
                WindowResolve.Open(changeSet);
            }
        }
Example #13
0
        private static bool SubmitTest(int userData)
        {
            ChangeSets selectedChangeSets = ListControl.FromID(userData).SelectedChangeSets;

            if (selectedChangeSets.Count > 0)
            {
                return(Provider.SubmitIsValid(selectedChangeSets[0], (AssetList)null));
            }
            return(false);
        }
Example #14
0
        private static bool EditChangeSetTest(int userData)
        {
            ChangeSets selectedChangeSets = ListControl.FromID(userData).SelectedChangeSets;

            if (selectedChangeSets.Count == 0 || !(ChangeSetContextMenu.GetChangeSet(selectedChangeSets).id != "-1"))
            {
                return(false);
            }
            return(Provider.SubmitIsValid(selectedChangeSets[0], (AssetList)null));
        }
        private static void Submit(int userData)
        {
            ChangeSets selectedChangeSets = ListControl.FromID(userData).SelectedChangeSets;
            ChangeSet  changeSet          = ChangeSetContextMenu.GetChangeSet(selectedChangeSets);

            if (changeSet != null)
            {
                WindowChange.Open(changeSet, new AssetList(), true);
            }
        }
        internal void PopulateListControl(ListControl list, Task task, Texture2D icon)
        {
            // We try to correct the existing list by removing/adding entries.
            // This way the entries will keep their children while the children are updated
            // and will prevent flicker

            // list.Clear ();

            // Remove from existing list entries not in the incoming one
            ChangeSets css = task.changeSets;

            ListItem it = list.Root.FirstChild;

            while (it != null)
            {
                ChangeSet cs = it.Item as ChangeSet;
                if (css.Find(elm => elm.id == cs.id) == null)
                {
                    // Found an list item that was not in the incoming list.
                    // Lets remove it.
                    ListItem rm = it;
                    it = it.Next;
                    list.Root.Remove(rm);
                }
                else
                {
                    it = it.Next;
                }
            }

            // Update the existing ones with the new content or add new ones
            foreach (ChangeSet change in css)
            {
                ListItem changeItem = list.GetChangeSetItem(change);

                if (changeItem != null)
                {
                    changeItem.Item = change;
                    changeItem.Name = FormatChangeSetDescription(change);
                }
                else
                {
                    changeItem = list.Add(null, FormatChangeSetDescription(change), change);
                }
                changeItem.Exclusive = true; // Single selection only
                changeItem.CanAccept = true; // Accept drag and drop
                changeItem.Icon      = icon; // changeset icon
            }

            // Refresh here will trigger the expand events to ensure the same change lists
            // are kept open. This will in turn trigger change list contents update requests
            list.Refresh();
            list.Filter = m_SearchText;
            Repaint();
        }
        private ChangeSets GetEmptyChangeSetsCandidates()
        {
            ListControl l        = pendingList;
            ChangeSets  set      = l.EmptyChangeSets;
            ChangeSets  toDelete = new ChangeSets();

            set
            .FindAll(item => item.id != ChangeSet.defaultID)
            .ForEach(delegate(ChangeSet s) { toDelete.Add(s); });
            return(toDelete);
        }
Example #18
0
        private ChangeSets GetEmptyChangeSetsCandidates()
        {
            ListControl listControl     = this.pendingList;
            ChangeSets  emptyChangeSets = listControl.EmptyChangeSets;
            ChangeSets  toDelete        = new ChangeSets();

            emptyChangeSets.FindAll((ChangeSet item) => item.id != ChangeSet.defaultID).ForEach(delegate(ChangeSet s)
            {
                toDelete.Add(s);
            });
            return(toDelete);
        }
Example #19
0
        //[MenuItem ("CONTEXT/Change/Edit Changeset...", true)]
        static bool EditChangeSetTest(int userData)
        {
            ChangeSets set = ListControl.FromID(userData).SelectedChangeSets;

            if (set.Count == 0)
            {
                return(false);
            }
            ChangeSet change = GetChangeSet(set);

            return(change.id != "-1" && Provider.SubmitIsValid(set[0], null));
        }
Example #20
0
        private static ChangeSet GetChangeSet(ChangeSets changes)
        {
            ChangeSet result;

            if (changes.Count == 0)
            {
                result = null;
            }
            else
            {
                result = changes[0];
            }
            return(result);
        }
Example #21
0
        private ChangeSets GetEmptyChangeSetsCandidates()
        {
            // ISSUE: object of a compiler-generated type is created
            // ISSUE: variable of a compiler-generated type
            WindowPending.\u003CGetEmptyChangeSetsCandidates\u003Ec__AnonStoreyC2 candidatesCAnonStoreyC2 = new WindowPending.\u003CGetEmptyChangeSetsCandidates\u003Ec__AnonStoreyC2();
            ChangeSets emptyChangeSets = this.pendingList.EmptyChangeSets;

            // ISSUE: reference to a compiler-generated field
            candidatesCAnonStoreyC2.toDelete = new ChangeSets();
            // ISSUE: reference to a compiler-generated method
            emptyChangeSets.FindAll((Predicate <ChangeSet>)(item => item.id != ChangeSet.defaultID)).ForEach(new System.Action <ChangeSet>(candidatesCAnonStoreyC2.\u003C\u003Em__232));
            // ISSUE: reference to a compiler-generated field
            return(candidatesCAnonStoreyC2.toDelete);
        }
        private static bool DeleteChangeSetTest(int userData)
        {
            ListControl listControl        = ListControl.FromID(userData);
            ChangeSets  selectedChangeSets = listControl.SelectedChangeSets;

            if (selectedChangeSets.Count == 0)
            {
                return(false);
            }
            ChangeSet changeSet     = ChangeSetContextMenu.GetChangeSet(selectedChangeSets);
            ListItem  changeSetItem = listControl.GetChangeSetItem(changeSet);

            return((changeSetItem == null || !changeSetItem.HasChildren || changeSetItem.FirstChild.Asset == null || !(changeSetItem.FirstChild.Name != "Empty change list")) && changeSet.id != "-1" && Provider.DeleteChangeSetsIsValid(selectedChangeSets));
        }
Example #23
0
        private static bool EditChangeSetTest(int userData)
        {
            ChangeSets selectedChangeSets = ListControl.FromID(userData).SelectedChangeSets;
            bool       result;

            if (selectedChangeSets.Count == 0)
            {
                result = false;
            }
            else
            {
                ChangeSet changeSet = ChangeSetContextMenu.GetChangeSet(selectedChangeSets);
                result = (changeSet.id != "-1" && Provider.SubmitIsValid(selectedChangeSets[0], null));
            }
            return(result);
        }
Example #24
0
        private void PopulateListControl(ListControl list, Task task, Texture2D icon)
        {
            ChangeSets changeSets = task.changeSets;
            ListItem   listItem1  = list.Root.FirstChild;

            while (listItem1 != null)
            {
                // ISSUE: object of a compiler-generated type is created
                // ISSUE: reference to a compiler-generated method
                if (changeSets.Find(new Predicate <ChangeSet>(new WindowPending.\u003CPopulateListControl\u003Ec__AnonStoreyC1()
                {
                    cs = listItem1.Item as ChangeSet
                }.\u003C\u003Em__230)) == null)
                {
                    ListItem listItem2 = listItem1;
                    listItem1 = listItem1.Next;
                    list.Root.Remove(listItem2);
                }
                else
                {
                    listItem1 = listItem1.Next;
                }
            }
            using (List <ChangeSet> .Enumerator enumerator = changeSets.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    ChangeSet current   = enumerator.Current;
                    ListItem  listItem2 = list.GetChangeSetItem(current);
                    if (listItem2 != null)
                    {
                        listItem2.Item = (object)current;
                        listItem2.Name = current.description;
                    }
                    else
                    {
                        listItem2 = list.Add((ListItem)null, current.description, current);
                    }
                    listItem2.Exclusive = true;
                    listItem2.CanAccept = true;
                    listItem2.Icon      = (Texture)icon;
                }
            }
            list.Refresh();
            this.Repaint();
        }
Example #25
0
        private void PopulateListControl(ListControl list, Task task, Texture2D icon)
        {
            ChangeSets changeSets = task.changeSets;
            ListItem   listItem   = list.Root.FirstChild;

            while (listItem != null)
            {
                ChangeSet cs = listItem.Item as ChangeSet;
                if (changeSets.Find((ChangeSet elm) => elm.id == cs.id) == null)
                {
                    ListItem listItem2 = listItem;
                    listItem = listItem.Next;
                    list.Root.Remove(listItem2);
                }
                else
                {
                    listItem = listItem.Next;
                }
            }
            foreach (ChangeSet current in changeSets)
            {
                ListItem listItem3 = list.GetChangeSetItem(current);
                if (listItem3 != null)
                {
                    listItem3.Item = current;
                    listItem3.Name = current.description;
                }
                else
                {
                    listItem3 = list.Add(null, current.description, current);
                }
                listItem3.Exclusive = true;
                listItem3.CanAccept = true;
                listItem3.Icon      = icon;
            }
            list.Refresh();
            base.Repaint();
        }
Example #26
0
 static internal Task RevertChangeSets(ChangeSets changesets, RevertMode mode)
 {
     return(Internal_RevertChangeSets(changesets.ToArray(), mode));
 }
Example #27
0
 static public bool DeleteChangeSetsIsValid(ChangeSets changesets)
 {
     return(Internal_DeleteChangeSetsIsValid(changesets.ToArray()));
 }
Example #28
0
 static public Task DeleteChangeSets(ChangeSets changesets)
 {
     return(Internal_DeleteChangeSets(changesets.ToArray()));
 }
        private bool HasEmptyPendingChangesets()
        {
            ChangeSets changeSets = GetEmptyChangeSetsCandidates();

            return(Provider.DeleteChangeSetsIsValid(changeSets));
        }
        private void DeleteEmptyPendingChangesets()
        {
            ChangeSets changeSets = GetEmptyChangeSetsCandidates();

            Provider.DeleteChangeSets(changeSets).SetCompletionAction(CompletionAction.UpdatePendingWindow);
        }
Example #31
0
 /// <summary>
 ///   <para>Test if deleting a changeset is a valid task to perform.</para>
 /// </summary>
 /// <param name="changesets">Changeset to test.</param>
 public static bool DeleteChangeSetsIsValid(ChangeSets changesets)
 {
   return Provider.Internal_DeleteChangeSetsIsValid(changesets.ToArray());
 }
Example #32
0
 /// <summary>
 ///   <para>Starts a task that will attempt to delete the given changeset.</para>
 /// </summary>
 /// <param name="changesets">List of changetsets.</param>
 public static Task DeleteChangeSets(ChangeSets changesets)
 {
   return Provider.Internal_DeleteChangeSets(changesets.ToArray());
 }
Example #33
0
 internal static Task RevertChangeSets(ChangeSets changesets, RevertMode mode)
 {
   return Provider.Internal_RevertChangeSets(changesets.ToArray(), mode);
 }
 private static ChangeSet GetChangeSet(ChangeSets changes)
 {
   if (changes.Count == 0)
     return (ChangeSet) null;
   return changes[0];
 }
        private static bool RevertUnchangedTest(int userData)
        {
            ChangeSets selectedChangeSets = ListControl.FromID(userData).SelectedChangeSets;

            return(selectedChangeSets.Count > 0);
        }