public static void CreateAndTraceDecision() { 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.NameSuggestionDecision, eaelement.Name); var createDecisionView = new CreateDecisionDialog(nameSuggestion); if (createDecisionView.ShowDialog() == DialogResult.OK) { IEAPackage dvPackage = createDecisionView.GetDecisionViewPackage(); IEAElement decision = dvPackage.CreateElement(createDecisionView.GetName(), createDecisionView.GetState(), EAConstants.ActionMetaType); decision.MetaType = EAConstants.DecisionMetaType; decision.AddTaggedValue(EATaggedValueKeys.DecisionStateModifiedDate, DateTime.Now.ToString(CultureInfo.InvariantCulture)); eaelement.ConnectTo(decision, EAConstants.AbstractionMetaType, EAConstants.RelationTrace); decision.Update(); dvPackage.RefreshElements(); repository.RefreshModelView(dvPackage.ID); decision.ShowInProjectView(); } } } }
private void newDecisionToolStripMenuItem_Click(object sender, EventArgs e) { var element = Topic.Element; var dialog = new CreateDecisionDialog(string.Format(Messages.NameSuggestionDecision, element.Name)); if (dialog.ShowDialog() == DialogResult.OK) { Topic.Decisions.Add(Decision.Create(dialog.GetName(), dialog.GetState(), Topic)); } }