Parent

Included Modules

Class Index [+]

Quicksearch

JSON::Editor::FileMenu

This class creates the File pulldown menu.

Public Instance Methods

create() click to toggle source

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
new(item) click to toggle source

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(item) click to toggle source

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
open_location(item) click to toggle source
     # File lib/json/editor.rb, line 500
500:       def open_location(item)
501:         window.location_open
502:       end
quit(item) click to toggle source

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(item) click to toggle source

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(item) click to toggle source

Save the current JSON document.

     # File lib/json/editor.rb, line 512
512:       def save(item)
513:         window.file_save
514:       end
save_as(item) click to toggle source

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.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.