private void ensureInitialized() {
if (!initialized) {
String username = this.currentUser;
// If PersistenceProvider & WindowManager are available, we can create a dialog with available users
Platform platform = PlatformAccess.getPlatform();
PersistenceProvider persistence = platform != null ? platform.getPersistenceProvider() : null;
WindowManager windowing = platform != null ? platform.getWindowManager() : null;
if (username == null && persistence != null && windowing != null) {
Object[] users = persistence.getAllUsers().toArray();
if (users.length > 1) {
Arrays.sort(users);
username = (String) windowing.showInputDialog(bundle.getString("TITLE"), bundle.getString("QUESTION"), users, users[0], null); //NOI18N
} else if (users.length == 1) {
username = users[0].toString();
}
}
this.currentUser = username;
// If a user was selected, initialize with group info as well from Persistence
if (persistence != null && username != null) {
User user = persistence.getUser(username);
if (user != null) {
this.currentGroup = user.getDisciplineId();
}
}
}