code: private static void getPath(BaseComponent comp, StringBuilder sb) {
          while (comp instanceof BaseMenuComponent) {
              sb.insert(0, "\\" + ((BaseMenuComponent) comp).getLabel());
              comp = comp.getParent();
          }
      }
docs: Recurses parent menu nodes to build the menu path.
  
  @param comp Current component in menu tree.
  @param sb String builder to receive path.