code: public static String prepareFileNameForEditor(CmsObject cms, CmsResource res, String pathWithMacros) {
  
          String subsite = OpenCms.getADEManager().getSubSiteRoot(cms, res.getRootPath());
          CmsMacroResolver resolver = new CmsMacroResolver();
          if (subsite != null) {
              resolver.addMacro("subsite", cms.getRequestContext().removeSiteRoot(subsite));
          }
          resolver.addMacro("file", cms.getSitePath(res));
          String path = resolver.resolveMacros(pathWithMacros).replaceAll("/+", "/");
          return path;
      }
docs: Processes a file path, which may have macros in it, so it can be opened by the XML content editor.<p>
  
  @param cms the current CMS context
  @param res the resource for which the context menu option has been selected
  @param pathWithMacros the file path which may contain macros
  
  @return the processed file path