public static void openUserGroupSelect(final String mode, final String id, final String pattern) {
int viewMode = UserGroupSelect.VIEW_TABS;
if ("users".equals(mode)) viewMode = UserGroupSelect.VIEW_USERS;
if ("groups".equals(mode)) viewMode = UserGroupSelect.VIEW_GROUPS;
new UserGroupSelect(new UserGroupAdder() {
public void addUsers(List<GWTJahiaUser> users) {
for (GWTJahiaUser user : users) {
UserManagerService.App.getInstance().getFormattedPrincipal(user.getUserKey(), 'u', pattern.split("\\|"), new BaseAsyncCallback<String[]>() {
public void onSuccess(String[] strings) {
add(strings[0], strings[1]);