glimmer-dsl-swt 4.18.4.11 → 4.18.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +33 -0
  3. data/README.md +7 -5
  4. data/VERSION +1 -1
  5. data/bin/glimmer +3 -3
  6. data/docs/reference/GLIMMER_CONFIGURATION.md +7 -3
  7. data/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md +121 -5
  8. data/docs/reference/GLIMMER_SAMPLES.md +17 -4
  9. data/glimmer-dsl-swt.gemspec +19 -9
  10. data/lib/ext/glimmer/config.rb +3 -7
  11. data/lib/glimmer/data_binding/list_selection_binding.rb +13 -7
  12. data/lib/glimmer/data_binding/table_items_binding.rb +22 -17
  13. data/lib/glimmer/data_binding/tree_items_binding.rb +19 -15
  14. data/lib/glimmer/data_binding/widget_binding.rb +9 -27
  15. data/lib/glimmer/dsl/swt/auto_exec_expression.rb +36 -0
  16. data/lib/glimmer/dsl/swt/checkbox_group_selection_data_binding_expression.rb +9 -6
  17. data/lib/glimmer/dsl/swt/combo_selection_data_binding_expression.rb +16 -14
  18. data/lib/glimmer/dsl/swt/data_binding_expression.rb +1 -2
  19. data/lib/glimmer/dsl/swt/exec_expression.rb +1 -1
  20. data/lib/glimmer/dsl/swt/image_expression.rb +8 -1
  21. data/lib/glimmer/dsl/swt/list_selection_data_binding_expression.rb +11 -8
  22. data/lib/glimmer/dsl/swt/pixel_expression.rb +1 -1
  23. data/lib/glimmer/dsl/swt/radio_group_selection_data_binding_expression.rb +8 -5
  24. data/lib/glimmer/dsl/swt/shape_expression.rb +1 -1
  25. data/lib/glimmer/dsl/swt/widget_expression.rb +4 -3
  26. data/lib/glimmer/launcher.rb +3 -0
  27. data/lib/glimmer/rake_task/scaffold.rb +3 -0
  28. data/lib/glimmer/swt/custom/code_text.rb +11 -11
  29. data/lib/glimmer/swt/custom/drawable.rb +4 -0
  30. data/lib/glimmer/swt/custom/shape.rb +129 -20
  31. data/lib/glimmer/swt/custom/shape/arc.rb +43 -0
  32. data/lib/glimmer/swt/custom/shape/focus.rb +43 -0
  33. data/lib/glimmer/swt/custom/shape/image.rb +86 -0
  34. data/lib/glimmer/swt/custom/shape/line.rb +58 -0
  35. data/lib/glimmer/swt/custom/shape/oval.rb +43 -0
  36. data/lib/glimmer/swt/custom/shape/point.rb +52 -0
  37. data/lib/glimmer/swt/custom/shape/polygon.rb +73 -0
  38. data/lib/glimmer/swt/custom/shape/polyline.rb +73 -0
  39. data/lib/glimmer/swt/custom/shape/rectangle.rb +87 -0
  40. data/lib/glimmer/swt/custom/shape/text.rb +73 -0
  41. data/lib/glimmer/swt/date_time_proxy.rb +9 -3
  42. data/lib/glimmer/swt/directory_dialog_proxy.rb +20 -18
  43. data/lib/glimmer/swt/display_proxy.rb +62 -2
  44. data/lib/glimmer/swt/expand_item_proxy.rb +18 -12
  45. data/lib/glimmer/swt/file_dialog_proxy.rb +20 -18
  46. data/lib/glimmer/swt/font_proxy.rb +1 -1
  47. data/lib/glimmer/swt/image_proxy.rb +1 -1
  48. data/lib/glimmer/swt/layout_data_proxy.rb +21 -15
  49. data/lib/glimmer/swt/layout_proxy.rb +19 -15
  50. data/lib/glimmer/swt/menu_proxy.rb +2 -2
  51. data/lib/glimmer/swt/message_box_proxy.rb +20 -7
  52. data/lib/glimmer/swt/scrolled_composite_proxy.rb +6 -2
  53. data/lib/glimmer/swt/shell_proxy.rb +94 -80
  54. data/lib/glimmer/swt/swt_proxy.rb +16 -0
  55. data/lib/glimmer/swt/tab_item_proxy.rb +5 -3
  56. data/lib/glimmer/swt/table_proxy.rb +32 -11
  57. data/lib/glimmer/swt/tree_proxy.rb +11 -16
  58. data/lib/glimmer/swt/widget_listener_proxy.rb +6 -2
  59. data/lib/glimmer/swt/widget_proxy.rb +200 -117
  60. data/lib/glimmer/ui.rb +5 -0
  61. data/lib/glimmer/ui/custom_shell.rb +11 -5
  62. data/lib/glimmer/ui/custom_widget.rb +4 -5
  63. data/samples/elaborate/contact_manager.rb +7 -7
  64. data/samples/elaborate/login.rb +25 -21
  65. data/samples/elaborate/mandelbrot_fractal.rb +3 -5
  66. data/samples/elaborate/tetris.rb +1 -0
  67. data/samples/elaborate/tic_tac_toe.rb +16 -14
  68. data/samples/elaborate/tic_tac_toe/board.rb +5 -5
  69. data/samples/elaborate/tic_tac_toe/cell.rb +5 -5
  70. data/samples/hello/hello_button.rb +7 -7
  71. data/samples/hello/hello_canvas.rb +43 -2
  72. data/samples/hello/hello_checkbox.rb +16 -14
  73. data/samples/hello/hello_checkbox_group.rb +11 -9
  74. data/samples/hello/hello_combo.rb +14 -12
  75. data/samples/hello/hello_computed.rb +7 -7
  76. data/samples/hello/hello_cursor.rb +2 -1
  77. data/samples/hello/hello_custom_shell.rb +17 -21
  78. data/samples/hello/hello_custom_widget.rb +4 -6
  79. data/samples/hello/hello_date_time.rb +14 -12
  80. data/samples/hello/hello_directory_dialog.rb +7 -7
  81. data/samples/hello/hello_expand_bar.rb +8 -8
  82. data/samples/hello/hello_file_dialog.rb +7 -7
  83. data/samples/hello/hello_group.rb +18 -16
  84. data/samples/hello/hello_list_multi_selection.rb +13 -11
  85. data/samples/hello/hello_list_single_selection.rb +13 -11
  86. data/samples/hello/hello_progress_bar.rb +3 -7
  87. data/samples/hello/hello_radio.rb +18 -16
  88. data/samples/hello/hello_radio_group.rb +14 -12
  89. data/samples/hello/hello_spinner.rb +7 -7
  90. data/samples/hello/hello_tab.rb +5 -5
  91. data/samples/hello/hello_table.rb +10 -5
  92. data/samples/hello/hello_tree.rb +485 -0
  93. metadata +17 -18
