home *** CD-ROM | disk | FTP | other *** search
- on mCreateNodeTree me, aDescriptorStr
- me._Debug("Parsing node tree description string")
- nodeTree = [:]
- iconList = [:]
- if aDescriptorStr.ilk <> #string then
- return nodeTree
- end if
- mx = aDescriptorStr.line.count
- the itemDelimiter = TAB
- currentParent = []
- parentNode = nodeTree
- repeat with i = 1 to mx
- chnk = aDescriptorStr.line[i]
- if chnk = EMPTY then
- next repeat
- end if
- the itemDelimiter = ":"
- iconRef = chnk.item[2]
- chnk = chnk.item[1]
- the itemDelimiter = TAB
- numItems = chnk.item.count
- repeat with j = 1 to numItems
- n = chnk.item[j]
- if n <> EMPTY then
- iconList.addProp(n, iconRef)
- if j > (currentParent.count + 1) then
- alert("Error parsing descriptor - cannot locate parent node for " & n)
- exit repeat
- else
- currentParent[j] = n
- end if
- if j = 1 then
- nodeTree.addProp(n, [#children: [:], #Icon: iconRef])
- else
- currentParentNode = nodeTree
- parentNum = j - 1
- repeat with k = 1 to parentNum
- if k > currentParent.count then
- alert("Error parsing descriptor - cannot locate parent node for " & n)
- exit repeat
- next repeat
- end if
- currentParentNode = currentParentNode.getaProp(currentParent[k]).children
- end repeat
- currentParentNode.addProp(n, [#children: [:], #Icon: iconRef])
- end if
- exit repeat
- end if
- end repeat
- end repeat
- return nodeTree
- end
-
- on mCreateDescriptor me, aNodeTree
- return me._WriteNodeTree(aNodeTree, EMPTY, EMPTY)
- end
-
- on _WriteNodeTree me, aParentNode, aStr, indent
- repeat with i = 1 to aParentNode.count
- id = aParentNode.getPropAt(i)
- thisNode = aParentNode[i]
- aStr = aStr & indent & id & RETURN
- aStr = me._WriteNodeTree(thisNode, aStr, indent & TAB)
- end repeat
- return aStr
- end
-
- on _Debug me, Msg
- global gDebugMode
- if ((the environment).runMode = "Author") or gDebugMode then
- if member("Debugger").type = #script then
- script("Debugger").mLog(me.script, Msg)
- else
- put me.script && "---> " && Msg
- end if
- end if
- end
-