code: private String getInitialTarget(CmsObject cms, CmsResource resource) {
  
          String sitePath = cms.getSitePath(resource);
          String parent = CmsResource.getParentFolder(sitePath);
          if (parent != null) {
              return parent;
          } else {
              String rootParent = CmsResource.getParentFolder(resource.getRootPath());
              if (rootParent != null) {
                  return rootParent;
              } else {
                  return sitePath;
              }
          }
      }
docs: Gets the initial target path to display, based on the selected resource.<p>
  
  @param cms the cms context
  @param resource the selected resource
  
  @return the initial target path