rem: var treeNode = document.getElementById("bookmarksTree"); if (!treeNode)    return(false); var db = treeNode.database; if (!db)    return(false); 
add: var treeNode = document.getElementById("bookmarksTree"); if (!treeNode)    return(false); var db = treeNode.database; if (!db)    return(false); 
context: function doContextCmd(cmdName){	dump("doContextCmd start: cmd='" + cmdName + "'\n");	var treeNode = document.getElementById("bookmarksTree");	if (!treeNode)    return(false);	var db = treeNode.database;	if (!db)    return(false);	var compositeDB = db.QueryInterface(Components.interfaces.nsIRDFDataSource);	if (!compositeDB)    return(false);	var isupports = Components.classes["@mozilla.org/rdf/rdf-service;1"].getService();	if (!isupports)    return(false);	var rdf = isupports.QueryInterface(Components.interfaces.nsIRDFService);	if (!rdf)    return(false);	// need a resource for the command	var cmdResource = rdf.GetResource(cmdName);	if (!cmdResource)        return(false);	cmdResource = cmdResource.QueryInterface(Components.interfaces.nsIRDFResource);	if (!cmdResource)        return(false);	var select_list = treeNode.getElementsByAttribute("selected", "true");	if (select_list.length < 1)    return(false);	dump("# of Nodes selected: " + select_list.length + "\n\n");	// set up selection nsISupportsArray	var selectionInstance = Components.classes["@mozilla.org/supports-array;1"].createInstance();	var selectionArray = selectionInstance.QueryInterface(Components.interfaces.nsISupportsArray);	// set up arguments nsISupportsArray	var argumentsInstance = Components.classes["@mozilla.org/supports-array;1"].createInstance();	var argumentsArray = argumentsInstance.QueryInterface(Components.interfaces.nsISupportsArray);	// get argument (parent)	var parentArc = rdf.GetResource("http://home.netscape.com/NC-rdf#parent");	if (!parentArc)        return(false);	for (var nodeIndex=0; nodeIndex<select_list.length; nodeIndex++)	{		var node = select_list[nodeIndex];		if (!node)    break;		var	uri = node.getAttribute("ref");		if ((uri) || (uri == ""))		{			uri = node.getAttribute("id");		}		if (!uri)    return(false);		var rdfNode = rdf.GetResource(uri);		if (!rdfNode)    break;		// add node into selection array		selectionArray.AppendElement(rdfNode);		// get the parent's URI		var parentURI="";		var	theParent = node;		while (theParent)		{			theParent = theParent.parentNode;			parentURI = theParent.getAttribute("ref");			if ((!parentURI) || (parentURI == ""))			{				parentURI = theParent.getAttribute("id");			}			if (parentURI != "")	break;		}		if (parentURI == "")    return(false);		var parentNode = rdf.GetResource(parentURI, true);		if (!parentNode)	return(false);		// add parent arc and node into arguments array		argumentsArray.AppendElement(parentArc);		argumentsArray.AppendElement(parentNode);	}	// do the command	compositeDB.DoCommand( selectionArray, cmdResource, argumentsArray );	dump("doContextCmd ends.\n\n");	return(true);}
meta: 8395	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/8395/0b2dd2b2d2fd037df917e07645fa019a963332a5/sb-bookmarks.js/clean/editor/ui/composer/content/sb-bookmarks.js