Class: MateExample::AddAnnotations

Inherits:
Jface::Action
  • Object
show all
Defined in:
lib/javamateview/example.rb

Defined Under Namespace

Classes: AnnotationListener

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#windowObject

Returns the value of attribute window.



129
130
131
# File 'lib/javamateview/example.rb', line 129

def window
  @window
end

Instance Method Details

#runObject



141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
# File 'lib/javamateview/example.rb', line 141

def run
  mt = @window.mate_text
  mt.add_annotation_type(
      "error.type", 
      File.dirname(__FILE__) + "/example/little-star.png",
      Swt::Graphics::RGB.new(200, 0, 0));
  mt.add_annotation_type(
      "happy.type", 
      File.dirname(__FILE__) + "/example/little-smiley.png",
      Swt::Graphics::RGB.new(0, 0, 200));
  mt.add_annotation("error.type", 1, "Learn how to spell \"text!\"", 5, 5);
  mt.add_annotation("happy.type", 1, "Learn how to spell \"text!\"", 50, 5);
  mt.add_annotation_listener(AnnotationListener.new(@window.mate_text))
  p [:online, 0, mt.annotations_on_line(0).to_a]
  p [:online, 1, mt.annotations_on_line(1).to_a]
  p [:online, 2, mt.annotations_on_line(2).to_a]
  p [:online, 3, mt.annotations_on_line(3).to_a]
  p [:online, 4, mt.annotations_on_line(4).to_a]
end