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]); }
public static void CreateAndTraceTopic() { IEARepository repository = EAMain.Repository; if (repository.GetContextItemType() == EANativeType.Element) { var eaelement = repository.GetContextObject <IEAElement>(); if (eaelement != null && !EAMain.IsDecision(eaelement) && !EAMain.IsTopic(eaelement)) { string nameSuggestion = string.Format(Messages.NameSuggestionTopic, eaelement.Name); var createTopicView = new CreateTopicDialog(nameSuggestion); if (createTopicView.ShowDialog() == DialogResult.OK) { IEAPackage dvPackage = createTopicView.GetDecisionViewPackage(); IEAElement topic = dvPackage.CreateElement(createTopicView.GetName(), EAConstants.TopicStereoType, EAConstants.ActivityMetaType); topic.MetaType = EAConstants.TopicMetaType; topic.AddTaggedValue(EATaggedValueKeys.DecisionStateModifiedDate, DateTime.Now.ToString(CultureInfo.InvariantCulture)); eaelement.ConnectTo(topic, EAConstants.AbstractionMetaType, EAConstants.RelationTrace); topic.Update(); dvPackage.RefreshElements(); repository.RefreshModelView(dvPackage.ID); topic.ShowInProjectView(); } } } }
private void OnNoTracesDefined(IMenu self) { IEARepository repository = EAMain.Repository; if (repository.GetContextItemType() == EANativeType.Element) { var element = repository.GetContextObject <IEAElement>(); if (element != null) { if (!element.GetTracedElements().Any()) { Name = Messages.MenuFollowTraceNoTraces; IsEnabled = false; return; } Name = Messages.MenuFollowTraceDefault; IsEnabled = true; } } }