@@ -68,9 +68,9 @@ module Glimmer
68
68
  end
69
69
 
70
70
  if styles.include?(:bar)
71
- parent.swt_widget.setMenuBar(swt_widget)
71
+ DisplayProxy.instance.auto_exec { parent.swt_widget.setMenuBar(swt_widget) }
72
72
  elsif styles.include?(:pop_up)
73
- parent.swt_widget.setMenu(swt_widget)
73
+ DisplayProxy.instance.auto_exec { parent.swt_widget.setMenu(swt_widget) }
74
74
  end
75
75
  end
76
76
 
@@ -42,8 +42,10 @@ module Glimmer
42
42
  end
43
43
 
44
44
  def open
45
- @swt_widget.open.tap do |result|
46
- @temporary_parent&.dispose
45
+ DisplayProxy.instance.auto_exec do
46
+ @swt_widget.open.tap do |result|
47
+ @temporary_parent&.dispose
48
+ end
47
49
  end
48
50
  end
49
51
 
@@ -66,18 +68,29 @@ module Glimmer
66
68
  end
67
69
 
68
70
  def set_attribute(attribute_name, *args)
69
- @swt_widget.send(attribute_setter(attribute_name), *args) unless @swt_widget.send(attribute_getter(attribute_name)) == args.first
71
+ DisplayProxy.instance.auto_exec do
72
+ @swt_widget.send(attribute_setter(attribute_name), *args) unless @swt_widget.send(attribute_getter(attribute_name)) == args.first
73
+ end
70
74
  end
