TSF.UmlToolingFramework.Wrappers.EA.Model.getUserSelectedElement C# (CSharp) Method

getUserSelectedElement() public method

Lets the user select an element from the model and return that
public getUserSelectedElement ( List allowedTypes ) : TSF.UmlToolingFramework.UML.Classes.Kernel.Element
allowedTypes List the subtypes of UML.Classes.Kernel.Element that should be used as a filter
return TSF.UmlToolingFramework.UML.Classes.Kernel.Element
        public UML.Classes.Kernel.Element getUserSelectedElement(List<string> allowedTypes)
        {
            //construct the include string
            string includeString = "IncludedTypes=";
            var eaTypeNames = new List<string>();
            foreach (var allowedType in allowedTypes)
            {
            eaTypeNames.Add(((Factory)this.factory).translateTypeName(allowedType));
            }
            includeString += string.Join(",",allowedTypes);
            //close section
            includeString += ";";
            //get the currently selected package
            var treeSelectedPackage = this.wrappedModel.GetTreeSelectedPackage();
            if (treeSelectedPackage != null)
            {
            includeString += "Selection=" + treeSelectedPackage.PackageGUID;
            //close section
            includeString += ";";
            }
            //currenlty only supported for ElementWrappers
            int EAElementID = this.wrappedModel.InvokeConstructPicker(includeString);
            return this.getElementWrapperByID(EAElementID);
        }

Usage Example

 //let the user select a table from the model
 public static EDDTable selectTable(TSF_EA.Model model, GlossaryManagerSettings settings)
 {
     var tableElement = model.getUserSelectedElement(new List<string> { "Class" }, new List<string> { "table" }) as TSF_EA.Class;
     if (tableElement == null) return null;
     var table = DB_EA.DatabaseFactory.createTable(tableElement);
     if (table == null) return null;
     return new EDDTable(table, settings);
 }