List<String> selectedWorkspaceIds = menuDriver.getSelectedWorkspaceIds(getPanel());
boolean isEditMode = getPanel().getPanelSession().isEditMode();
if (workspacesIdentifiers != null && workspacesIdentifiers.size() > 0) {
for (String id : workspacesIdentifiers) {
WorkspaceImpl workspace;
try {
workspace = (WorkspaceImpl) UIServices.lookup().getWorkspacesManager().getWorkspace(id);
} catch (Exception e) {
throw new FormatterException("No workspace found: ", e);
}
MenuItem menuItem = new WorkspaceMenuItem();
menuItem.setId(workspace.getId());
menuItem.setText(workspace.getName());
menuItem.setUrl(menuDriver.getChangeWorkspaceLink(request, response, workspace.getId()));
menuItem.setSelected(selectedWorkspaceIds.contains(workspace.getId()));
menuItem.setVisible(Boolean.TRUE);
if (workspace.getId().equals(getWorkspace().getId())) {
menuItem.setCurrent(Boolean.TRUE);
} else {
menuItem.setCurrent(Boolean.FALSE);
}
renderItem(menuItem, selectedWorkspaceIds.contains(MenuDriver.PARAMETER_ALL_ITEMS), isEditMode);