public void rebuildModelWithSavedFilter(JiraIssueListModel model, JiraServer server, JiraSavedFilter filter)
        {
            List <JiraIssue> issues = facade.getSavedFilterIssues(server, filter, 0, GlobalSettings.JiraIssuesBatch);

            lock (this) {
                model.clear(false);
                model.addIssues(issues);
            }
        }
        public void rebuildModelWithSprint(JiraIssueListModel model, JiraServer server, Sprint sprint)
        {
            var keys = facade.getIssueKeysForSprint(server, sprint);

            if (keys == null || keys.Count == 0)
            {
                lock (this) {
                    model.clear(true);
                    return;
                }
            }
            JiraFilter f = new JqlFilter(keys);

            var issues = facade.getCustomFilterIssues(server, f, 0, GlobalSettings.JiraIssuesBatch);

            lock (this) {
                model.clear(false);
                model.addIssues(issues);
            }
        }
        public void rebuildModelWithRecentlyViewedIssues(JiraIssueListModel model)
        {
            ICollection <RecentlyViewedIssue> issues  = RecentlyViewedIssuesModel.Instance.Issues;
            ICollection <JiraServer>          servers = JiraServerModel.Instance.getAllEnabledServers();

            List <JiraIssue> list = new List <JiraIssue>(issues.Count);

            list.AddRange(from issue in issues
                          let server = findServer(issue.ServerGuid, servers)
                                       where server != null
                                       select facade.getIssue(server, issue.IssueKey));

            lock (this) {
                model.clear(false);
                model.addIssues(list);
            }
        }
 public void clear(bool notify)
 {
     model.clear(notify);
 }
예제 #5
0
        private void reloadKnownJiraServers()
        {
            filtersTree.Nodes.Clear();
            model.clear(true);

            getMoreIssues.Visible = false;

            // copy to local list so that we can reuse in our threads
            List <JiraServer> servers = new List <JiraServer>(JiraServerModel.Instance.getAllServers());

            if (servers.Count == 0)
            {
                status.setInfo("No JIRA servers defined");
                return;
            }

            foreach (JiraServer server in servers)
            {
                filtersTree.Nodes.Add(new JiraServerTreeNode(server, 0));
            }

            Thread metadataThread = new Thread(new ThreadStart(delegate
            {
                try
                {
                    foreach (JiraServer server in servers)
                    {
                        status.setInfo("[" + server.Name + "] Loading project definitions...");
                        List <JiraProject> projects = facade.getProjects(server);
                        JiraServerCache.Instance.clearProjects();
                        foreach (JiraProject proj in projects)
                        {
                            JiraServerCache.Instance.addProject(server, proj);
                        }
                        status.setInfo("[" + server.Name + "] Loading issue types...");
                        List <JiraNamedEntity> issueTypes = facade.getIssueTypes(server);
                        JiraServerCache.Instance.clearIssueTypes();
                        foreach (JiraNamedEntity type in issueTypes)
                        {
                            JiraServerCache.Instance.addIssueType(server, type);
                            ImageCache.Instance.getImage(type.IconUrl);
                        }
                        status.setInfo("[" + server.Name + "] Loading issue priorities...");
                        List <JiraNamedEntity> priorities = facade.getPriorities(server);
                        JiraServerCache.Instance.clearPriorities();
                        foreach (JiraNamedEntity prio in priorities)
                        {
                            JiraServerCache.Instance.addPriority(server, prio);
                            ImageCache.Instance.getImage(prio.IconUrl);
                        }
                        status.setInfo("[" + server.Name + "] Loading issue statuses...");
                        List <JiraNamedEntity> statuses = facade.getStatuses(server);
                        JiraServerCache.Instance.clearStatuses();
                        foreach (JiraNamedEntity s in statuses)
                        {
                            JiraServerCache.Instance.addStatus(server, s);
                            ImageCache.Instance.getImage(s.IconUrl);
                        }

                        status.setInfo("[" + server.Name + "] Loading saved filters...");
                        List <JiraSavedFilter> filters = facade.getSavedFilters(server);
                        JiraServer jiraServer          = server;
                        Invoke(new MethodInvoker(delegate
                        {
                            fillSavedFiltersForServer(jiraServer, filters);
                            status.setInfo("Loaded saved filters for server " +
                                           jiraServer.Name);
                            addCustomFilterNodes(jiraServer);
                        }));
                    }
                    Invoke(new MethodInvoker(delegate
                    {
                        filtersTree.Nodes.Add(new RecentlyOpenIssuesTreeNode(3));
                        filtersTree.ExpandAll();
                    }));
                }
                catch (Exception e)
                {
                    status.setError("Failed to load server metadata", e);
                }
            }));

            metadataThread.Start();
        }