Esempio n. 1
0
        public void removeCustomFilter(JiraCustomFilterTreeNode node)
        {
            if (node == null)
            {
                return;
            }
            DialogResult result =
                MessageBox.Show("Do you really want to remove this local filter?",
                                Constants.QUESTION_CAPTION, MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (DialogResult.Yes != result)
            {
                return;
            }

            TreeNodeWithJiraServer groupNode = findGroupNode(node.Server, typeof(JiraCustomFiltersGroupTreeNode));

            if (groupNode == null)
            {
                return;
            }

            groupNode.Nodes.Remove(node);
            SelectedNode = groupNode;
            JiraCustomFilter.remove(node.Filter);
            reloadIssues();
        }
 public void addCustomFilter() {
     JiraServer server = CurrentlySelectedServer;
     if (server == null) {
         return;
     }
     TreeNodeWithJiraServer node = findGroupNode(server, typeof(JiraCustomFiltersGroupTreeNode));
     addCustomFilter(node);
 }
 public void addCustomFilterNodes(JiraServer server) {
     TreeNodeWithJiraServer node = findGroupNode(server, typeof(JiraCustomFiltersGroupTreeNode));
     if (node == null) {
         return;
     }
     foreach (JiraCustomFilter filter in JiraCustomFilter.getAll(server)) {
         addCustomFilterTreeNode(server, node, filter);
     }
 }
 public void addSavedFilterNodes(JiraServer server, IEnumerable<JiraSavedFilter> filters) {
     TreeNodeWithJiraServer node = findGroupNode(server, typeof(JiraSavedFiltersGroupTreeNode));
     if (node == null) {
         return;
     }
     foreach (JiraSavedFilter filter in filters) {
         node.Nodes.Add(new JiraSavedFilterTreeNode(server, filter, 1, new SavedFilterContextMenu(filter)));
     }
 }
 public void addCustomFilter(TreeNodeWithJiraServer node) {
     if (node == null) {
         return;
     }
     JiraCustomFilter newFilter = new JiraCustomFilter(node.Server);
     EditCustomFilter ecf = new EditCustomFilter(node.Server, newFilter, false);
     ecf.ShowDialog();
     if (!ecf.Changed) return;
     JiraCustomFilter.add(newFilter);
     JiraCustomFilterTreeNode newNode = addCustomFilterTreeNode(node.Server, node, newFilter);
     SelectedNode = newNode;
 }
 public void restoreLastSelectedFilterItem() {
     ParameterStore store = ParameterStoreManager.Instance.getStoreFor(ParameterStoreManager.StoreType.SETTINGS);
     bool recentlyViewed = store.loadParameter(FILTERS_TREE_RECENT_PARAM, 0) != 0;
     if (recentlyViewed) {
         foreach (TreeNode node in Nodes) {
             if (!(node is RecentlyOpenIssuesTreeNode)) continue;
             SelectedNode = node;
             break;
         }
     } else {
         string serverGuid = store.loadParameter(FILTERS_TREE_SERVER_PARAM, null);
         foreach (var node in Nodes) {
             TreeNodeWithJiraServer tnws = node as TreeNodeWithJiraServer;
             if (tnws == null) continue;
             if (!tnws.Server.GUID.ToString().Equals(serverGuid)) continue;
             string group = store.loadParameter(FILTERS_TREE_FILTER_GROUP_PARAM, null);
             if (group == null) {
                 SelectedNode = tnws;
             } else {
                 string filter = store.loadParameter(FILTERS_TREE_FILTER_PARAM, null);
                 TreeNodeWithJiraServer groupNode;
                 switch (group) {
                     case GH_SPRINT_GROUP_NAME:
                         groupNode = findGroupNode(tnws.Server, typeof (GhGroupTreeNode));
                         if (selectFilterNode(filter, findGhBoardGroupNode(groupNode as GhGroupTreeNode, filter), compareGhSprint)) {
                             return;
                         }
                         break;
                     case PRESET_FILTER_GROUP_NAME:
                         groupNode = findGroupNode(tnws.Server, typeof(JiraPresetFiltersGroupTreeNode));
                         if (selectFilterNode(filter, groupNode, comparePresetFilterNodeToString)) {
                             return;
                         }
                         break;
                     case SAVED_FILTER_GROUP_NAME:
                         groupNode = findGroupNode(tnws.Server, typeof(JiraSavedFiltersGroupTreeNode));
                         if (selectFilterNode(filter, groupNode, compareSavedFilterNodeToString)) {
                             return;
                         }
                         break;
                     case CUSTOM_FILTER_GROUP_NAME:
                         groupNode = findGroupNode(tnws.Server, typeof(JiraCustomFiltersGroupTreeNode));
                         if (selectFilterNode(filter, groupNode, compareCustomFilterNodeToString)) {
                             return;
                         }
                         break;
                 }
             }
         }
     }
 }
 public void addPresetFilterNodes(JiraServer server) {
     TreeNodeWithJiraServer node = findGroupNode(server, typeof(JiraPresetFiltersGroupTreeNode));
     if (node == null) {
         return;
     }
     node.Nodes.Add(buildPresetFilterNode(server, new JiraPresetFilterUnscheduled(server)));
     node.Nodes.Add(buildPresetFilterNode(server, new JiraPresetFilterOutstanding(server)));
     node.Nodes.Add(buildPresetFilterNode(server, new JiraPresetFilterAssignedToMe(server)));
     node.Nodes.Add(buildPresetFilterNode(server, new JiraPresetFilterReportedByMe(server)));
     node.Nodes.Add(buildPresetFilterNode(server, new JiraPresetFilterRecentlyResolved(server)));
     node.Nodes.Add(buildPresetFilterNode(server, new JiraPresetFilterRecentlyAdded(server)));
     node.Nodes.Add(buildPresetFilterNode(server, new JiraPresetFilterRecentlyUpdated(server)));
     node.Nodes.Add(buildPresetFilterNode(server, new JiraPresetFilterMostImportant(server)));
 }
        public void rememberLastSelectedFilterItem() {
            ParameterStore store = ParameterStoreManager.Instance.getStoreFor(ParameterStoreManager.StoreType.SETTINGS);
            bool recentlyViewed = SelectedNode is RecentlyOpenIssuesTreeNode;
            store.storeParameter(FILTERS_TREE_RECENT_PARAM, recentlyViewed ? 1 : 0);

            TreeNodeWithJiraServer nodeWithJiraServer = SelectedNode as TreeNodeWithJiraServer;
            if (nodeWithJiraServer != null) {
                store.storeParameter(FILTERS_TREE_SERVER_PARAM, nodeWithJiraServer.Server.GUID.ToString());
            }
            JiraPresetFiltersGroupTreeNode pgtn = SelectedNode as JiraPresetFiltersGroupTreeNode;
            JiraCustomFiltersGroupTreeNode cgtn = SelectedNode as JiraCustomFiltersGroupTreeNode;
            JiraSavedFiltersGroupTreeNode sgtn = SelectedNode as JiraSavedFiltersGroupTreeNode;
            GhSprintTreeNode ghtn = SelectedNode as GhSprintTreeNode;

            if (ghtn != null) {
                store.storeParameter(FILTERS_TREE_FILTER_GROUP_PARAM, GH_SPRINT_GROUP_NAME);
                store.storeParameter(FILTERS_TREE_FILTER_PARAM, ghtn.Sprint.BoardId + "/" + ghtn.Sprint.Id);
            } else if (pgtn != null) {
                store.storeParameter(FILTERS_TREE_FILTER_GROUP_PARAM, PRESET_FILTER_GROUP_NAME);
                store.storeParameter(FILTERS_TREE_FILTER_PARAM, null);
            } else {
                if (cgtn != null) {
                    store.storeParameter(FILTERS_TREE_FILTER_GROUP_PARAM, CUSTOM_FILTER_GROUP_NAME);
                    store.storeParameter(FILTERS_TREE_FILTER_PARAM, null);
                } else {
                    if (sgtn != null) {
                        store.storeParameter(FILTERS_TREE_FILTER_GROUP_PARAM, SAVED_FILTER_GROUP_NAME);
                        store.storeParameter(FILTERS_TREE_FILTER_PARAM, null);
                    } else {
                        JiraPresetFilterTreeNode ptn = SelectedNode as JiraPresetFilterTreeNode;
                        JiraCustomFilterTreeNode ctn = SelectedNode as JiraCustomFilterTreeNode;
                        JiraSavedFilterTreeNode stn = SelectedNode as JiraSavedFilterTreeNode;
                        if (ptn != null) {
                            store.storeParameter(FILTERS_TREE_FILTER_GROUP_PARAM, PRESET_FILTER_GROUP_NAME);
                            store.storeParameter(FILTERS_TREE_FILTER_PARAM, ptn.Filter.GetType().ToString());
                        } else if (ctn != null) {
                            store.storeParameter(FILTERS_TREE_FILTER_GROUP_PARAM, CUSTOM_FILTER_GROUP_NAME);
                            store.storeParameter(FILTERS_TREE_FILTER_PARAM, ctn.Filter.Guid.ToString());
                        } else if (stn != null) {
                            store.storeParameter(FILTERS_TREE_FILTER_GROUP_PARAM, SAVED_FILTER_GROUP_NAME);
                            store.storeParameter(FILTERS_TREE_FILTER_PARAM, stn.Filter.Id);
                        } else {
                            store.storeParameter(FILTERS_TREE_FILTER_GROUP_PARAM, null);
                            store.storeParameter(FILTERS_TREE_FILTER_PARAM, null);
                        }
                    }
                }
            }
        }