71
75
 
72
76
  def get_attribute(attribute_name)
73
- @swt_widget.send(attribute_getter(attribute_name))
77
+ DisplayProxy.instance.auto_exec do
78
+ @swt_widget.send(attribute_getter(attribute_name))
79
+ end
74
80
  end
75
81
 
76
82
  def method_missing(method, *args, &block)
77
- swt_widget.send(method, *args, &block)
83
+ DisplayProxy.instance.auto_exec do
84
+ swt_widget.send(method, *args, &block)
85
+ end
78
86
  rescue => e
79
- Glimmer::Config.logger.debug {"Neither MessageBoxProxy nor #{swt_widget.class.name} can handle the method ##{method}"}
80
- super
87
+ begin
88
+ super
89
+ rescue Exception => inner_error
90
+ Glimmer::Config.logger.error {"Neither MessageBoxProxy nor #{swt_widget.class.name} can handle the method ##{method}"}
91
+ Glimmer::Config.logger.error {e.full_message}
92
+ raise inner_error
93
+ end
81
94
  end
82
95
 
83
96
  def respond_to?(method, *args, &block)
@@ -26,7 +26,9 @@ module Glimmer
26
26
  module SWT
27
27
  class ScrolledCompositeProxy < Glimmer::SWT::WidgetProxy
28
28
  def post_initialize_child(child)
29
- swt_widget.content = child.swt_widget
29
+ auto_exec do
30
+ swt_widget.content = child.swt_widget
31
+ end
30
32
  # TODO consider triggering this method in the future upon resizing of content with a listener (on_control_resized)
31
33
  # child.on_control_resized do
32
34
  # swt_widget.set_min_size(swt_widget.computeSize(child.bounds.width, child.bounds.height))
@@ -38,7 +40,9 @@ module Glimmer
38
40
  end
39
41
 
40
42
  def calculate_min_size
41
- swt_widget.set_min_size(swt_widget.computeSize(SWTProxy[:default], SWTProxy[:default]))
43
+ auto_exec do
44
+ swt_widget.set_min_size(swt_widget.computeSize(SWTProxy[:default], SWTProxy[:default]))
45
+ end
42
46
  end
43
47
  alias recalculate_min_size calculate_min_size
44
48
  end
@@ -42,60 +42,64 @@ module Glimmer
42
42
  # if swt_widget keyword arg was passed, then it is assumed the shell has already been instantiated
43
43
  # and the proxy wraps it instead of creating a new one.
44
44
  def initialize(*args, swt_widget: nil)
