rem: function nsTreeController_delete(tree) {  var promptFlag = false;  if (!tree) return false; var select_list = tree.selectedItems; if (!select_list) return false; if (select_list.length < 1) return false;  var datasource = tree.database; 
add: function nsTreeController_delete() { var rangeCount = this.treeSelection.getRangeCount(); if (rangeCount < 1) return false;  var datasource = this.tree.database; var dsEnum = datasource.GetDataSources(); dsEnum.getNext(); var ds = dsEnum.getNext(); 
context: function nsTreeController_delete(tree){    // this should eventually be a parameter to this function    var promptFlag = false;            if (!tree) return false;    var select_list = tree.selectedItems;    if (!select_list) return false;    if (select_list.length < 1) return false;        var datasource = tree.database;    if (promptFlag == true)    {        var deleteStr = '';        if (select_list.length == 1) {            deleteStr = get_localized_string("DeleteItem");        } else {            deleteStr = get_localized_string("DeleteItems");        }        var ok = confirm(deleteStr);        if (!ok) return false;    }    var RDFC = Components.classes[rdfc_contractid].getService(nsIRDFContainer);    var dirty = false;    // note: backwards delete so that we handle odd deletion cases such as    //       deleting a child of a folder as well as the folder itself    for (var nodeIndex=select_list.length-1; nodeIndex>=0; nodeIndex--)    {        var node = select_list[nodeIndex];        if (!node) continue;        var ID = node.id;        if (!ID) continue;        // XXX - make tree templates flag special folders as read-only        // don't allow deletion of various "special" folders        if ((ID == "NC:BookmarksRoot") || (ID == "NC:IEFavoritesRoot"))        {            continue;        }        var parentID = node.parentNode.parentNode.getAttribute("ref");        if (!parentID)            parentID = node.parentNode.parentNode.id;        if (!parentID) continue;        var IDRes = RDF.GetResource(ID);        if (!IDRes) continue;        var parentIDRes = RDF.GetResource(parentID);        if (!parentIDRes) continue;        try {            // first try a container-based approach            RDFC.Init(datasource, parentIDRes);            RDFC.RemoveElement(IDRes, true);        } catch (ex) {            // nope! just remove the parent/child assertion then            datasource.Unassert(parentIDRes, containment, IDRes);        }        dirty = true;    }    if (dirty == true)    {        try {            var remote = datasource.QueryInterface(Components.interfaces.nsIRDFRemoteDataSource);            remote.Flush();        } catch (ex) {        }    }    return true;}
meta: 5872	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/5872/d38a0937d9c93a0a9d913e2ac781e4328bb8cc73/nsTreeController.js/clean/xpfe/global/resources/content/nsTreeController.js