Sha256: 76d69d61a20022f5f473dac6fc5b2740d465d302d753e8a7025785260d363ccc

Contents?: true

Size: 1.24 KB

Versions: 5

Compression:

Stored size: 1.24 KB

Contents

class BurpExtender
  # @api private
  class ConsolePane < Java::JavaxSwing::JScrollPane
    attr_accessor :text, :tar
    def initialize
      super
      @text = Java::JavaxSwing::JTextPane.new
      @text.font = find_font('Monospaced', Java::JavaAwt::Font::PLAIN, 14, 'Anonymous Pro', 'Anonymous', 'Monaco', 'Andale Mono')
      @text.margin = Java::JavaAwt::Insets.new(8,8,8,8)
      @text.caret_color = Java::JavaAwt::Color.new(0xa40000)
      @text.background  = Java::JavaAwt::Color.new(0xf2f2f2)
      @text.foreground  = Java::JavaAwt::Color.new(0xa40000)
      self.viewport_view = @text
      @tar = Java::OrgJrubyDemo::TextAreaReadline.new(@text, " Welcome to the Burp JRuby IRB Console [#{JRUBY_VERSION} (#{RUBY_VERSION})]\n\n")
      JRuby.objectspace = true # useful for code completion
      @tar.hook_into_runtime_with_streams(JRuby.runtime)
    end

    # Try to find preferred font family, use otherwise -- err --  otherwise
    def find_font(otherwise, style, size, *families)
      avail_families = Java::JavaAwt::GraphicsEnvironment.local_graphics_environment.available_font_family_names
      fontname = families.find(proc {otherwise}) { |name| avail_families.include? name }
      Java::JavaAwt::Font.new(fontname, style, size)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
buby-1.5.2-java lib/buby/burp_extender/console_pane.rb
buby-1.5.1-java lib/buby/burp_extender/console_pane.rb
buby-1.5.0-java lib/buby/burp_extender/console_pane.rb
buby-1.5.0.pre4-java lib/buby/burp_extender/console_pane.rb
buby-1.5.0.pre3-java lib/buby/burp_extender/console_pane.rb