private void clearAllPresetFiltersProject(JiraPresetFiltersGroupTreeNode groupNode) { DialogResult result = MessageBox.Show( "Do you really want to clear projects from all preset filters?", Constants.QUESTION_CAPTION, MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (DialogResult.Yes != result) { return; } foreach (var n in groupNode.Nodes) { JiraPresetFilterTreeNode node = n as JiraPresetFilterTreeNode; if (node == null) { continue; } node.setProject(null); if (SelectedNode == node) { reloadIssues(); } } }
private void setAllPresetFiltersProject(JiraPresetFiltersGroupTreeNode groupNode) { SelectJiraProject dlg = new SelectJiraProject(JiraServerCache.Instance.getProjects(groupNode.Server).Values, groupNode.Project); dlg.ShowDialog(); JiraProject project = dlg.getSelectedProject(); if (project == null) { return; } foreach (var n in groupNode.Nodes) { JiraPresetFilterTreeNode node = n as JiraPresetFilterTreeNode; if (node == null) { continue; } node.setProject(project); if (SelectedNode == node) { reloadIssues(); } } }
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 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 PresetFilterGroupContextMenu(JiraPresetFiltersGroupTreeNode filterNode, MenuSelectionAction setAction, MenuSelectionAction clearAction) { this.filterNode = filterNode; this.setAction = setAction; this.clearAction = clearAction; items = new[] { new ToolStripMenuItem("Set Project On All Filters", Resources.plus, new EventHandler(setProject)), new ToolStripMenuItem("Clear Project From All Filters", Resources.minus, new EventHandler(clearProject)), }; Items.Add("dummy"); Opened += filterContextMenuOpened; }