rem: var menuseparator = document.createElement('menuseparator'); menupopupNode.appendChild(menuseparator);  newMenuItem = document.createElement('menuitem'); newMenuItem.setAttribute('label', gMessengerBundle.getString("newTag")); newMenuItem.setAttribute('oncommand', "AddTag()"); menupopupNode.appendChild(newMenuItem); 
context: function InitMessageTags(menuType){  var tagService = Components.classes["@mozilla.org/messenger/tagservice;1"].getService(Components.interfaces.nsIMsgTagService);   var allTags = tagService.tagEnumerator;  var allKeys = tagService.keyEnumerator;  // remove any existing entries...  var menuItemId = menuType + "-tagpopup";  var menupopupNode = document.getElementById(menuItemId);  for (var i = menupopupNode.childNodes.length - 1; i >= 0; --i)      menupopupNode.removeChild(menupopupNode.childNodes[i]);  // now rebuild the list  var msgHdr = gDBView.hdrForFirstSelectedMessage;  var curKeys = msgHdr.getStringProperty("keywords");  var newMenuItem;   var curMsgHdrKeyArray = curKeys.split(" ");  if (msgHdr.label != 0)    curMsgHdrKeyArray.push("$label" + msgHdr.label);      while (allTags.hasMore())  {    var tag = allTags.getNext();    var key = allKeys.getNext();    // TODO we want to either remove or "check" the tags that already exist    newMenuItem = document.createElement('menuitem');    newMenuItem.setAttribute('label', tag);    newMenuItem.setAttribute('value',  key);    newMenuItem.setAttribute('type', 'checkbox');    var keySet = false;    for ( var index = 0; index < curMsgHdrKeyArray.length; index++ )    {      if (key == curMsgHdrKeyArray[index])      {        keySet = true;        break;      }    }    // if we already have this tag, we should change the command to "UnTag"    var command = ((keySet) ? "Un" : "") + "TagCurMessage(" + "'" + key + "');";    newMenuItem.setAttribute('oncommand', command);    newMenuItem.setAttribute('checked', keySet);    menupopupNode.appendChild(newMenuItem);  }  var menuseparator = document.createElement('menuseparator');  menupopupNode.appendChild(menuseparator);    newMenuItem = document.createElement('menuitem');  newMenuItem.setAttribute('label', gMessengerBundle.getString("newTag"));  newMenuItem.setAttribute('oncommand', "AddTag()");  menupopupNode.appendChild(newMenuItem);}
meta: 9421	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/9421/ba9f78a6899fd861fa777e1b817da40cee148b5a/mailWindowOverlay.js/buggy/mail/base/content/mailWindowOverlay.js