PKqA6w rename/package.kpf import bike\nfrom xpcom import components\n\nBUTTON_POS_0 = 1\nBUTTON_POS_1 = 1 << 8\nBUTTON_POS_2 = 1 << 16\nBUTTON_TITLE_OK = 1\nBUTTON_TITLE_CANCEL = 2\nBUTTON_TITLE_YES = 3\nBUTTON_TITLE_NO = 4\nBUTTON_TITLE_SAVE = 5\nBUTTON_TITLE_DONT_SAVE = 6\nBUTTON_TITLE_REVERT = 7\nBUTTON_TITLE_IS_STRING = 127\nBUTTON_POS_0_DEFAULT = 0 << 24\nBUTTON_POS_1_DEFAULT = 1 << 24\nBUTTON_POS_2_DEFAULT = 2 << 24\n\nwwatch = components.classes["@mozilla.org/embedcomp/window-watcher;1"].getService(components.interfaces.nsIWindowWatcher)\nprompt = wwatch.getNewPrompter(wwatch.activeWindow)\nbrmctx = bike.init()\nword = komodo.getWordUnderCursor()\nif not komodo.editor.selText or word == "":\n prompt.alert("Name not highlighted", "Double click the name of the declaration you want to rename (to highlight it) and try again.")\n return\nif komodo.document.isDirty:\n flags = ((BUTTON_TITLE_SAVE * BUTTON_POS_0) + \n (BUTTON_TITLE_CANCEL * BUTTON_POS_1) +\n BUTTON_POS_0_DEFAULT)\n result, _ = prompt.confirmEx("File not saved", "The current file is not saved. Would you like to save it now?", flags, None, None, None, None, False)\n if result == 0:\n komodo.doCommand("cmd_save")\n elif result == 1:\n return\nselstart = min(komodo.editor.currentPos, komodo.editor.anchor)\ncolumn = komodo.editor.getColumn(selstart)\nline = komodo.editor.lineFromPosition(selstart)\nfilename = komodo.document.displayPath\nresult = prompt.prompt("Bicycle Repair Man", "Rename to what?", "", None, False)\nok = result[0]\nif not ok:\n return\nnewname = result[1]\nbrmctx.rename(filename, int(line)+1, int(column), newname)\nbrmctx.save()\nkomodo.editor.setSel(komodo.editor.currentPos, komodo.editor.currentPos) 1 PKqA6w rename/package.kpfPK@