Class: MateExample
- Inherits:
-
Jface::ApplicationWindow
- Object
- Jface::ApplicationWindow
- MateExample
- Defined in:
- lib/javamateview/example.rb
Defined Under Namespace
Classes: AddAnnotations, AlwaysParseAll, MyListener, PrintScopeTree, RemoveAnnotations, ReplaceContents1, ReplaceContents2, ReplaceContents3, SetBlockSelection, SetHTML, SetJavaScript, SetMacClassic, SetNotBlockSelection, SetRuby, SetTwilight, ToggleInvisibles, ToggleWordWrap
Instance Attribute Summary collapse
-
#contents ⇒ Object
readonly
Returns the value of attribute contents.
-
#mate_text ⇒ Object
readonly
Returns the value of attribute mate_text.
Class Method Summary collapse
Instance Method Summary collapse
- #createContents(parent) ⇒ Object
- #createMenuManager ⇒ Object
-
#initialize ⇒ MateExample
constructor
A new instance of MateExample.
- #initializeBounds ⇒ Object
Constructor Details
#initialize ⇒ MateExample
Returns a new instance of MateExample.
8 9 10 |
# File 'lib/javamateview/example.rb', line 8 def initialize super(nil) end |
Instance Attribute Details
#contents ⇒ Object (readonly)
Returns the value of attribute contents.
6 7 8 |
# File 'lib/javamateview/example.rb', line 6 def contents @contents end |
#mate_text ⇒ Object (readonly)
Returns the value of attribute mate_text.
6 7 8 |
# File 'lib/javamateview/example.rb', line 6 def mate_text @mate_text end |
Class Method Details
.run ⇒ Object
319 320 321 322 323 324 325 326 327 328 329 330 |
# File 'lib/javamateview/example.rb', line 319 def self.run JavaMateView::Bundle.load_bundles("input/") p JavaMateView::Bundle.bundles.to_a.map {|b| b.name } JavaMateView::ThemeManager.load_themes("input/") p JavaMateView::ThemeManager.themes.to_a.map {|t| t.name } window = MateExample.new window.block_on_open = true window.addMenuBar window.open Swt::Widgets::Display.getCurrent.dispose end |
Instance Method Details
#createContents(parent) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/javamateview/example.rb', line 21 def createContents(parent) @contents = Swt::Widgets::Composite.new(parent, Swt::SWT::NONE) @contents.layout = Swt::Layout::FillLayout.new @mate_text = JavaMateView::MateText.new(@contents, false) @mate_text.add_grammar_listener do |new_name| puts "listened for #{new_name} in #{self}" end @mate_text.set_grammar_by_name "Ruby" @mate_text.set_theme_by_name "Mac Classic" @mate_text.set_font "Monaco", 15 return @contents end |
#createMenuManager ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
# File 'lib/javamateview/example.rb', line 39 def createMenuManager = Jface::MenuManager.new = Jface::MenuManager.new("Tests") .add replace1_action = ReplaceContents1.new replace1_action.window = self replace1_action.text = "Contents RUBY" .add replace1_action replace2_action = ReplaceContents2.new replace2_action.window = self replace2_action.text = "Contents HTML" .add replace2_action replace3_action = ReplaceContents3.new replace3_action.window = self replace3_action.text = "Contents long-lined JavaScript (slow)" .add replace3_action set_ruby_action = SetRuby.new set_ruby_action.window = self set_ruby_action.text = "Set Ruby Grammar" .add set_ruby_action set_html_action = SetHTML.new set_html_action.window = self set_html_action.text = "Set HTML Grammar" .add set_html_action set_java_script_action = SetJavaScript.new set_java_script_action.window = self set_java_script_action.text = "Set JavaScript Grammar" .add set_java_script_action set_mc_action = SetMacClassic.new set_mc_action.window = self set_mc_action.text = "Set Mac Classic" .add set_mc_action set_twilight_action = SetTwilight.new set_twilight_action.window = self set_twilight_action.text = "Set Twilight" .add set_twilight_action set_scopes_action = PrintScopeTree.new set_scopes_action.window = self set_scopes_action.text = "Print Scope Tree" .add set_scopes_action set_block_selection = SetBlockSelection.new set_block_selection.window = self set_block_selection.text = "Set Block Selection" .add set_block_selection set_block_selection = SetNotBlockSelection.new set_block_selection.window = self set_block_selection.text = "Set Not Block Selection" .add set_block_selection always_parse_all = AlwaysParseAll.new always_parse_all.window = self always_parse_all.text = "Always Parse All" .add always_parse_all toggle_invisibles = ToggleInvisibles.new toggle_invisibles.window = self toggle_invisibles.text = "Show/Hide Invisibles" .add toggle_invisibles toggle_word_wrap = ToggleWordWrap.new toggle_word_wrap.window = self toggle_word_wrap.text = "Toggle Word Wrap" .add toggle_word_wrap remove_annotations = RemoveAnnotations.new remove_annotations.window = self remove_annotations.text = "Remove Annotations" .add remove_annotations add_annotations = AddAnnotations.new add_annotations.window = self add_annotations.text = "Add Annotations" .add add_annotations return end |
#initializeBounds ⇒ Object
35 36 37 |
# File 'lib/javamateview/example.rb', line 35 def initializeBounds shell.set_size(500,400) end |