Example #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();
        }
        private JiraCustomFilterTreeNode addCustomFilterTreeNode(JiraServer server, TreeNode node, JiraCustomFilter filter) {
            JiraCustomFilterTreeNode cfNode = new JiraCustomFilterTreeNode(server, filter, 1);
            cfNode.ContextMenuStrip = new CustomFilterContextMenu(server, cfNode, editCustomFilter, removeCustomFilter);

            node.Nodes.Add(cfNode);
            return cfNode;
        }
Example #3
0
 public void getAndCastSelectedNode(
     out JiraSavedFilterTreeNode saved, out RecentlyOpenIssuesTreeNode recent,
     out JiraCustomFilterTreeNode custom, out JiraPresetFilterTreeNode preset,
     out GhSprintTreeNode sprint)
 {
     saved  = SelectedNode as JiraSavedFilterTreeNode;
     recent = SelectedNode as RecentlyOpenIssuesTreeNode;
     custom = SelectedNode as JiraCustomFilterTreeNode;
     preset = SelectedNode as JiraPresetFilterTreeNode;
     sprint = SelectedNode as GhSprintTreeNode;
 }
 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 editCustomFilter(JiraCustomFilterTreeNode node) {
            if (node == null) {
                return;
            }

            EditCustomFilter ecf = new EditCustomFilter(node.Server, node.Filter, true);
            ecf.ShowDialog();
            if (!ecf.Changed) return;

            node.setFilterName(node.Filter.Name);

            JiraCustomFilter.save();
            reloadIssues();
        }
        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);
                        }
                    }
                }
            }
        }
        public CustomFilterContextMenu(JiraServer server, JiraCustomFilterTreeNode filterNode, MenuSelectionAction editAction, MenuSelectionAction removeAction)
        {
            this.server       = server;
            this.filterNode   = filterNode;
            this.editAction   = editAction;
            this.removeAction = removeAction;

            items = new[]
            {
                new ToolStripMenuItem("Edit Filter", Resources.edit, new EventHandler(editFilter)),
                new ToolStripMenuItem("Remove Filter", Resources.minus, new EventHandler(removeFilter)),
                new ToolStripMenuItem("View Filter in Browser", Resources.view_in_browser,
                                      new EventHandler(browseFilter)),
            };

            Items.Add("dummy");

            Opened += filterContextMenuOpened;
        }