DB Explorer - read,write values from file

What would it take to add a context menu option to DB Explorer that replaces the value in a database field with the contents of a file? Ideally the file would be the file with focus in the IDE but it could be selected from a file dialog if the directory was persistent. This is preferred over “select all”, “copy”, “select all”, “paste”.

Thanks,

Rod Holland

You should be able to do something like this (untested):

    var menupopup = document.getElementById("dbexplorer_popup");
    var view = ko.dbexplorer.viewManager.view;
    var row = view.selection.currentIndex;
    var nodeType = view.getNodeType(row);

   if (nodeType == "index")
   {
        var name = view.getNodeName(row);
        var menuitem = document.createElementNS(XUL_NS, 'menuitem');
        menuitem.setAttribute("id", "dbexplorer_my_menuitem_" + name);
        menuitem.setAttribute('label',
                              "Replace Contents");
        menuitem.setAttribute("oncommand", "myFunction");
        menupopup.appendChild(menuitem);
   }

As for the actual logic of your function; you’ll have to have a look around <ko-install-dir>/lib/mozilla/extensions/dbexplorer@ActiveState.com