code: private void initWorkplaceCmsContext(CmsWorkplaceSettings settings, CmsObject cms) {
  
          CmsRequestContext reqCont = cms.getRequestContext();
  
          // check project setting
          if (!settings.getProject().equals(reqCont.getCurrentProject().getUuid())) {
              try {
                  reqCont.setCurrentProject(cms.readProject(settings.getProject()));
              } catch (CmsDbEntryNotFoundException e) {
                  try {
                      // project not found, set current project and settings to online project
                      reqCont.setCurrentProject(cms.readProject(CmsProject.ONLINE_PROJECT_ID));
                      settings.setProject(CmsProject.ONLINE_PROJECT_ID);
                  } catch (CmsException ex) {
                      // log error
                      if (LOG.isInfoEnabled()) {
                          LOG.info(ex.getLocalizedMessage());
                      }
                  }
              } catch (CmsException e1) {
                  if (LOG.isInfoEnabled()) {
                      LOG.info(e1.getLocalizedMessage());
                  }
              }
          }
  
          // check site setting
          if (!(settings.getSite().equals(reqCont.getSiteRoot()))) {
              // site was switched, set new site root
              reqCont.setSiteRoot(settings.getSite());
              // removed setting explorer resource to "/" to get the stored folder
          }
      }
docs: Sets the cms request context and other cms related settings to the
  values stored in the workplace settings.<p>
  
  @param settings the workplace settings
  @param cms the current cms object