コード例 #1
0
        public void ConstructMenu(GetSmartTagItemsEventArgs ea)
        {
            var artifacts = new ApprovalArtifacts(CodeRush.Source.ActiveMethod);

            ea.Add(new RunTestItem("Test"));

            if (artifacts.HasReceivedFile())
            {
                var received = new SmartTagItem("Received File");
                received.AddItem(new OpenFileItem("View", artifacts.Received));
                received.AddItem(new CopyPathItem("Copy File Path", artifacts.Received));
                received.AddItem(new OpenInExplorerItem("Show in Explorer", artifacts.Received));
                ea.Add(received);
            }

            var approved = new SmartTagItem("Approved File");
            approved.AddItem(new OpenFileItem("View", artifacts.Approved));
            approved.AddItem(new CopyPathItem("Copy File Path", artifacts.Approved));
            approved.AddItem(new OpenInExplorerItem("Show in Explorer", artifacts.Approved));
            approved.AddItem(new LoadApproveItem("Set Approval", artifacts.Approved));
            ea.Add(approved);

            if (artifacts.HasReceivedFile() && artifacts.HasApprovalFile())
                ea.Add(new DiffItem("Diff", artifacts.Received, artifacts.Approved));

            if (artifacts.HasReceivedFile()) {
                ea.Add(new OpenFileItem("View Received", artifacts.Received));
                ea.Add(new ApproveItem("Approve", artifacts.Received, artifacts.Approved));
            }
        }
コード例 #2
0
        /// <summary>
        /// Do all the busy work to add a menuitem to a smart tag
        /// </summary>
        /// <param name="ea">Where to put new menu item</param>
        /// <param name="menuText">What to put into the smartTagItem</param>
        /// <param name="handler">What will respond to the user selecting the smart tag item</param>
        private static void AddSmartTagItem(GetSmartTagItemsEventArgs ea, string menuText, System.EventHandler handler)
        {
            SmartTagItem menuItem = new SmartTagItem(menuText);

            menuItem.Execute += handler;
            ea.Add(menuItem);
        }
コード例 #3
0
 /// <summary>
 /// Do all the busy work to add a menuitem to a smart tag
 /// </summary>
 /// <param name="ea">Where to put new menu item</param>
 /// <param name="menuText">What to put into the smartTagItem</param>
 /// <param name="handler">What will respond to the user selecting the smart tag item</param>
 private static void AddSmartTagItem(GetSmartTagItemsEventArgs ea, string menuText, System.EventHandler handler)
 {
     SmartTagItem menuItem = new SmartTagItem(menuText);
     menuItem.Execute += handler;
     ea.Add(menuItem);
 }