45
- if swt_widget
46
- @swt_widget = swt_widget
47
- else
48
- if args.first.respond_to?(:swt_widget) && args.first.swt_widget.is_a?(Shell)
49
- @parent_proxy = args[0]
50
- args[0] = args[0].swt_widget
51
- end
52
- style_args = args.select {|arg| arg.is_a?(Symbol) || arg.is_a?(String)}.map(&:to_sym)
53
- fill_screen = nil
54
- if style_args.include?(:fill_screen)
55
- args.delete(:fill_screen)
56
- style_args.delete(:fill_screen)
57
- fill_screen = true
58
- end
59
- if style_args.any?
60
- style_arg_start_index = args.index(style_args.first)
61
- style_arg_last_index = args.index(style_args.last)
62
- args[style_arg_start_index..style_arg_last_index] = SWTProxy[style_args]
63
- end
64
- if args.first.nil? || (!args.first.is_a?(Display) && !args.first.is_a?(Shell))
65
- @display = DisplayProxy.instance.swt_display
66
- args = [@display] + args
67
- end
68
- args = args.compact
69
- @swt_widget = Shell.new(*args)
70
- @swt_widget.set_data('proxy', self)
71
- @swt_widget.setLayout(FillLayout.new)
72
- @swt_widget.setMinimumSize(WIDTH_MIN, HEIGHT_MIN)
73
- # TODO make this an option not the default
74
- shell_swt_display = Glimmer::SWT::DisplayProxy.instance.swt_display
75
- on_swt_show do
76
- @swt_widget.set_size(@display.bounds.width, @display.bounds.height) if fill_screen
77
- Thread.new do
78
- sleep(0.25)
79
- shell_swt_display.async_exec do
80
- @swt_widget.setActive unless @swt_widget.isDisposed
45
+ auto_exec do
46
+ if swt_widget
47
+ @swt_widget = swt_widget
48
+ else
49
+ if args.first.respond_to?(:swt_widget) && args.first.swt_widget.is_a?(Shell)
50
+ @parent_proxy = args[0]
51
+ args[0] = args[0].swt_widget
52
+ end
53
+ style_args = args.select {|arg| arg.is_a?(Symbol) || arg.is_a?(String)}.map(&:to_sym)
54
+ fill_screen = nil
55
+ if style_args.include?(:fill_screen)
56
+ args.delete(:fill_screen)
57
+ style_args.delete(:fill_screen)
58
+ fill_screen = true
59
+ end
60
+ if style_args.any?
61
+ style_arg_start_index = args.index(style_args.first)
62
+ style_arg_last_index = args.index(style_args.last)
63
+ args[style_arg_start_index..style_arg_last_index] = SWTProxy[style_args]
64
+ end
65
+ if args.first.nil? || (!args.first.is_a?(Display) && !args.first.is_a?(Shell))
66
+ @display = DisplayProxy.instance.swt_display
67
+ args = [@display] + args
68
+ end
69
+ args = args.compact
70
+ @swt_widget = Shell.new(*args)
71
+ @swt_widget.set_data('proxy', self)
72
+ @swt_widget.setLayout(FillLayout.new)
73
+ @swt_widget.setMinimumSize(WIDTH_MIN, HEIGHT_MIN)
74
+ # TODO make this an option not the default
75
+ shell_swt_display = Glimmer::SWT::DisplayProxy.instance.swt_display
76
+ on_swt_show do
77
+ @swt_widget.set_size(@display.bounds.width, @display.bounds.height) if fill_screen
78
+ Thread.new do
79
+ sleep(0.25)
80
+ shell_swt_display.async_exec do
81
+ @swt_widget.setActive unless @swt_widget.isDisposed
82
+ end
81
83
  end
82
84
  end
83
85
  end
86
+ on_widget_disposed {
87
+ clear_shapes
88
+ }
89
+ @display ||= @swt_widget.getDisplay
84
90
  end
85
- on_widget_disposed {
86
- clear_shapes
87
- }
88
- @display ||= @swt_widget.getDisplay
89
91
  end
90
92
 
91
93
  # Centers shell within monitor it is in
92
94
  def center_within_display
93
- primary_monitor = @display.getPrimaryMonitor()
94
- monitor_bounds = primary_monitor.getBounds()
95
- shell_bounds = @swt_widget.getBounds()
96
- location_x = monitor_bounds.x + (monitor_bounds.width - shell_bounds.width) / 2
97
- location_y = monitor_bounds.y + (monitor_bounds.height - shell_bounds.height) / 2
98
- @swt_widget.setLocation(location_x, location_y)
95
+ auto_exec do
96
+ primary_monitor = @display.getPrimaryMonitor()
97
+ monitor_bounds = primary_monitor.getBounds()
98
+ shell_bounds = @swt_widget.getBounds()
99
+ location_x = monitor_bounds.x + (monitor_bounds.width - shell_bounds.width) / 2
100
+ location_y = monitor_bounds.y + (monitor_bounds.height - shell_bounds.height) / 2
101
+ @swt_widget.setLocation(location_x, location_y)
102
+ end
99
103
  end
