code: private void loadAncestors(CmsResource resource) throws CmsException {
  
          CmsResource currentResource = resource;
          while ((currentResource != null) && m_cms.existsResource(currentResource.getStructureId(), m_filter)) {
              if (!m_knownResources.add(currentResource)) {
                  break;
              }
  
              if (CmsStringUtil.comparePaths(currentResource.getRootPath(), m_commonRoot)) {
                  break;
              }
              CmsResource parent = m_cms.readParentFolder(currentResource.getStructureId());
              if (parent != null) {
                  m_mustLoadChildren.add(parent);
  
              }
              currentResource = parent;
          }
      }
docs: Loads the ancestors of a resource.<p>
  
  @param resource the resource for which to load the ancestors
  
  @throws CmsException if something goes wrong