public bool EA_OnContextItemDoubleClicked(EAAPI.Repository repopsitory, string guid, EAAPI.ObjectType objectType) { bool result = false; if (objectType == EAAPI.ObjectType.otElement && _mainViewModel != null) { EAAPI.Element element = repopsitory.GetElementByGuid(guid); if (element.Type == "Requirement") { string identifier = element.GetTaggedValueString("Identifier"); if (!string.IsNullOrEmpty(identifier)) { _mainViewModel.OpenJiraViewCommand.Execute(identifier); result = true; } } } return(result); }
public Resource ConvertElementToResource(EAAPI.Element eaElement) { Resource result; result = new Resource(); if (eaElement != null) { result.ID = EaSpecIfGuidConverter.ConvertEaGuidToSpecIfGuid(eaElement.ElementGUID); result.Revision = "1"; result.ChangedAt = eaElement.Modified; result.ChangedBy = eaElement.Author; result.Class = new Key("RC-Requirement", "1"); result.Properties = new List <Property>(); string name = eaElement.Name; string classifierName = eaElement.GetClassifierName(_repository); if (!string.IsNullOrEmpty(classifierName)) { if (name == "") { name = classifierName; } else { name += " : " + classifierName; } } result.Title = new Value(name); Property nameProperty = new Property { Title = new Value("dcterms:title"), PropertyClass = new Key("AT-Req-Name", "1"), Value = new Value { LanguageValues = new List <LanguageValue> { new LanguageValue { Text = name } } }, ID = EaSpecIfGuidConverter.ConvertEaGuidToSpecIfGuid(eaElement.ElementGUID + "_NAME"), ChangedAt = eaElement.Modified, ChangedBy = eaElement.Author }; result.Properties.Add(nameProperty); Property notesProperty = new Property { Title = new Value("dcterms:description"), PropertyClass = new Key("PC-Text", "1"), Value = new Value { LanguageValues = new List <LanguageValue> { new LanguageValue { Text = eaElement.Notes } } }, ID = EaSpecIfGuidConverter.ConvertEaGuidToSpecIfGuid(eaElement.ElementGUID + "_NOTES"), ChangedAt = eaElement.Modified, ChangedBy = eaElement.Author }; result.Properties.Add(notesProperty); string stereotype = eaElement.Stereotype; if (eaElement.Type == "Requirement") { result.Class = new Key("RC-Requirement", "1"); string identifier = eaElement.GetTaggedValueString("Identifier"); if (!string.IsNullOrEmpty(identifier)) { Property identifierProperty = new Property { Title = new Value("dcterms:identifier"), PropertyClass = new Key("PC-VisibleId", "1"), Value = new Value { LanguageValues = new List <LanguageValue> { new LanguageValue { Text = identifier } } }, ID = EaSpecIfGuidConverter.ConvertEaGuidToSpecIfGuid(eaElement.ElementGUID + "_IDENTIFIER"), ChangedAt = eaElement.Modified, ChangedBy = eaElement.Author }; result.Properties.Add(identifierProperty); } string status = eaElement.Status; string statusID = ""; switch (status) { case "00_rejected": statusID = "V-Status-1"; break; case "10_initial": statusID = "V-Status-2"; break; case "20_drafted": statusID = "V-Status-3"; break; case "30_submitted": statusID = "V-Status-4"; break; case "40_approved": statusID = "V-Req-Status-3"; break; } if (!string.IsNullOrEmpty(statusID)) { Property statusProperty = new Property { Title = new Value("SpecIF:Status"), PropertyClass = new Key("PC-Status", "1"), Value = new Value { LanguageValues = new List <LanguageValue> { new LanguageValue { Text = statusID } } }, ID = EaSpecIfGuidConverter.ConvertEaGuidToSpecIfGuid(eaElement.ElementGUID + "_STATUS"), ChangedAt = eaElement.Modified, ChangedBy = eaElement.Author }; result.Properties.Add(statusProperty); } } else if (eaElement.Type == "Package") { result.Class = new Key("RC-Folder", "1"); } else if (eaElement.Type == "Object") { if (stereotype == "agent" || stereotype == "human agent") { result.Class = new Key("RC-Actor", "1"); } else if (stereotype == "storage") { result.Class = new Key("RC-State", "1"); } else if (stereotype == "heading") { result.Class = new Key("RC-Folder", "1"); } } else if (eaElement.Type == "Actor") { result.Class = new Key("RC-Actor", "1"); } else if (eaElement.Type == "Port") { if (stereotype == "channel") { //result.ResourceClass = "OT-Channel"; } } } return(result); }
public object EA_GetMenuItems(EAAPI.Repository repository, string location, string menuName) { object result = ""; List <string> menuEntries = new List <string>(); object selectedItem = null; EAAPI.ObjectType objectType = repository.GetTreeSelectedItem(out selectedItem); EAAPI.Element selectedElement = null; if (objectType == EAAPI.ObjectType.otElement) { selectedElement = selectedItem as EAAPI.Element; } else if (objectType == EAAPI.ObjectType.otPackage) { EAAPI.Package package = selectedItem as EAAPI.Package; selectedElement = package.Element; } switch (menuName) { // defines the top level menu option case "": result = MAIN_MENU; break; // defines the submenu options case MAIN_MENU: if (location == "TreeView") { //menuEntries.Add(EXPORT_MENU); //menuEntries.Add("-"); menuEntries.Add(SYNC_PROJECT_ROOTS_MENU); menuEntries.Add(SYNC_HIERARHY_ROOTS_MENU); menuEntries.Add(SYNC_HIERARHY_MENU); if (selectedElement != null && selectedElement.Type == "Requirement" && selectedElement.Stereotype == "fmcreq" && !string.IsNullOrEmpty(_configuration.JiraURL) && string.IsNullOrEmpty(selectedElement.GetTaggedValueString("specifId"))) { menuEntries.Add("-"); menuEntries.Add(ADD_REQIOREMENT_TO_SPECIF_REPOSITORY_MENU); } if (selectedElement != null && !string.IsNullOrEmpty(selectedElement.GetTaggedValueString("specifId"))) { menuEntries.Add("-"); menuEntries.Add(SYNC_SINGLE_ELEMENT_MENU); } if (objectType == EAAPI.ObjectType.otPackage && selectedElement != null && selectedElement.Stereotype == "specification") { menuEntries.Add("-"); menuEntries.Add(ADD_SPECIFICATION_TO_SPECIF_MENU); } } else if (location == "MainMenu") { menuEntries.Add(EDIT_SETTINGS_MENU); menuEntries.Add("-"); menuEntries.Add(ABOUT_MENU); } result = menuEntries.ToArray(); break; } return(result); }