100
104
 
101
105
  # Opens shell and starts SWT's UI thread event loop
@@ -107,18 +111,22 @@ module Glimmer
107
111
 
108
112
  # Opens without starting the event loop.
109
113
  def open_only
110
- if @opened_before
111
- @swt_widget.setVisible(true)
112
- else
113
- @opened_before = true
114
- @swt_widget.pack
115
- center_within_display
116
- @swt_widget.open
114
+ auto_exec do
115
+ if @opened_before
116
+ @swt_widget.setVisible(true)
117
+ else
118
+ @opened_before = true
119
+ @swt_widget.pack
120
+ center_within_display
121
+ @swt_widget.open
122
+ end
117
123
  end
118
124
  end
119
125
 
120
126
  def nested?
121
- !swt_widget&.parent.nil?
127
+ auto_exec do
128
+ !swt_widget&.parent.nil?
129
+ end
122
130
  end
123
131
  alias nested nested?
124
132
 
@@ -129,16 +137,22 @@ module Glimmer
129
137
 
130
138
  # Hides shell. Automatically checks if widget is disposed to avoid crashing.
131
139
  def hide
132
- @swt_widget.setVisible(false) unless @swt_widget.isDisposed
140
+ auto_exec do
141
+ @swt_widget.setVisible(false) unless @swt_widget.isDisposed
142
+ end
133
143
  end
134
144
 
135
145
  # Closes shell. Automatically checks if widget is disposed to avoid crashing.
136
146
  def close
137
- @swt_widget.close unless @swt_widget.isDisposed
147
+ auto_exec do
148
+ @swt_widget.close unless @swt_widget.isDisposed
149
+ end
138
150
  end
139
151
 
140
152
  def visible?
141
- @swt_widget.isDisposed ? false : @swt_widget.isVisible
153
+ auto_exec do
154
+ @swt_widget.isDisposed ? false : @swt_widget.isVisible
155
+ end
142
156
  end
143
157
  alias visible visible?
144
158
 
@@ -151,25 +165,23 @@ module Glimmer
151
165
  DisplayProxy.instance.focus_control&.shell == swt_widget
152
166
  end
153
167
 
154
- def pack
155
- @swt_widget.pack
156
- end
157
-
158
168
  def pack_same_size
159
- bounds = @swt_widget.getBounds
160
- if OS.mac?
161
- @swt_widget.pack
162
- @swt_widget.setBounds(bounds)
163
- elsif OS.windows? || OS::Underlying.windows?
164
- minimum_size = @swt_widget.getMinimumSize
165
- @swt_widget.setMinimumSize(bounds.width, bounds.height)
166
- listener = on_control_resized { @swt_widget.setBounds(bounds) }
167
- @swt_widget.layout(true, true)
168
- @swt_widget.removeControlListener(listener.swt_listener)
169
- @swt_widget.setMinimumSize(minimum_size)
170
- elsif OS.linux?
171
- @swt_widget.layout(true, true)
172
- @swt_widget.setBounds(bounds)
169
+ auto_exec do
170
+ bounds = @swt_widget.getBounds
171
+ if OS.mac?
172
+ @swt_widget.pack
173
+ @swt_widget.setBounds(bounds)
174
+ elsif OS.windows? || OS::Underlying.windows?
175
+ minimum_size = @swt_widget.getMinimumSize
176
+ @swt_widget.setMinimumSize(bounds.width, bounds.height)
177
+ listener = on_control_resized { @swt_widget.setBounds(bounds) }
178
+ @swt_widget.layout(true, true)
179
+ @swt_widget.removeControlListener(listener.swt_listener)
180
+ @swt_widget.setMinimumSize(minimum_size)
181
+ elsif OS.linux?
182
+ @swt_widget.layout(true, true)
183
+ @swt_widget.setBounds(bounds)
184
+ end
173
185
  end
