Source

lqpl / GUI / src / lqpl / lqpl_menu.rb

%w{JMenuBar JMenu JMenuItem}.each do |nm|
  java_import  "javax.swing."+nm
end

class LqplMenu
  attr_accessor :view_classical_stack
  attr_accessor :view_dump
  attr_accessor :view_executing_code
  attr_accessor :view_stack_translation

  attr_accessor :file_compile
  attr_accessor :file_load
  attr_accessor :file_simulate

  #next are for win/linux only. Mac is handled in lqpl_controller
  attr_accessor :file_exit
  attr_accessor :help_about

  def initialize(parent)
    mbar = JMenuBar.new

    menu_file = JMenu.new("File")
    @file_load = JMenuItem.new("Load");
    @file_compile =  JMenuItem.new("Compile");
    @file_simulate =  JMenuItem.new("Simulate");

    menu_file.add(@file_load);
    menu_file.add(@file_compile);
    menu_file.add(@file_simulate);

    not_on_mac do
      @file_exit = JMenuItem.new("Exit")
      menu_file.add(@file_exit)
    end

    menu_view =  JMenu.new("View");
    @view_classical_stack =  JMenuItem.new("Hide Classical Stack");
    @view_dump =  JMenuItem.new("Hide Dump");
    @view_executing_code =  JMenuItem.new("Hide Executing Code");
    @view_stack_translation =  JMenuItem.new("Hide Stack Translation");

    @view_classical_stack.enabled = false;
    @view_dump.enabled = false;
    @view_executing_code.enabled = false;
    @view_stack_translation.enabled = false;

    menu_view.add(@view_classical_stack);
    menu_view.add(@view_dump);
    menu_view.add(@view_executing_code);
    menu_view.add(@view_stack_translation);

    mbar.add(menu_file);
    mbar.add(menu_view);


    not_on_mac do
      menu_help = JMenu.new("Help")
      @help_about = JMenuItem.new("About")
      menu_help.add(@help_about)
      mbar.add(menu_help)
    end

    parent.set_menu_bar(mbar);
    mbar.visible = true;
  end


end
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.