private UDOCategory findParent(UDOCategory cat, Object obj) { if (ListUtil.containsByRef(cat.getUserDefinedOpcodes(), obj) || ListUtil.containsByRef(cat.getSubCategories(), obj)) { return cat; } for (Iterator iter = cat.getSubCategories().iterator(); iter.hasNext(); ) { UDOCategory c = (UDOCategory) iter.next(); UDOCategory temp = findParent(c, obj); if (temp != null) { return temp; } } return null; }
private Object getPathForObject(UDOCategory current, Object obj, Vector v) { if (current == obj) { return v; } if (ListUtil.containsByRef(current.getUserDefinedOpcodes(), obj)) { v.add(current); return v; } for (Iterator iter = current.getSubCategories().iterator(); iter.hasNext(); ) { UDOCategory cat = (UDOCategory) iter.next(); Object pathObj = getPathForObject(cat, obj, v); if (pathObj != null) { v.add(current); return v; } } return null; }