This class creates the File pulldown menu.
Create the menu.
# File lib/json/editor.rb, line 527
527: def create
528: title = MenuItem.new('File')
529: title.submenu = menu
530: add_item('New', &method(:new))
531: add_item('Open', oo, &method(:open))
532: add_item('Open location', ll, &method(:open_location))
533: add_item('Revert', &method(:revert))
534: add_separator
535: add_item('Save', ss, &method(:save))
536: add_item('Save As', SS, &method(:save_as))
537: add_separator
538: add_item('Quit', qq, &method(:quit))
539: title
540: end
Clear the model and filename, but ask to save the JSON document, if unsaved changes have occured.
# File lib/json/editor.rb, line 490
490: def new(item)
491: window.clear
492: end
Open a file and load it into the editor. Ask to save the JSON document first, if unsaved changes have occured.
# File lib/json/editor.rb, line 496
496: def open(item)
497: window.file_open
498: end
# File lib/json/editor.rb, line 500
500: def open_location(item)
501: window.location_open
502: end
Quit the editor, after asking to save any unsaved changes first.
# File lib/json/editor.rb, line 522
522: def quit(item)
523: window.quit
524: end
Revert the current JSON document in the editor to the saved version.
# File lib/json/editor.rb, line 505
505: def revert(item)
506: window.instance_eval do
507: @filename and file_open(@filename)
508: end
509: end
Save the current JSON document.
# File lib/json/editor.rb, line 512
512: def save(item)
513: window.file_save
514: end
Save the current JSON document under the given filename.
# File lib/json/editor.rb, line 517
517: def save_as(item)
518: window.file_save_as
519: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.