//------- Bookmark ----------------------------// void btnBookmarkAdd_Click(object sender, EventArgs e) { EA.ObjectType ot = _repository.GetContextItemType(); string guid; switch (ot) { case EA.ObjectType.otDiagram: EA.Diagram dia = (EA.Diagram)_repository.GetContextObject(); guid = dia.DiagramGUID; _historyList.Add(ot, guid); break; case EA.ObjectType.otPackage: EA.Package pkg = (EA.Package)_repository.GetContextObject(); guid = pkg.PackageGUID; _historyList.Add(ot, guid); break; case EA.ObjectType.otElement: EA.Element el = (EA.Element)_repository.GetContextObject(); guid = el.ElementGUID; _historyList.Add(ot, guid); break; } }
/// <summary> /// Temporary function solving error in Sparx EA /// Can be called just only if there is opened a project /// </summary> /// <param name="Repository">Repository</param> /// <returns>ObjectType of context item</returns> public static EA.ObjectType emergencyGetContextItemType(EA.Repository Repository) { EA.ObjectType vOT = Repository.GetContextItemType(); if (vOT == EA.ObjectType.otNone) { //try it to retype to Package and check if it is a model... //if anything gets wrong, forget it try { if (((EA.Package)(Repository.GetContextObject())).ParentID == 0) { return(EA.ObjectType.otModel); } //string vGUID = ((EA.Package)(Repository.GetContextObject())).PackageGUID; //foreach (EA.Package vPackage in Repository.Models) //{ // if (vPackage.PackageGUID == vGUID) // return EA.ObjectType.otModel; //} } catch { return(vOT); } } return(vOT); }
public void EA_MenuClick(EA.Repository Rep, string Location, string MenuName, string ItemName) { if (ItemName == "Show in Mindfusion") { EA.Diagram diag; switch (Rep.GetContextItemType()) { case EA.ObjectType.otPackage: { MessageBox.Show("Please select the entire diagram"); break; } case EA.ObjectType.otElement: { MessageBox.Show("Please select the entire diagram"); break; } case EA.ObjectType.otDiagram: { diag = Rep.GetContextObject(); diagramElementsList = new List <DiagramElements>(); foreach (EA.DiagramObject diagramObj in diag.DiagramObjects) { int diagramId = diagramObj.DiagramID; EA.Diagram diagram = Rep.GetDiagramByID(diagramId); int elementId = diagramObj.ElementID; EA.Element element = Rep.GetElementByID(elementId); DiagramElements diagramElement = new DiagramElements(); diagramElement.elementName = element.Name; diagramElement.elementType = element.MetaType; diagramElement.elementShape = element.ElementID.ToString(); diagramElementsList.Add(diagramElement); } break; } } StringWriter sw = new StringWriter(); XmlSerializer s = new XmlSerializer(diagramElementsList.GetType()); s.Serialize(sw, diagramElementsList); string xmlString = sw.ToString(); MindFusionViewer form = new MindFusionViewer(); form.setJsonContent(xmlString); form.Show(); } else if (ItemName == "About") { } }
public bool export(EA.Repository Repository) { EA.ObjectType type = Repository.GetContextItemType(); if (type == EA.ObjectType.otPackage) { EA.Package package = (EA.Package)Repository.GetContextObject(); return(exportPackage(Repository, package)); } else if (type == EA.ObjectType.otDiagram) { EA.Diagram diagram = (EA.Diagram)Repository.GetContextObject(); string defaultFileName = Path.Combine(CurrentOutputPath, string.Format(@"{0}.max", diagram.Name)); string fileName = showFileDialog(defaultFileName, false); if (fileName != String.Empty) { if (SelectedFilter == FILTER_MAX) { return(new MAXExporter3().exportDiagram(Repository, diagram, fileName)); } else if (SelectedFilter == FILTER_EXCEL_DATASET) { string xsltFile = Main.getAppDataFullPath(@"XML Transforms\max-to-excel-de.xslt"); string tmpFile = fileName + ".tmp"; if (!new MAXExporter3().exportDiagram(Repository, diagram, tmpFile)) { return(filter(Repository, tmpFile, xsltFile, fileName)); } else { return(true); } } else { return(false); } } else { return(false); } } else { MessageBox.Show("Select a Package or Diagram"); return(false); } }
//Called once Menu has been opened to see what menu items are active. public void EA_GetMenuState(EA.Repository Repository, string Location, string MenuName, string ItemName, ref bool IsEnabled, ref bool IsChecked) { if (IsProjectOpen(Repository)) { switch (ItemName) { case "Lock": case "Unlock": case "Import": case "Import NoDelRel": case "Merge Diagrams": IsEnabled = (Repository.GetTreeSelectedItemType() == EA.ObjectType.otPackage); break; case "Transform": case "Export": IsEnabled = (Repository.GetContextItemType() == EA.ObjectType.otPackage || Repository.GetContextItemType() == EA.ObjectType.otDiagram); break; case "Validate": IsEnabled = (Repository.GetTreeSelectedItemType() == EA.ObjectType.otPackage || Repository.GetTreeSelectedItemType() == EA.ObjectType.otDiagram); break; case "Batch": case "Quick Access Tab": case "Filters": case "About...": IsEnabled = true; break; default: IsEnabled = false; break; } } else { if (ItemName == "About...") { IsEnabled = true; } // If no open project, disable all other menu options else { IsEnabled = false; } } }
public static IList <EA.Element> diagramElements(EA.Repository Repository) { List <EA.Element> samples = new List <EA.Element>(); EA.Diagram diagram = null; if (Repository.GetContextItemType() == EA.ObjectType.otDiagram) { diagram = Repository.GetContextObject(); } foreach (EA.DiagramObject diagramObject in diagram.DiagramObjects) { EA.Element el = Repository.GetElementByID(diagramObject.ElementID); samples.Add(el); } return(samples); }
protected EA.ObjectType emergencyGetContextItemType(EA.Repository Repository) { EA.ObjectType vOT = Repository.GetContextItemType(); if (vOT == EA.ObjectType.otNone) { try { if (((EA.Package)(Repository.GetContextObject())).ParentID == 0) { return(EA.ObjectType.otModel); } } catch { return(vOT); } } return(vOT); }
public void EA_MenuClick(EA.Repository rep, string location, string menuName, string itemName) { if (itemName == "Save diagram as YAML") { EA.Diagram diag; // To get what a user selected from project browser, a package, a diagram or an element within a diagram switch (rep.GetContextItemType()) { case EA.ObjectType.otPackage: { MessageBox.Show("Please select a diagram"); break; } case EA.ObjectType.otDiagram: { diag = rep.GetContextObject(); if (diag.Type.Equals("Statechart")) // EA State Diagram type is Statechart { StateDiagram stateDiagram = new StateDiagram(); stateDiagram.CreateObjectForStateDiagram(rep, diag, stateDiagram); Utilities.SerializeAsYaml(stateDiagram); Utilities.SaveAsYaml(stateDiagram.refDiagramName); } break; } case EA.ObjectType.otElement: { MessageBox.Show("Please select a diagram"); break; } } } else if (itemName == "About") { MessageBox.Show("Yaml Generator - Version 1.0"); } }
private void CreateDiagram(EA.Repository Repository) { EA.Element selectedElement = null; switch (Repository.GetContextItemType()) { case EA.ObjectType.otPackage: selectedElement = ((EA.Package)Repository.GetContextObject()).Element; break; case EA.ObjectType.otElement: selectedElement = (EA.Element)Repository.GetContextObject(); break; default: return; } EA.Diagram diagram = CreateDiagramFromElement(selectedElement); Repository.RefreshModelView(Repository.GetTreeSelectedPackage().PackageID); Repository.ShowInProjectView(diagram); Repository.OpenDiagram(diagram.DiagramID); }
public void EA_MenuClick(EA.Repository rep, string location, string menuName, string itemName) { if (itemName == "Save diagram as YAML") { EA.Diagram diag; DiagramElements diagramElementsObj = new DiagramElements(); switch (rep.GetContextItemType()) { case EA.ObjectType.otPackage: { MessageBox.Show("Please select a diagram"); break; } case EA.ObjectType.otDiagram: { diag = rep.GetContextObject(); diagramElementsObj.refDiagramName = diag.Name; diagramElementsObj.refDiagramId = diag.DiagramGUID.Trim(charsToReplaceFromDiagramId); diagramElementsObj.states = new List <State>(); diagramElementsObj.transitions = new HashSet <Transition>(); foreach (EA.DiagramObject diagramObj in diag.DiagramObjects) { int diagramId = diagramObj.DiagramID; EA.Diagram diagram = rep.GetDiagramByID(diagramId); int elementId = diagramObj.ElementID; EA.Element element = rep.GetElementByID(elementId); State stateObj = new State(); if (element.MetaType == "Pseudostate") { diagramElementsObj.initialState = Utilities.FormatElementName(element.Name); } else if (element.MetaType == "FinalState") { diagramElementsObj.finalState = Utilities.FormatElementName(element.Name); } else { if (element.MetaType == "State") { stateObj.name = Utilities.FormatElementName(element.FQName); diagramElementsObj.states.Add(stateObj); } } if (element.Methods.Count > 0) { GetActionsByState(element, stateObj); } GetTransitionsByState(rep, diagramElementsObj, element); } SerializeAsYaml(diagramElementsObj); SaveAsYaml(diagramElementsObj); break; } case EA.ObjectType.otElement: { MessageBox.Show("Please select a diagram"); break; } } } else if (itemName == "About") { MessageBox.Show("Yaml Generator - Version 1.0"); } }
// display behavior or definition for selected element private static void DisplayForSelectedElement(EA.Repository repository, DisplayMode showBehavior) { EA.ObjectType oType = repository.GetContextItemType(); // Method found if (oType.Equals(EA.ObjectType.otMethod)) { // display behavior for method BehaviorForOperation(repository, (EA.Method)repository.GetContextObject()); } if (oType.Equals(EA.ObjectType.otDiagram)) { // find parent element EA.Diagram dia = (EA.Diagram)repository.GetContextObject(); if (dia.ParentID > 0) { // find parent element EA.Element parentEl = repository.GetElementByID(dia.ParentID); // ViewFromBehavior(repository, parentEl, showBehavior); } else { // open diagram repository.OpenDiagram(dia.DiagramID); } } // Connector / Message found if (oType.Equals(EA.ObjectType.otConnector)) { EA.Connector con = (EA.Connector)repository.GetContextObject(); if (con.Type.Equals("StateFlow")) { EA.Method m = Util.GetOperationFromConnector(repository, con); if (m != null) { if (showBehavior.Equals(DisplayMode.Behavior)) { BehaviorForOperation(repository, m); } else { repository.ShowInProjectView(m); } } } if (con.Type.Equals("Sequence")) { // If name is of the form: OperationName(..) the the operation is associated to an method string opName = con.Name; if (opName.EndsWith(")")) { // extract the name int pos = opName.IndexOf("("); opName = opName.Substring(0, pos); EA.Element el = repository.GetElementByID(con.SupplierID); // find operation by name foreach (EA.Method op in el.Methods) { if (op.Name == opName) { BehaviorForOperation(repository, op); } } if ((el.Type.Equals("Sequence") || el.Type.Equals("Object")) && el.ClassfierID > 0) { el = (EA.Element)repository.GetElementByID(el.ClassifierID); foreach (EA.Method op in el.Methods) { if (op.Name == opName) { if (showBehavior.Equals(DisplayMode.Behavior)) { BehaviorForOperation(repository, op); } else { repository.ShowInProjectView(op); } } } } } } } // Element if (oType.Equals(EA.ObjectType.otElement)) { EA.Element el = (EA.Element)repository.GetContextObject(); if (el.Type.Equals("Activity")) { // Open Behavior for Activity Util.OpenBehaviorForElement(repository, el); } if (el.Type.Equals("Action")) { foreach (EA.CustomProperty custproperty in el.CustomProperties) { if (custproperty.Name.Equals("kind") && custproperty.Value.Equals("CallOperation")) { ShowFromElement(repository, el, showBehavior); } if (custproperty.Name.Equals("kind") && custproperty.Value.Equals("CallBehavior")) { el = repository.GetElementByID(el.ClassfierID); Util.OpenBehaviorForElement(repository, el); } } } if (el.Type.Equals("Activity") || el.Type.Equals("StateMachine") || el.Type.Equals("Interaction")) { ViewFromBehavior(repository, el, showBehavior); } } }
/// <summary> /// Called when user makes a selection in the menu. /// This is your main exit point to the rest of your Add-in /// </summary> /// <param name="repository">the repository</param> /// <param name="location">the location of the menu</param> /// <param name="MenuName">the name of the menu</param> /// <param name="itemName">the name of the selected menu item</param> public override void EA_MenuClick(EA.Repository repository, string location, string MenuName, string itemName) { EA.Package pkg = null; EA.ObjectType oType = repository.GetContextItemType(); EA.Diagram diaCurrent = repository.GetCurrentDiagram(); EA.Connector conCurrent = null; EA.Element el = null; if (diaCurrent != null) { conCurrent = diaCurrent.SelectedConnector; } switch (itemName) { case MenuAbout: About fAbout = new About(); fAbout.setVersion(Release); // set release / version fAbout.ShowDialog(); break; case MenuMksGetNewest: if (oType.Equals(EA.ObjectType.otPackage)) { pkg = (EA.Package)repository.GetContextObject(); Mks mks = new Mks(repository, pkg); mks.GetNewest(); } break; case MenuMksGetHistory: // if controlled package if (oType.Equals(EA.ObjectType.otPackage)) { pkg = (EA.Package)repository.GetContextObject(); Mks mks = new Mks(repository, pkg); MessageBox.Show(mks.ViewHistory(), "mks"); } break; case MenuMksUndoCheckOut: // if controlled package if (oType.Equals(EA.ObjectType.otPackage)) { pkg = (EA.Package)repository.GetContextObject(); Mks mks = new Mks(repository, pkg); string msg = mks.UndoCheckout(); if (msg != "") { MessageBox.Show(mks.UndoCheckout(), "mks"); } } break; // Change name to synomym // - Package, recursive // - Class case MenuChangeClassNameToSynonym: // Class recursive if (oType.Equals(EA.ObjectType.otElement)) { el = (EA.Element)repository.GetContextObject(); Util.ChangeClassNameToSynonyms(repository, el); } // Package recursiv if (oType.Equals(EA.ObjectType.otPackage)) { pkg = (EA.Package)repository.GetContextObject(); Util.ChangePackageClassNameToSynonyms(repository, pkg); } break; // // If package is controlled: // - reset packageflags to "Recurse=0;VCCFG=unchanged"; case MenuResetVcMode: if (oType.Equals(EA.ObjectType.otPackage)) { pkg = (EA.Package)repository.GetContextObject(); Util.ResetVc(repository, pkg); } break; // For all nested packages: // If package is controlled: // - reset packageflags to "Recurse=0;VCCFG=unchanged"; case MenuResetVcModeRecursive: if (oType.Equals(EA.ObjectType.otPackage)) { pkg = (EA.Package)repository.GetContextObject(); Util.ResetVcRecursive(repository, pkg); } break; case MenuGetVcLatest: if (oType.Equals(EA.ObjectType.otPackage)) { // start preparation int count = 0; int errorCount = 0; DateTime startTime = DateTime.Now; repository.CreateOutputTab("Debug"); repository.EnsureOutputVisible("Debug"); repository.WriteOutput("Debug", "Start GetLatest", 0); pkg = (EA.Package)repository.GetContextObject(); Util.GetLatest(repository, pkg, false, ref count, 0, ref errorCount); string s = ""; if (errorCount > 0) { s = " with " + errorCount.ToString() + " errors"; } // finished TimeSpan span = DateTime.Now - startTime; repository.WriteOutput("Debug", "End GetLatest " + span.Minutes + " minutes. " + s, 0); } break; case MenuGetVcLatestRecursive: if (oType.Equals(EA.ObjectType.otPackage) || oType.Equals(EA.ObjectType.otNone)) { // start preparation int count = 0; int errorCount = 0; DateTime startTime = DateTime.Now; repository.CreateOutputTab("Debug"); repository.EnsureOutputVisible("Debug"); repository.WriteOutput("Debug", "Start GetLatestRecursive", 0); pkg = (EA.Package)repository.GetContextObject(); Util.GetLatest(repository, pkg, true, ref count, 0, ref errorCount); string s = ""; if (errorCount > 0) { s = " with " + errorCount.ToString() + " errors"; } // finished TimeSpan span = DateTime.Now - startTime; repository.WriteOutput("Debug", "End GetLatestRecursive in " + span.Hours + ":" + span.Minutes + " hh:mm. " + s, 0); } break; case MenuGetVcModeAll: //Repository.VersionControlResynchPkgStatuses(false); // over all packages foreach (EA.Package pkg1 in repository.Models) { Util.UpdateVc(repository, pkg1); } break; case MenuGetVcMode: if (oType.Equals(EA.ObjectType.otPackage)) { pkg = (EA.Package)repository.GetContextObject(); // Get the revision Regex pattern = new Regex(@"Revision:[^\$]+"); Match regMatch = pattern.Match(pkg.Notes); string revision = ""; if (regMatch.Success) { // get Revision revision = regMatch.Value; // add new string } // Get date pattern = new Regex(@"Date:[^\$]+"); regMatch = pattern.Match(pkg.Notes); string date = ""; if (regMatch.Success) { // get Revision date = regMatch.Value; // add new string } string msg = revision + " " + date + "\r\n" + "Path: " + Util.GetFilePath(repository, pkg) + "\r\n\r\n" + pkg.Flags + "\r\n" + Util.GetVCstate(pkg, true); MessageBox.Show(msg, "State"); } break; case MenuCopyGuidToClipboard: string str = ""; string str1 = ""; string str2 = ""; if (conCurrent != null) { // Connector EA.Connector con = conCurrent; str = con.ConnectorGUID + " " + con.Name + ' ' + con.Type + "\r\n" + "\r\n Connector: Select ea_guid As CLASSGUID, connector_type As CLASSTYPE,* from t_connector con where ea_guid = '" + con.ConnectorGUID + "'" + "\r\n\r\nSelect o.ea_guid As CLASSGUID, o.object_type As CLASSTYPE,o.name As Name, o.object_type AS ObjectType, o.PDATA1, o.Stereotype, " + "\r\n con.Name, con.connector_type, con.Stereotype, con.ea_guid As ConnectorGUID, dia.Name As DiagrammName, dia.ea_GUID As DiagramGUID," + "\r\n o.ea_guid, o.Classifier_GUID,o.Classifier " + "\r\nfrom (((t_connector con INNER JOIN t_object o on con.start_object_id = o.object_id) " + "\r\nINNER JOIN t_diagramlinks diaLink on con.connector_id = diaLink.connectorid ) " + "\r\nINNER JOIN t_diagram dia on diaLink.DiagramId = dia.Diagram_ID) " + "\r\nINNER JOIN t_diagramobjects diaObj on diaObj.diagram_ID = dia.Diagram_ID and o.object_id = diaObj.object_id " + "\r\nwhere con.ea_guid = '" + con.ConnectorGUID + "' " + "\r\nAND dialink.Hidden = 0 "; Clipboard.SetText(str); break; } if (oType.Equals(EA.ObjectType.otElement)) { // Element el = (EA.Element)repository.GetContextObject(); string pdata1 = el.get_MiscData(0); string pdata1String = ""; if (pdata1.EndsWith("}")) { pdata1String = "/" + pdata1; } else { pdata1 = ""; pdata1String = ""; } string classifier = Util.GetClassifierGuid(repository, el.ElementGUID); str = el.ElementGUID + ":" + classifier + pdata1String + " " + el.Name + ' ' + el.Type + "\r\n" + "\r\nSelect ea_guid As CLASSGUID, object_type As CLASSTYPE,* from t_object o where ea_guid = '" + el.ElementGUID + "'"; if (classifier != "") { if (el.Type.Equals("ActionPin")) { str = str + "\r\n Typ:\r\nSelect ea_guid As CLASSGUID, 'Parameter' As CLASSTYPE,* from t_operationparams op where ea_guid = '" + classifier + "'"; } else { str = str + "\r\n Typ:\r\nSelect ea_guid As CLASSGUID, object_type As CLASSTYPE,* from t_object o where ea_guid = '" + classifier + "'"; } } if (pdata1 != "") { str = str + "\r\n PDATA1: Select ea_guid As CLASSGUID, object_type As CLASSTYPE,* from t_object o where ea_guid = '" + pdata1 + "'"; } // Look for diagram object EA.Diagram curDia = repository.GetCurrentDiagram(); if (curDia != null) { foreach (EA.DiagramObject diaObj in curDia.DiagramObjects) { if (diaObj.ElementID == el.ElementID) { str = str + "\r\n\r\n" + "select * from t_diagramobjects where object_id = " + diaObj.ElementID.ToString(); break; } } } } if (oType.Equals(EA.ObjectType.otDiagram)) { // Element EA.Diagram dia = (EA.Diagram)repository.GetContextObject(); str = dia.DiagramGUID + " " + dia.Name + ' ' + dia.Type + "\r\n" + "\r\nSelect ea_guid As CLASSGUID, diagram_type As CLASSTYPE,* from t_diagram dia where ea_guid = '" + dia.DiagramGUID + "'"; } if (oType.Equals(EA.ObjectType.otPackage)) { // Element pkg = (EA.Package)repository.GetContextObject(); str = pkg.PackageGUID + " " + pkg.Name + ' ' + " Package " + "\r\n" + "\r\nSelect ea_guid As CLASSGUID, 'Package' As CLASSTYPE,* from t_package pkg where ea_guid = '" + pkg.PackageGUID + "'"; } if (oType.Equals(EA.ObjectType.otAttribute)) { // Element str1 = "LEFT JOIN t_object typAttr on (attr.Classifier = typAttr.object_id)"; if (repository.ConnectionString.Contains(".eap")) { str1 = "LEFT JOIN t_object typAttr on (attr.Classifier = Format(typAttr.object_id))"; } EA.Attribute attr = (EA.Attribute)repository.GetContextObject(); str = attr.AttributeID + " " + attr.Name + ' ' + " Attribute " + "\r\n" + "\r\n " + "\r\nSelect ea_guid As CLASSGUID, 'Attribute' As CLASSTYPE,* from t_attribute attr where ea_guid = '" + attr.AttributeGUID + "'" + "\r\n Class has Attributes:" + "\r\nSelect attr.ea_guid As CLASSGUID, 'Attribute' As CLASSTYPE, " + "\r\n o.Name As Class, o.object_type, " + "\r\n attr.Name As AttrName, attr.Type As Type, " + "\r\n typAttr.Name " + "\r\n from (t_object o INNER JOIN t_attribute attr on (o.object_id = attr.object_id)) " + "\r\n " + str1 + "\r\n where attr.ea_guid = '" + attr.AttributeGUID + "'"; } if (oType.Equals(EA.ObjectType.otMethod)) { // Element str1 = "LEFT JOIN t_object parTyp on (par.classifier = parTyp.object_id))"; str2 = "LEFT JOIN t_object opTyp on (op.classifier = opTyp.object_id)"; if (repository.ConnectionString.Contains(".eap")) { str1 = " LEFT JOIN t_object parTyp on (par.classifier = Format(parTyp.object_id))) "; str2 = " LEFT JOIN t_object opTyp on (op.classifier = Format(opTyp.object_id))"; } EA.Method op = (EA.Method)repository.GetContextObject(); str = op.MethodGUID + " " + op.Name + ' ' + " Operation " + "\r\nOperation may have type " + "\r\nSelect op.ea_guid As CLASSGUID, 'Operation' As CLASSTYPE,opTyp As OperationType, op.Name As OperationName, typ.Name As TypName,*" + "\r\n from t_operation op LEFT JOIN t_object typ on (op.classifier = typ.object_id)" + "\r\n where op.ea_guid = '" + op.MethodGUID + "';" + "\r\n\r\nClass has Operation " + "\r\nSelect op.ea_guid As CLASSGUID, 'Operation' As CLASSTYPE,* " + "\r\n from t_operation op INNER JOIN t_object o on (o.object_id = op.object_id)" + "\r\n where op.ea_guid = '" + op.MethodGUID + "';" + "\r\n\r\nClass has Operation has Parameters/Typ and may have operationtype" + "\r\nSelect op.ea_guid As CLASSGUID, 'Operation' As CLASSTYPE,op.Name As ClassName, op.Name As OperationName, opTyp.Name As OperationTyp, par.Name As ParName,parTyp.name As ParTypeName " + "\r\n from ((t_operation op INNER JOIN t_operationparams par on (op.OperationID = par.OperationID) )" + "\r\n " + str1 + "\r\n " + str2 + "\r\n where op.ea_guid = '" + op.MethodGUID + "' " + "\r\n Order by par.Pos "; } Clipboard.SetText(str); break; // delete undefined referencee case MenuDeleteExternalReference: if (diaCurrent != null) { foreach (EA.DiagramObject diaObj in diaCurrent.SelectedObjects) { EA.Element el1 = repository.GetElementByID(diaObj.ElementID); string s = String.Format("External Reference of diagram '{0}', name:'{1}' ID={2} GUID='{3}' deleted", diaCurrent.Name, el1.Name, el1.ElementID, el1.ElementGUID); repository.WriteOutput("System", s, 0); DeleteUndefinedReference(repository, el1); } } else { foreach (EA.Element el1 in repository.GetTreeSelectedElements()) { string s = String.Format("External Reference of tree, name:'{0}' ID={1} GUID='{2}' deleted", el1.Name, el1.ElementID, el1.ElementGUID); repository.WriteOutput("System", s, 0); DeleteUndefinedReference(repository, el1); } } break; // Recursive delete undefined referencee case MenuDeleteExternalReferenceRecursive: pkg = null; if (oType.Equals(EA.ObjectType.otNone)) { oType = repository.GetTreeSelectedItemType(); if (oType.Equals(EA.ObjectType.otPackage)) { pkg = (EA.Package)repository.GetTreeSelectedObject(); } if (oType.Equals(EA.ObjectType.otElement)) { el = (EA.Element)repository.GetTreeSelectedObject(); } } else { if (oType.Equals(EA.ObjectType.otPackage)) { pkg = (EA.Package)repository.GetContextObject(); } if (oType.Equals(EA.ObjectType.otElement)) { el = (EA.Element)repository.GetContextObject(); } } if (pkg != null) { RecursivePackages.doRecursivePkg(repository, pkg, null, // Packages SetDeleteUndefinedReference, // Elements null, // Diagrams null); } if (el != null) { RecursivePackages.doRecursiveEl(repository, el, SetDeleteUndefinedReference, // Elements null, // Diagrams null); } break; } }
public EA.ObjectType GetContextItemType() { return(eaRepository.GetContextItemType()); }