private void addPossibleNamesToComboBox() { List <ObjectVariable> listOfOvs = new List <ObjectVariable>(); List <EParameter> listOfParameters = new List <EParameter>(); if (objectVariable is TGGObjectVariable) { TGGRule tggRule = objectVariable.StoryPattern as TGGRule; listOfOvs = SDMUtil.getTGGObjectVariablesInTggRule(tggRule, repository); } else if (objectVariable is ObjectVariable) { Activity activity = objectVariable.StoryPattern.ParentStoryNode.OwningActivity; listOfOvs = SDMUtil.getSDMObjectVariablesInActivity(activity, repository); try { foreach (EParameter eParameter in objectVariable.StoryPattern.ParentStoryNode.OwningActivity.OwningOperation.EParameters) { listOfParameters.Add(eParameter); } } catch { } } ObjectVariable ovToDelete = null; foreach (ObjectVariable ov in listOfOvs) { if (ov.Name == this.objectVariable.ObjectVariableEA.Name) { ovToDelete = ov; } } listOfOvs.Remove(ovToDelete); InternalList.AddRange(listOfOvs); InternalList.AddRange(listOfParameters); foreach (Object possibleObject in InternalList) { if (possibleObject is ObjectVariable) { this.Items.Add((possibleObject as ObjectVariable).Name); } else if (possibleObject is EParameter) { this.Items.Add((possibleObject as EParameter).Name); } } }
private void addPossibleNamesToComboBox() { List <ObjectVariable> listOfOvs = new List <ObjectVariable>(); List <MocaSerializableElement> existingNames = new List <MocaSerializableElement>(); if (objectVariable is TGGObjectVariable) { TGGRule tggRule = objectVariable.StoryPattern as TGGRule; listOfOvs = SDMUtil.getTGGObjectVariablesInTggRule(tggRule, repository); } else if (objectVariable is ObjectVariable) { Activity activity = objectVariable.StoryPattern.ParentStoryNode.OwningActivity; listOfOvs = SDMUtil.getSDMObjectVariablesInActivity(activity, repository); try { foreach (EParameter eParameter in objectVariable.StoryPattern.ParentStoryNode.OwningActivity.OwningOperation.EParameters) { if (eParameter.EaParameter.ClassifierID != "0" && eParameter.EaParameter.ClassifierID != "") { existingNames.Add(eParameter); } } } catch { } } foreach (ObjectVariable ov in listOfOvs) { existingNames.Add(ov); } existingNames.Sort(new SDMExportWrapperComparator()); foreach (Object possibleObject in existingNames) { if (possibleObject is MocaSerializableElement) { MocaSerializableElement entry = possibleObject as MocaSerializableElement; if (!this.Items.Contains(entry.Name)) { this.Items.Add((possibleObject as MocaSerializableElement).Name); InternalList.Add(possibleObject); } } } /* * * ObjectVariable ovToDelete = null; * foreach (ObjectVariable ov in listOfOvs) * { * if (ov.Name == this.objectVariable.ObjectVariableEA.Name) * ovToDelete = ov; * } * listOfOvs.Remove(ovToDelete); * InternalList.AddRange(listOfOvs); * InternalList.AddRange(listOfParameters); * * foreach (Object possibleObject in InternalList) * { * if (possibleObject is ObjectVariable) * { * this.Items.Add((possibleObject as ObjectVariable).Name); * } * else if (possibleObject is EParameter) * { * this.Items.Add((possibleObject as EParameter).Name); * } * } */ }