List<String> workspaceIds = new ArrayList<String>(availableWorkspaces.size());
if (currentWorkspaceId != null) {
availableWorkspaces.remove(currentWorkspaceId);
workspaceIds.add(currentWorkspaceId);
}
Workspace defaultWorkspace = UIServices.lookup().getWorkspacesManager().getDefaultWorkspace();
if (defaultWorkspace != null) {
availableWorkspaces.remove(defaultWorkspace.getId());
workspaceIds.add(defaultWorkspace.getId());
}
workspaceIds.addAll(availableWorkspaces);
return workspaceIds;
}