Class: BurpExtender::ConsolePane Private

Inherits:
Java::JavaxSwing::JScrollPane
  • Object
show all
Defined in:
lib/buby/burp_extender/console_pane.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConsolePane

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of ConsolePane.



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/buby/burp_extender/console_pane.rb', line 5

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

Instance Attribute Details

#tarObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



4
5
6
# File 'lib/buby/burp_extender/console_pane.rb', line 4

def tar
  @tar
end

#textObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



4
5
6
# File 'lib/buby/burp_extender/console_pane.rb', line 4

def text
  @text
end

Instance Method Details

#find_font(otherwise, style, size, *families) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Try to find preferred font family, use otherwise – err – otherwise



20
21
22
23
24
# File 'lib/buby/burp_extender/console_pane.rb', line 20

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