<commit_before>﻿using System;
using System.Collections.Generic;
using System.Drawing;
using Aga.Controls.Tree.NodeControls;
using VersionOne.VisualStudio.DataLayer.Entities;
using VersionOne.VisualStudio.VSPackage.Controllers;
using VersionOne.VisualStudio.VSPackage.Descriptors;
using Aga.Controls.Tree;
using VersionOne.VisualStudio.DataLayer;
using System.Windows.Forms;

using VersionOne.VisualStudio.VSPackage.Events;
using VersionOne.VisualStudio.VSPackage.Forms;
using VersionOne.VisualStudio.VSPackage.Settings;
using VersionOne.VisualStudio.VSPackage.TreeViewEditors;

using NodeComboBox = VersionOne.VisualStudio.VSPackage.TreeViewEditors.NodeComboBox;

namespace VersionOne.VisualStudio.VSPackage.Controls {
    /// <summary>
    /// Task List control displaying V1 tasks for the currently selected Project.
    /// </summary>
    public partial class WorkitemTreeControl : V1UserControl, IWorkitemTreeView {        
        private readonly Dictionary<string, string> columnToAttributeMappings = new Dictionary<string, string>();
        
        private StoryTreeModel storyTreeModel;

        private bool addTaskEnabled;
        private bool addDefectEnabled;
        private bool addTestEnabled;

        public WorkitemTreeController Controller { get; set; }

        public string Title {
            get { return ParentWindow.Caption; }
            set { ParentWindow.Caption = value; }
        }

        public WorkitemDescriptor CurrentWorkitemDescriptor {
            get { return tvWorkitems.SelectedNode == null ? null : tvWorkitems.SelectedNode.Tag as WorkitemDescriptor; }
        }

        public StoryTreeModel Model {
            get { return storyTreeModel; }
            set {
                storyTreeModel = value;
                tvWorkitems.BeginUpdate();
                tvWorkitems.Model = null;
                tvWorkitems.Model = value;
                tvWorkitems.EndUpdate();
            }
        }

        public bool AddTaskCommandEnabled {
            get { return addTaskEnabled; }
            set {
                addTaskEnabled = value;
                btnAddTask.Enabled = value;
            }
        }

        public bool AddDefectCommandEnabled {
            get { return addDefectEnabled; }
            set {
                addDefectEnabled = value;
                btnAddDefect.Enabled = value;
            }
        }

        public bool AddTestCommandEnabled {
            get { return addTestEnabled; }
            set {
                addTestEnabled = value;
                btnAddTest.Enabled = value;
            }
        }

        private readonly IWaitCursor waitCursor;

