private static MenuItem CreateTraceMenuItem(string uniqueName, IEAElement tracedElement) { var menuItem = new MenuItem(uniqueName); menuItem.Value = tracedElement; menuItem.ClickDelegate = delegate { IEADiagram[] diagrams = tracedElement.GetDiagrams(); if (diagrams.Count() == 1) { IEADiagram diagram = diagrams[0]; diagram.OpenAndSelectElement(tracedElement); } else if (diagrams.Count() >= 2) { var selectForm = new SelectDiagramDialog(diagrams); if (selectForm.ShowDialog() == DialogResult.OK) { IEADiagram diagram = selectForm.GetSelectedDiagram(); diagram.OpenAndSelectElement(tracedElement); } } tracedElement.ShowInProjectView(); }; return(menuItem); }
public override string[] GetSubItems() { Clear(); IEARepository repository = EAMain.Repository; if (repository.GetContextItemType() == EANativeType.Element) { var element = repository.GetContextObject <IEAElement>(); if (element != null) { var menuItemNames = new List <string>(); foreach (IEAElement tracedElement in element.GetTracedElements()) { string name = tracedElement.GetProjectPath() + "/" + tracedElement.Name; if (!"".Equals(tracedElement.Stereotype)) { name += " �" + tracedElement.Stereotype + "�"; } string uniqueName = GetUniqueName(name, menuItemNames); MenuItem menuItem = CreateTraceMenuItem(uniqueName, tracedElement); menuItemNames.Add(uniqueName); Add(menuItem); } menuItemNames.Sort(); return(menuItemNames.ToArray()); } } return(new string[0]); }