174
186
  end
175
187
 
@@ -184,11 +196,13 @@ module Glimmer
184
196
  # https://help.eclipse.org/2019-12/nftopic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/widgets/Display.html
185
197
  # This method is not needed except in rare circumstances where there is a need to start the SWT Event Loop before opening the shell.
186
198
  def start_event_loop
187
- until @swt_widget.isDisposed
188
- begin
189
- @display.sleep unless @display.readAndDispatch
190
- rescue => e
191
- Glimmer::Config.logger.info {e.full_message}
199
+ auto_exec do
200
+ until @swt_widget.isDisposed
201
+ begin
202
+ @display.sleep unless @display.readAndDispatch
203
+ rescue => e
204
+ Glimmer::Config.logger.info {e.full_message}
205
+ end
192
206
  end
193
207
  end
194
208
  end
@@ -49,6 +49,22 @@ module Glimmer
49
49
  def extra_styles
50
50
  EXTRA_STYLES
51
51
  end
52
+
53
+ def cursor_styles
54
+ SWT.constants.select {|c| c.to_s.start_with?('CURSOR_')}
55
+ end
56
+
57
+ def color_styles
58
+ SWT.constants.select {|c| c.to_s.start_with?('COLOR_')}
59
+ end
60
+
61
+ def cursor_options
62
+ cursor_styles.map {|c| c.to_s.sub('CURSOR_', '').downcase}.map(&:to_sym)
63
+ end
64
+
65
+ def color_options
66
+ color_styles.map {|c| c.to_s.sub('COLOR_', '').downcase}.map(&:to_sym)
67
+ end
52
68
  end
53
69
 