        public WorkitemTreeControl(TaskWindow parent) : base(parent) {
            InitializeComponent();

            btnOnlyMyTasks.Checked = SettingsImpl.Instance.ShowMyTasks;

            tvWorkitems.SelectionChanged += tvWorkitems_SelectionChanged;
            btnSave.Click += toolBtnSave_Click;
            btnRefresh.Click += toolBtnRefresh_Click;
            btnOnlyMyTasks.CheckedChanged += btnShowMyTasks_CheckedChanged;
            
            miSave.Click += miSave_Click;
            miRevert.Click += miRevert_Click;
            miSignup.Click += miSignup_Click;
            miQuickClose.Click += miQuickClose_Click;
            miClose.Click += miClose_Click;
            miNewTask.Click += AddTask_Click;
            miNewDefect.Click += AddDefect_Click;
            tvWorkitems.ContextMenu.Popup += ContextMenu_Popup;

            btnAddTask.Click += AddTask_Click;
            btnAddDefect.Click += AddDefect_Click;
            btnAddTest.Click += AddTest_Click;

            VisibleChanged += (sender, e) => RefreshProperties();
            CursorChanged += (sender, e) => RefreshProperties();
            Enter += (sender, e) => RefreshProperties();

            waitCursor = GetWaitCursor();<commit_msg>missing menu item action subscription<commit_after>﻿using System;
using System.Collections.Generic;
using System.Drawing;
using Aga.Controls.Tree.NodeControls;
using VersionOne.VisualStudio.DataLayer.Entities;
using VersionOne.VisualStudio.VSPackage.Controllers;
using VersionOne.VisualStudio.VSPackage.Descriptors;
using Aga.Controls.Tree;
using VersionOne.VisualStudio.DataLayer;
using System.Windows.Forms;

using VersionOne.VisualStudio.VSPackage.Events;
using VersionOne.VisualStudio.VSPackage.Forms;
using VersionOne.VisualStudio.VSPackage.Settings;
using VersionOne.VisualStudio.VSPackage.TreeViewEditors;

using NodeComboBox = VersionOne.VisualStudio.VSPackage.TreeViewEditors.NodeComboBox;

namespace VersionOne.VisualStudio.VSPackage.Controls {
    /// <summary>
    /// Task List control displaying V1 tasks for the currently selected Project.
    /// </summary>
    public partial class WorkitemTreeControl : V1UserControl, IWorkitemTreeView {        
        private readonly Dictionary<string, string> columnToAttributeMappings = new Dictionary<string, string>();
        
        private StoryTreeModel storyTreeModel;

        private bool addTaskEnabled;
        private bool addDefectEnabled;
        private bool addTestEnabled;

        public WorkitemTreeController Controller { get; set; }

        public string Title {
            get { return ParentWindow.Caption; }
            set { ParentWindow.Caption = value; }
        }

        public WorkitemDescriptor CurrentWorkitemDescriptor {
            get { return tvWorkitems.SelectedNode == null ? null : tvWorkitems.SelectedNode.Tag as WorkitemDescriptor; }
        }

        public StoryTreeModel Model {
            get { return storyTreeModel; }
            set {
                storyTreeModel = value;
                tvWorkitems.BeginUpdate();
                tvWorkitems.Model = null;
                tvWorkitems.Model = value;
                tvWorkitems.EndUpdate();
            }
        }

        public bool AddTaskCommandEnabled {
            get { return addTaskEnabled; }
            set {
                addTaskEnabled = value;
                btnAddTask.Enabled = value;
            }
        }

        public bool AddDefectCommandEnabled {
            get { return addDefectEnabled; }
            set {
                addDefectEnabled = value;
                btnAddDefect.Enabled = value;
            }
        }

        public bool AddTestCommandEnabled {
            get { return addTestEnabled; }
            set {
                addTestEnabled = value;
                btnAddTest.Enabled = value;
            }
        }

        private readonly IWaitCursor waitCursor;

        public WorkitemTreeControl(TaskWindow parent) : base(parent) {
            InitializeComponent();

            btnOnlyMyTasks.Checked = SettingsImpl.Instance.ShowMyTasks;

            tvWorkitems.SelectionChanged += tvWorkitems_SelectionChanged;
            btnSave.Click += toolBtnSave_Click;
            btnRefresh.Click += toolBtnRefresh_Click;
            btnOnlyMyTasks.CheckedChanged += btnShowMyTasks_CheckedChanged;
            
            miSave.Click += miSave_Click;
            miRevert.Click += miRevert_Click;
            miSignup.Click += miSignup_Click;
            miQuickClose.Click += miQuickClose_Click;
            miClose.Click += miClose_Click;
            miNewTask.Click += AddTask_Click;
            miNewDefect.Click += AddDefect_Click;
            miNewTest.Click += AddTest_Click;
            tvWorkitems.ContextMenu.Popup += ContextMenu_Popup;

            btnAddTask.Click += AddTask_Click;
            btnAddDefect.Click += AddDefect_Click;
            btnAddTest.Click += AddTest_Click;

            VisibleChanged += (sender, e) => RefreshProperties();
            CursorChanged += (sender, e) => RefreshProperties();
            Enter += (sender, e) => RefreshProperties();

            waitCursor = GetWaitCursor();
{'fraction_non_alphanumeric': 0.07451984635083227, 'fraction_numerical': 0.0005121638924455825, 'mean_word_length': 2.2397345499792616, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6005097', 'n_tokens_mistral': 2012, 'n_tokens_neox': 1925, 'n_words': 405}