code: private String repairPath(CmsWorkplace wp, String path) {
  
          String rootKey = getCurrentRoot(wp).getKey();
          // navigate until to reach a valid path
          while (!validatePath(rootKey, path, true)) {
              // log failure
              LOG.warn(Messages.get().getBundle().key(Messages.LOG_MISSING_ADMIN_TOOL_1, path));
              // try parent
              path = getParent(wp, path);
          }
          // navigate until to reach a valid tool
          while ((resolveAdminTool(rootKey, path) == null) && !"/".equals(path)) {
              // log failure
              LOG.warn(Messages.get().getBundle().key(Messages.LOG_MISSING_ADMIN_TOOL_1, path));
              // try parent
              path = getParent(wp, path);
          }
  
          // navigate until to reach an enabled path
          CmsTool aTool = resolveAdminTool(rootKey, path);
          while ((aTool != null) && !aTool.getHandler().isEnabled(wp)) {
              if (aTool.getHandler().getLink().equals(VIEW_JSPPAGE_LOCATION)) {
                  // just grouping
                  break;
              }
              path = getParent(wp, path);
              aTool = resolveAdminTool(rootKey, path);
          }
  
          return path;
      }
docs: Given a string a valid and visible tool path is computed.<p>
  
  @param wp the workplace object
  @param path the path to repair
  
  @return a valid and visible tool path