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(); } } } }