localArray.addObject((ec != eo.editingContext() && ERXUtilities.localInstanceOfObject(ec, eo) != null ? ERXUtilities.localInstanceOfObject(ec, eo) : eo));
localArray.addObject((ec != eo.editingContext() && ERXEOControlUtilities.localInstanceOfObject(ec, eo) != null ? ERXEOControlUtilities.localInstanceOfObject(ec, eo) : eo));
    public NSArray theList() {        NSMutableArray aSortedArray;        NSArray anUnsortedArray;        if (_privateList()==null) {            EODataSource aDataSource = _localDataSource();            // Need to make sure that the eos are in the right editingContext.            anUnsortedArray = ERXUtilities.localInstancesOfObjects(((EOEnterpriseObject)sourceObject()).editingContext(), aDataSource.fetchObjects());            // 81398 sort contents            aSortedArray = new NSMutableArray(anUnsortedArray);            /* WO5            try {                _RelationshipSupport._sortEOsUsingSingleKey(aSortedArray, _localSortKey());            } catch (NSComparator.ComparisonException e) {                throw new NSForwardException(e);            }            */            if (_localSortKey() != null && _localSortKey().length() > 0)                ERXArrayUtilities.sortArrayWithKey(aSortedArray, _localSortKey());            // if there is a value on the EO, then we need to make sure that the list's EOs are in the same EC            // otherwise the popup selection will be wrong (will default to the first element)            // this happens for ex on a wizard page with a popup. Select sth in the popup, but leave a mandatory field blank            // click next --> the page comes back with the error, but the popup lost the selection you made            if (_localSourceObject() instanceof EOEnterpriseObject &&                ((EOEnterpriseObject)_localSourceObject()).valueForKeyPath(_localRelationshipKey()) != null) {                NSMutableArray localArray= new NSMutableArray();                EOEnterpriseObject eo;                EOEditingContext ec = ((EOEnterpriseObject)_localSourceObject()).editingContext();                for (Enumeration e = aSortedArray.objectEnumerator(); e.hasMoreElements();) {                    eo = (EOEnterpriseObject)e.nextElement();                    localArray.addObject((ec != eo.editingContext() && ERXUtilities.localInstanceOfObject(ec, eo) != null ?                                          ERXUtilities.localInstanceOfObject(ec, eo) : eo));                }                aSortedArray=localArray;            }            set_privateList(aSortedArray);        }        return _privateList();    }