54
70
  EXTRA_STYLES = {
@@ -83,9 +83,11 @@ module Glimmer
83
83
  end
84
84
 
85
85
  def dispose
86
- swt_tab_item.setControl(nil)
87
- swt_widget.dispose
88
- swt_tab_item.dispose
86
+ auto_exec do
87
+ swt_tab_item.setControl(nil)
88
+ swt_widget.dispose
89
+ swt_tab_item.dispose
90
+ end
89
91
  end
90
92
  end
91
93
  end
@@ -266,15 +266,21 @@ module Glimmer
266
266
  end
267
267
 
268
268
  def items
269
- swt_widget.get_items
269
+ auto_exec do
270
+ swt_widget.get_items
271
+ end
270
272
  end
271
273
 
272
274
  def model_binding
273
- swt_widget.data
275
+ auto_exec do
276
+ swt_widget.data
277
+ end
274
278
  end
275
279
 
276
280
  def table_items_binding
277
- swt_widget.get_data('table_items_binding')
281
+ auto_exec do
282
+ swt_widget.get_data('table_items_binding')
283
+ end
278
284
  end
279
285
 
280
286
  def sort_block=(comparator)
@@ -313,7 +319,10 @@ module Glimmer
313
319
 
314
320
  # Sorts by specified TableColumnProxy object. If nil, it uses the table default sort instead.
315
321
  def sort_by_column!(table_column_proxy=nil)
316
- index = swt_widget.columns.to_a.index(table_column_proxy.swt_widget) unless table_column_proxy.nil?
322
+ index = nil
323
+ auto_exec do
324
+ index = swt_widget.columns.to_a.index(table_column_proxy.swt_widget) unless table_column_proxy.nil?
325
+ end
317
326
  new_sort_property = table_column_proxy.nil? ? @sort_property : table_column_proxy.sort_property || [column_properties[index]]
318
327
  return if table_column_proxy.nil? && new_sort_property.nil? && @sort_block.nil? && @sort_by_block.nil?
319
328
  if new_sort_property && table_column_proxy.nil? && new_sort_property.size == 1 && (index = column_sort_properties.index(new_sort_property))
@@ -330,12 +339,16 @@ module Glimmer
330
339
  end
331
340
 
332
341
  @sort_direction = @sort_direction.nil? || @sort_property.first != new_sort_property.first || @sort_direction == :descending ? :ascending : :descending
333
- swt_widget.sort_direction = @sort_direction == :ascending ? SWTProxy[:up] : SWTProxy[:down]
342
+ auto_exec do
343
+ swt_widget.sort_direction = @sort_direction == :ascending ? SWTProxy[:up] : SWTProxy[:down]
344
+ end
334
345
 
335
346
  @sort_property = [new_sort_property].flatten.compact
336
347
  table_column_index = column_properties.index(new_sort_property.to_s.to_sym)
337
348
  table_column_proxy ||= table_column_proxies[table_column_index] if table_column_index
338
- swt_widget.sort_column = table_column_proxy.swt_widget if table_column_proxy
349
+ auto_exec do
350
+ swt_widget.sort_column = table_column_proxy.swt_widget if table_column_proxy
351
+ end
339
352
 
340
353
  if table_column_proxy
341
354
  @sort_by_block = nil
@@ -405,14 +418,18 @@ module Glimmer
405
418
 
406
419
  def cells
407
420
  column_count = @table.column_properties.size
408
- swt_widget.items.map {|item| column_count.times.map {|i| item.get_text(i)} }
421
+ auto_exec do
422
+ swt_widget.items.map {|item| column_count.times.map {|i| item.get_text(i)} }
423
+ end
409
424
  end
410
425
 
411
426
  # Performs a search for table items matching block condition
412
427
  # If no condition block is passed, returns all table items
413
428
  # Returns a Java TableItem array to easily set as selection on org.eclipse.swt.Table if needed
414
429
  def search(&condition)
415
- swt_widget.getItems.select {|item| condition.nil? || condition.call(item)}.to_java(TableItem)
430
+ auto_exec do
431
+ swt_widget.getItems.select {|item| condition.nil? || condition.call(item)}.to_java(TableItem)
432
+ end
416
433
  end
417
434
 
418
435
  # Returns all table items including descendants
@@ -454,7 +471,9 @@ module Glimmer
454
471
  end
455
472
 
456
473
  def edit_selected_table_item(column_index, before_write: nil, after_write: nil, after_cancel: nil)
457
- edit_table_item(swt_widget.getSelection.first, column_index, before_write: before_write, after_write: after_write, after_cancel: after_cancel)
474
+ auto_exec do
475
+ edit_table_item(swt_widget.getSelection.first, column_index, before_write: before_write, after_write: after_write, after_cancel: after_cancel)
476
+ end
458
477
  end
459
478
 
460
479
  def edit_table_item(table_item, column_index, before_write: nil, after_write: nil, after_cancel: nil, write_on_cancel: false)
@@ -512,7 +531,9 @@ module Glimmer
512
531
  model.send("#{model_editing_property}=", new_value) # makes table update itself, so must search for selected table item again
513
532
  # Table refresh happens here because of model update triggering observers, so must retrieve table item again
514
533
  edited_table_item = search { |ti| ti.getData == model }.first
515
- swt_widget.showItem(edited_table_item)
534
+ auto_exec do
535
+ swt_widget.showItem(edited_table_item)
536
+ end
516
537
  @table_editor_widget_proxy&.swt_widget&.dispose
517
538
  @table_editor_widget_proxy = nil
518
539
  if after_write&.arity == 0
@@ -524,7 +545,7 @@ module Glimmer
524
545
  end
525
546
  end
526
547
  end
527
-
548
+
528
549
  content {
529
550
  @table_editor_widget_proxy = TableProxy::editors.symbolize_keys[editor_widget][:editor_gui].call(editor_widget_args, model, model_editing_property, self)
530
551
  }