예제 #1
0
파일: IssuesList.cs 프로젝트: jacab/JiraSVN
        private void contextMenu_Opening(object sender, CancelEventArgs e)
        {
            if (_currentItem == null)
            {
                //e.Cancel = true;
                return;
            }

            for (int i = _contextMenu.Items.Count - 1; i >= 0; i--)
            {
                if (_contextMenu.Items[i] is ToolStripSeparator)
                {
                    break;
                }
                _contextMenu.Items.RemoveAt(i);
            }

            if (_currentItem != null && _currentItem.Tag is IssueItemView)
            {
                IssueItemView issue = (IssueItemView)_currentItem.Tag;
                foreach (IIssueAction action in issue.GetActions())
                {
                    ActionMenuItem menu = new ActionMenuItem(issue, action);
                    menu.Click += new EventHandler(RefreshContents);
                    _contextMenu.Items.Add(menu);
                }
            }
        }
예제 #2
0
파일: IssuesList.cs 프로젝트: jacab/JiraSVN
        private void listView_ItemChecked(object sender, ItemCheckedEventArgs e)
        {
            IssueItemView issue = e.Item.Tag as IssueItemView;

            if (issue != null)
            {
                issue.Selected = e.Item.Checked;
            }
        }
예제 #3
0
        public ActionMenuItem(IssueItemView item, IIssueAction action)
            : base(action.Name)
        {
            _issue  = item;
            _action = action;

            ToolTipText = String.Format("{0} and assign to {1}.", _action.Name, _issue.ReportedBy.Name);

            Click += DoClick;
        }
예제 #4
0
        public ActionMenuItem(IssueItemView item, IIssueAction action)
            : base(action.Name)
        {
            _issue = item;
            _action = action;

            ToolTipText = String.Format("{0} and assign to {1}.", _action.Name, _issue.ReportedBy.Name);

            Click += DoClick;
        }
예제 #5
0
        bool MatchesCurrentFilter(IssueItemView item)
        {
            IIssueUser byAssignee;

            if (_assignedFilter.TryGetSelection(out byAssignee) && byAssignee.Id != AllUsersFilter.Instance.Id)
            {
                if (item.AssignedTo.Id != byAssignee.Id)
                {
                    return(false);
                }
            }

            IIssueState byStatus;

            if (_statusFilter.TryGetSelection(out byStatus) && byStatus.Id != AllStatusFilter.Instance.Id)
            {
                if (item.CurrentState.Id != byStatus.Id)
                {
                    return(false);
                }
            }

            if (!String.IsNullOrEmpty(_textFilter))
            {
                foreach (string part in _textFilter.Split(' ', '\t'))
                {
                    string phrase = part.Trim();
                    if (String.IsNullOrEmpty(phrase))
                    {
                        continue;
                    }
                    // the plugin may display less records than what the JIRA query returned, as the JIRA query also searches the Comments field.
                    if (item.Name.IndexOf(phrase, StringComparison.InvariantCultureIgnoreCase) < 0 &&
                        item.DisplayId.IndexOf(phrase, StringComparison.InvariantCultureIgnoreCase) < 0 &&
                        item.FullDescription.IndexOf(phrase, StringComparison.InvariantCultureIgnoreCase) < 0 &&
                        item.CurrentState.Name.IndexOf(phrase, StringComparison.InvariantCultureIgnoreCase) < 0 &&
                        item.AssignedTo.Name.IndexOf(phrase, StringComparison.InvariantCultureIgnoreCase) < 0 &&
                        item.ReportedBy.Name.IndexOf(phrase, StringComparison.InvariantCultureIgnoreCase) < 0)
                    {
                        Log.Info("Not going to display JIRA issue of {0}. The search text may only be found in the Comments field or not at all since this text search may be applied on top of a saved filter.", item.DisplayId);

                        return(false);
                    }
                }
            }

            return(true);
        }
