public void addFilterGroupNodes(JiraServer server) {
            JiraServerTreeNode node = findServerNode(server);
            if (node == null) return;

            JiraPresetFiltersGroupTreeNode presetFiltersGroupTreeNode = new JiraPresetFiltersGroupTreeNode(server, 4);
            presetFiltersGroupTreeNode.ContextMenuStrip = new PresetFilterGroupContextMenu(presetFiltersGroupTreeNode,
                                                                                           setAllPresetFiltersProject,
                                                                                           clearAllPresetFiltersProject);
            node.Nodes.Add(presetFiltersGroupTreeNode);
            node.Nodes.Add(new JiraSavedFiltersGroupTreeNode(server, 2));
            JiraCustomFiltersGroupTreeNode customFiltersGroupTreeNode = new JiraCustomFiltersGroupTreeNode(server, 3);
            customFiltersGroupTreeNode.ContextMenuStrip = new CustomFilterGroupContextMenu(customFiltersGroupTreeNode, addCustomFilter);
            node.Nodes.Add(customFiltersGroupTreeNode);
        }
        public CustomFilterGroupContextMenu(JiraCustomFiltersGroupTreeNode groupTreeNode, AddFilterAction addFilterAction)
        {
            this.groupTreeNode   = groupTreeNode;
            this.addFilterAction = addFilterAction;

            items = new[]
            {
                new ToolStripMenuItem("Add Filter", Resources.plus, new EventHandler(addFilter)),
            };

            Items.Add("dummy");

            Opened += filterContextMenuOpened;
        }
        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);
                        }
                    }
                }
            }
        }