}
List<User> users = finalUsers[0];
if (users == null) return;
for (Iterator<User> it = users.iterator(); it.hasNext();) {
User user = it.next();
if ( user.isSelf() || myUserModel.hasUser(user)) {
it.remove();
}
}
if (users.size() < 1) {
showNoUsersFoundMessage();
return;
}
UsersInfo usersInfo = myIdeFacade.chooseUsersToBeAdded(users, myUserModel.getGroups());
User[] toBeAdded = usersInfo.getUsers();
for (User user : toBeAdded) {
String group = usersInfo.getGroup();
if (UserModel.AUTO_GROUP.equals(group)) {
String[] userProjects = user.getProjects();
group = userProjects.length > 0 ? userProjects[0] : UserModel.DEFAULT_GROUP;
}
user.setGroup(group, myUserModel);
myUserModel.addUser(user);
}
}