paste_node_inserting_before (PopUpMenu)

         # File lib/json/editor.rb, line 359
    359:       def paste_node_inserting_before(item)
    360:         if current = selection.selected
    361:           if @clipboard_data
    362:             parent = current.parent or return
    363:             parent_type = parent.type
    364:             if parent_type == 'Array'
    365:               selected_index = parent.each_with_index do |c, i|
    366:                 break i if c == current
    367:               end
    368:               Editor.data2model(@clipboard_data, model, parent) do |m|
    369:                 m.insert_before(parent, current)
    370:               end
    371:               expand_collapse(current)
    372:               toplevel.display_status("Inserted an element to " +
    373:                 "'#{parent_type}' before index #{selected_index}.")
    374:               window.change
    375:             else
    376:               toplevel.display_status(
    377:                 "Cannot insert node below '#{parent_type}'!")
    378:             end
    379:           else
    380:             toplevel.display_status("Nothing to paste in clipboard!")
    381:           end
    382:         else
    383:             toplevel.display_status("Append a node into the root first!")
    384:         end
    385:       end