/// <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); }
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)); } }
private void PasteSmartTag_GetSmartTagItems(object sender, GetSmartTagItemsEventArgs ea) { SmartTagItem item2 = new SmartTagItemEx("Smart Paste", new MethodInvoker(SmartPaste)); SmartTagItem item = new SmartTagItemEx("CSharp -> VBNet", new MethodInvoker(PasteCSharpAsVBNet)); SmartTagItem item3 = new SmartTagItemEx("VBNet -> CSharp", new MethodInvoker(PasteVBNetAsCSharp)); ea.Add(item2); ea.Add(item); ea.Add(item3); }
/// <summary> /// Provide the list of unit test menu options /// </summary> /// <param name="sender"></param> /// <param name="ea"></param> private void testActions_GetSmartTagItems(object sender, GetSmartTagItemsEventArgs ea) { AddSmartTagItem(ea, kRunTestMenuItem, PlugIn1_RunTest); AddSmartTagItem(ea, kRunClassMenuItem, PlugIn1_RunTest); AddSmartTagItem(ea, kRunAssemblyMenuItem, PlugIn1_RunTest); if (_Failures.Count > 0) { AddSmartTagItem(ea, kNextFailedTestMenuItem, MoveToNextFailure); } }
private void ApprovalTestsProvider_GetSmartTagItems(object sender, GetSmartTagItemsEventArgs ea) { ConstructMenu(ea); }
void stImportNamespace_GetSmartTagItems(object sender, GetSmartTagItemsEventArgs ea) { ea.AddRange(_ImportNamespaceItems.ToArray()); _ImportNamespaceItems = null; }