boolean modelSelected = false;
List<String> entityNames = new LinkedList<String>();
Iterator selectionIter = selection.iterator();
while (!modelSelected && selectionIter.hasNext()) {
Object obj = selectionIter.next();
EOEntity entity = EOModelUtils.getRelatedEntity(obj);
if (entity != null) {
model = entity.getModel();
entityNames.add(entity.getName());
} else {
model = EOModelUtils.getRelatedModel(obj);
if (model != null) {
modelSelected = true;
}