예제 #6
0
        bool MatchesCurrentFilter(IssueItemView item)
        {
            IIssueUser byAssignee;

            if (_assignedFilter.TryGetSelection(out byAssignee) && byAssignee.Id != AllUsersFilter.Instance.Id)
            {
                if (item.AssignedTo.Id != byAssignee.Id)
                {
                    return(false);
                }
            }

            IIssueState byStatus;

            if (_statusFilter.TryGetSelection(out byStatus) && byStatus.Id != AllStatusFilter.Instance.Id)
            {
                if (item.CurrentState.Id != byStatus.Id)
                {
                    return(false);
                }
            }

            if (!String.IsNullOrEmpty(_textFilter))
            {
                foreach (string part in _textFilter.Split(' ', '\t'))
                {
                    string phrase = part.Trim();
                    if (String.IsNullOrEmpty(phrase))
                    {
                        continue;
                    }
                    if (item.Name.IndexOf(phrase, StringComparison.InvariantCultureIgnoreCase) < 0 &&
                        item.DisplayId.IndexOf(phrase, StringComparison.InvariantCultureIgnoreCase) < 0 &&
                        item.FullDescription.IndexOf(phrase, StringComparison.InvariantCultureIgnoreCase) < 0 &&
                        item.CurrentState.Name.IndexOf(phrase, StringComparison.InvariantCultureIgnoreCase) < 0 &&
                        item.AssignedTo.Name.IndexOf(phrase, StringComparison.InvariantCultureIgnoreCase) < 0 &&
                        item.ReportedBy.Name.IndexOf(phrase, StringComparison.InvariantCultureIgnoreCase) < 0)
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }
예제 #7
0
        bool MatchesCurrentFilter(IssueItemView item)
        {
            IIssueUser byAssignee;
            if (_assignedFilter.TryGetSelection(out byAssignee) && byAssignee.Id != AllUsersFilter.Instance.Id)
            {
                if (item.AssignedTo.Id != byAssignee.Id)
                    return false;
            }

            IIssueState byStatus;
            if (_statusFilter.TryGetSelection(out byStatus) && byStatus.Id != AllStatusFilter.Instance.Id)
            {
                if (item.CurrentState.Id != byStatus.Id)
                    return false;
            }

            if (!String.IsNullOrEmpty(_textFilter))
            {
                foreach (string part in _textFilter.Split(' ', '\t'))
                {
                    string phrase = part.Trim();
                    if (String.IsNullOrEmpty(phrase))
                        continue;
                    if (item.Name.IndexOf(phrase, StringComparison.InvariantCultureIgnoreCase) < 0 &&
                        item.DisplayId.IndexOf(phrase, StringComparison.InvariantCultureIgnoreCase) < 0 &&
                        item.FullDescription.IndexOf(phrase, StringComparison.InvariantCultureIgnoreCase) < 0 &&
                        item.CurrentState.Name.IndexOf(phrase, StringComparison.InvariantCultureIgnoreCase) < 0 &&
                        item.AssignedTo.Name.IndexOf(phrase, StringComparison.InvariantCultureIgnoreCase) < 0 &&
                        item.ReportedBy.Name.IndexOf(phrase, StringComparison.InvariantCultureIgnoreCase) < 0)
                        return false;
                }
            }

            return true;
        }
예제 #8
0
        public void Refresh(bool applyLocal)
        {
            IIssueFilter filter;
            List<IssueItemView> found = new List<IssueItemView>();

            Dictionary<string, IIssueUser> distinct = new Dictionary<string, IIssueUser>();
            Dictionary<string, IIssueUser> assigned = new Dictionary<string, IIssueUser>();
            assigned[AllUsersFilter.Instance.Id] = AllUsersFilter.Instance;

            Dictionary<string, IIssueState> statuses = new Dictionary<string, IIssueState>();
            statuses[AllStatusFilter.Instance.Id] = AllStatusFilter.Instance;

            if (_filters.TryGetSelection(out filter))
            {
                IIssue[] items;
                if (filter is IIssueFilterWithSearch)
                    items = ((IIssueFilterWithSearch)filter).GetIssues(_textFilter, 0, 50);
                else
                    items = filter.GetIssues(0, 50);

                foreach (IIssue issue in items)
                {
                    IssueItemView item = new IssueItemView(this, issue);
                    found.Add(item);

                    distinct[item.AssignedTo.Id] = item.AssignedTo;
                    distinct[item.ReportedBy.Id] = item.ReportedBy;

                    assigned[item.AssignedTo.Id] = item.AssignedTo;
                    statuses[item.CurrentState.Id] = item.CurrentState;
                }
            }

            _found = found.ToArray();
            _assignees.AddRange(distinct.Values);

            _assignedFilter.ReplaceContents(assigned.Values);
            if (_assignedFilter.SelectedItem == null)
            {
                _assignedFilter.SelectedItem = AllUsersFilter.Instance;
                if (_assignedFilter.IsSelectionDirty)
                    OnPropertyChanged("SelectedAssignmentFilter");
            }
            _statusFilter.ReplaceContents(statuses.Values);
            if (_statusFilter.SelectedItem == null)
            {
                _statusFilter.SelectedItem = AllStatusFilter.Instance;
                if (_statusFilter.IsSelectionDirty)
                    OnPropertyChanged("SelectedStatusFilter");
            }

            if(applyLocal)
                LocalFilterChanged();
        }
예제 #9
0
        public void Refresh(bool applyLocal)
        {
            IIssueFilter         filter;
            List <IssueItemView> found = new List <IssueItemView>();

            Dictionary <string, IIssueUser> distinct = new Dictionary <string, IIssueUser>();
            Dictionary <string, IIssueUser> assigned = new Dictionary <string, IIssueUser>();

            assigned[AllUsersFilter.Instance.Id] = AllUsersFilter.Instance;

            Dictionary <string, IIssueState> statuses = new Dictionary <string, IIssueState>();

            statuses[AllStatusFilter.Instance.Id] = AllStatusFilter.Instance;

            if (_filters.TryGetSelection(out filter))
            {
                IIssue[] items;
                if (filter is IIssueFilterWithSearch)
                {
                    items = ((IIssueFilterWithSearch)filter).GetIssues(_textFilter, 0, 50);
                }
                else
                {
                    items = filter.GetIssues(0, 50);
                }
                Log.Info("Inside IssuesListView.Refresh: Count of issues just gotten is {0}.", items.Length);
                foreach (IIssue issue in items)
                {
                    IssueItemView item = new IssueItemView(this, issue);
                    found.Add(item);

                    distinct[item.AssignedTo.Id] = item.AssignedTo;
                    distinct[item.ReportedBy.Id] = item.ReportedBy;

                    assigned[item.AssignedTo.Id]   = item.AssignedTo;
                    statuses[item.CurrentState.Id] = item.CurrentState;
                }
            }

            _found = found.ToArray();
            _assignees.AddRange(distinct.Values);
            Log.Info("Inside IssuesListView.Refresh: _found.Length is {0}. _assignees.Count is {1}, assigned.Count is {2}, statuses.Count is {3}",
                     _found.Length, _assignees.Count, assigned.Count, statuses.Count);

            _assignedFilter.ReplaceContents(assigned.Values);
            if (_assignedFilter.SelectedItem == null)
            {
                _assignedFilter.SelectedItem = AllUsersFilter.Instance;
                if (_assignedFilter.IsSelectionDirty)
                {
                    OnPropertyChanged("SelectedAssignmentFilter");
                }
            }
            foreach (var i in statuses.Keys)
            {
                Log.Info("statuses[{0}]={1}", i, statuses[i]);
            }
            _statusFilter.ReplaceContents(statuses.Values);
            if (_statusFilter.SelectedItem == null)
            {
                _statusFilter.SelectedItem = AllStatusFilter.Instance;
                if (_statusFilter.IsSelectionDirty)
                {
                    OnPropertyChanged("SelectedStatusFilter");
                }
            }

            if (applyLocal)
            {
                LocalFilterChanged();
            }
        }
예제 #10
0
        public void Refresh(bool applyLocal)
        {
            IIssueFilter         filter;
            List <IssueItemView> found = new List <IssueItemView>();

            Dictionary <string, IIssueUser> distinct = new Dictionary <string, IIssueUser>();
            Dictionary <string, IIssueUser> assigned = new Dictionary <string, IIssueUser>();

            assigned[AllUsersFilter.Instance.Id] = AllUsersFilter.Instance;

            Dictionary <string, IIssueState> statuses = new Dictionary <string, IIssueState>();

            statuses[AllStatusFilter.Instance.Id] = AllStatusFilter.Instance;

            if (_filters.TryGetSelection(out filter))
            {
                IIssue[] items;
                if (filter is IIssueFilterWithSearch)
                {
                    items = ((IIssueFilterWithSearch)filter).GetIssues(_textFilter, 0, 50);
                }
                else
                {
                    items = filter.GetIssues(0, 50);
                }

                foreach (IIssue issue in items)
                {
                    IssueItemView item = new IssueItemView(this, issue);
                    found.Add(item);

                    distinct[item.AssignedTo.Id] = item.AssignedTo;
                    distinct[item.ReportedBy.Id] = item.ReportedBy;

                    assigned[item.AssignedTo.Id]   = item.AssignedTo;
                    statuses[item.CurrentState.Id] = item.CurrentState;
                }
            }

            _found = found.ToArray();
            _assignees.AddRange(distinct.Values);

            _assignedFilter.ReplaceContents(assigned.Values);
            if (_assignedFilter.SelectedItem == null)
            {
                _assignedFilter.SelectedItem = AllUsersFilter.Instance;
                if (_assignedFilter.IsSelectionDirty)
                {
                    OnPropertyChanged("SelectedAssignmentFilter");
                }
            }
            _statusFilter.ReplaceContents(statuses.Values);
            if (_statusFilter.SelectedItem == null)
            {
                _statusFilter.SelectedItem = AllStatusFilter.Instance;
                if (_statusFilter.IsSelectionDirty)
                {
                    OnPropertyChanged("SelectedStatusFilter");
                }
            }

            if (applyLocal)
            {
                LocalFilterChanged();
            }
        }