glimmer-cs-gladiator 0.5.3 → 0.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -18,10 +18,14 @@ module Glimmer
18
18
  APP_ROOT = ::File.expand_path('../../../..', __FILE__)
19
19
  # TODO make sure COMMAND_KEY doesn't clash on Linux/Windows for CMD+CTRL shortcuts
20
20
  COMMAND_KEY = OS.mac? ? :command : :ctrl
21
+ VERSION = ::File.read(::File.join(APP_ROOT, 'VERSION')).to_s.strip
22
+ LICENSE = ::File.read(::File.join(APP_ROOT, 'LICENSE.txt')).to_s.strip
23
+ ICON = ::File.expand_path(::File.join(APP_ROOT, 'images', 'glimmer-cs-gladiator-logo.png'))
21
24
 
22
25
  class << self
23
26
  attr_accessor :drag_and_drop
24
27
  attr_accessor :drag
28
+ attr_accessor :startup
25
29
  end
26
30
 
27
31
  ## Add options like the following to configure CustomShell by outside consumers
@@ -35,8 +39,26 @@ module Glimmer
35
39
  @project_dir ||= Dir.new(project_dir_path)
36
40
  end
37
41
 
38
- attr_reader :find_text, :tab_folder1, :tab_folder2, :filter_text, :rename_in_progress, :line_number_text, :file_tree
39
- attr_accessor :split_orientation, :current_tab_item, :current_tab_folder, :current_text_editor
42
+ def split_orientation=(value)
43
+ @split_orientation = value
44
+ save_config
45
+ if @loaded_config && !split_pane?
46
+ Gladiator.drag = true
47
+ child_path = project_dir.selected_child_path
48
+ project_dir.selected_child = nil
49
+ project_dir.selected_child_path = child_path
50
+ Gladiator.drag = false
51
+ end
52
+ @split_orientation
53
+ end
54
+
55
+ def split_pane?
56
+ pane_count = @tab_folder_sash_form&.children&.size
57
+ pane_count && pane_count > 1
58
+ end
59
+
60
+ attr_reader :find_text, :tab_folder1, :tab_folder2, :filter_text, :rename_in_progress, :line_number_text, :file_tree, :split_orientation
61
+ attr_accessor :current_tab_item, :current_tab_folder, :current_text_editor
40
62
 
41
63
  ## Uncomment before_body block to pre-initialize variables to use in body
42
64
  #
@@ -44,20 +66,29 @@ module Glimmer
44
66
  before_body {
45
67
  # TODO consider doing loading project files after displaying the GUI instead of holding it up before
46
68
  project_dir #pre-initialize directory
47
- at_exit do
69
+ TOPLEVEL_BINDING.receiver.send(:at_exit) do
48
70
  project_dir.selected_child&.write_raw_dirty_content
49
71
  end
50
72
  Display.setAppName('Gladiator')
51
73
  # make sure the display events are only hooked once if multiple gladiators are created
52
74
  unless defined?(@@display)
53
75
  @@display = display {
76
+ # TODO look into why a weird java dialog comes up on about (maybe a non-issue once packaged)
77
+ on_about {
78
+ display_about_dialog
79
+ }
54
80
  on_swt_keydown { |key_event|
55
81
  focused_gladiator = display.focus_control.shell&.get_data('custom_shell')
56
82
  focused_gladiator.handle_display_shortcut(key_event) if !focused_gladiator.nil? && key_event.widget.shell == focused_gladiator&.swt_widget
57
83
  }
84
+ on_swt_Close {
85
+ save_config
86
+ project_dir.selected_child&.write_dirty_content
87
+ }
58
88
  }
59
89
  end
60
90
 
91
+ @default_foreground = :dark_blue
61
92
  @split_orientation = swt(:horizontal)
62
93
  @config_file_path = ::File.join(project_dir.path, '.gladiator')
63
94
  @config = {}
@@ -69,42 +100,52 @@ module Glimmer
69
100
  #
70
101
  after_body {
71
102
  observe(project_dir, 'children') do
72
- select_tree_item unless @rename_in_progress
103
+ select_tree_item unless @rename_in_progress || Gladiator.startup
73
104
  end
74
105
  observe(project_dir, 'selected_child') do |selected_file|
75
106
  if selected_file
76
107
  if Gladiator.drag && !@tab_folder2
77
108
  @tab_folder1 = @current_tab_folder
109
+ async_exec { body_root.pack_same_size}
78
110
  @tab_folder_sash_form.content {
79
111
  @current_tab_folder = @tab_folder2 = tab_folder
80
112
  @current_tab_folder.swt_widget.setData('proxy', @current_tab_folder)
81
113
  }
82
114
  end
83
- select_tree_item unless @rename_in_progress
115
+ select_tree_item unless @rename_in_progress || Gladiator.startup
84
116
  found_tab_item = selected_tab_item
85
117
  if found_tab_item
86
118
  @current_tab_folder.swt_widget.setSelection(found_tab_item)
87
119
  @current_tab_item = found_tab_item.getData('proxy')
88
- @current_text_editor = found_tab_item.getData('text_editor')
120
+ @current_text_editor = found_tab_item.getData('text_editor') unless found_tab_item.getData('text_editor').nil?
89
121
  @current_tab_folder.swt_widget.setData('selected_tab_item', @current_tab_item)
90
122
  elsif selected_file
91
123
  @current_tab_folder.content {
92
124
  @current_tab_item = tab_item { |the_tab_item|
93
125
  text selected_file.name
94
- fill_layout :horizontal
95
- @current_text_editor = the_text_editor = text_editor(project_dir: project_dir, file: selected_file)
96
- @current_tab_folder.swt_widget.setData('selected_tab_item', @current_tab_item)
97
- @current_text_editor.text_proxy.content {
98
- on_focus_gained {
99
- tab_folder = the_text_editor.swt_widget.getParent.getParent
100
- @current_tab_folder = tab_folder.getData('proxy')
101
- @current_tab_item = the_tab_item
102
- @current_text_editor = the_text_editor
103
- @current_tab_folder.swt_widget.setData('selected_tab_item', @current_tab_item)
104
- @current_tab_folder.swt_widget.setSelection(@current_tab_item.swt_tab_item)
105
- project_dir.selected_child = @current_tab_item.swt_tab_item.getData('file')
126
+ fill_layout(:horizontal) {
127
+ margin_width 0
128
+ margin_height 0
129
+ }
130
+ tab_folder = nil
131
+ the_text_editor = nil
132
+ the_tab_item.content {
133
+ @current_text_editor = the_text_editor = text_editor(project_dir: project_dir, file: selected_file)
134
+ @current_tab_folder.swt_widget.setData('selected_tab_item', @current_tab_item)
135
+ the_tab_item.swt_tab_item.setData('text_editor', @current_text_editor)
136
+ @current_text_editor.text_proxy.content {
137
+ on_focus_gained {
138
+ tab_folder = the_text_editor.swt_widget.getParent.getParent
139
+ @current_tab_folder = tab_folder.getData('proxy')
140
+ @current_tab_item = the_tab_item
141
+ @current_text_editor = the_text_editor
142
+ @current_tab_folder.swt_widget.setData('selected_tab_item', @current_tab_item)
143
+ @current_tab_folder.swt_widget.setSelection(@current_tab_item.swt_tab_item)
144
+ project_dir.selected_child = @current_tab_item.swt_tab_item.getData('file')
145
+ }
106
146
  }
107
147
  }
148
+
108
149
  on_swt_show {
109
150
  @current_tab_item = the_tab_item
110
151
  @current_text_editor = the_text_editor
@@ -116,14 +157,20 @@ module Glimmer
116
157
  @current_text_editor&.text_widget&.setFocus
117
158
  }
118
159
  }
160
+ on_widget_disposed {
161
+ project_dir.selected_child&.write_dirty_content
162
+ tab_item_file = the_tab_item.swt_tab_item.get_data('file')
163
+ tab_item_file.close unless [@tab_folder1, @tab_folder2].compact.map(&:items).flatten(1).detect {|ti| ti.get_data('file') == tab_item_file}
164
+ }
119
165
  }
120
166
  @current_tab_item.swt_tab_item.setData('file_path', selected_file.path)
121
167
  @current_tab_item.swt_tab_item.setData('file', selected_file)
122
- @current_tab_item.swt_tab_item.setData('text_editor', @current_text_editor)
123
168
  @current_tab_item.swt_tab_item.setData('proxy', @current_tab_item)
124
169
  }
125
170
  @current_tab_folder.swt_widget.setSelection(@current_tab_item.swt_tab_item)
171
+
126
172
  body_root.pack_same_size
173
+ async_exec { body_root.pack_same_size}
127
174
  end
128
175
  @current_text_editor&.text_widget&.setFocus
129
176
  end
@@ -145,17 +192,31 @@ module Glimmer
145
192
  #
146
193
  body {
147
194
  shell {
195
+ grid_layout(2, false)
148
196
  text "Gladiator - #{::File.expand_path(project_dir.path)}"
149
197
  minimum_size 520, 250
150
198
  size 1440, 900
151
- grid_layout(2, false)
199
+ image ICON
200
+
152
201
  on_swt_show {
153
202
  swt_widget.setSize(@config[:shell_width], @config[:shell_height]) if @config[:shell_width] && @config[:shell_height]
154
203
  swt_widget.setLocation(@config[:shell_x], @config[:shell_y]) if @config[:shell_x] && @config[:shell_y]
155
204
  @loaded_config = true
156
205
  }
157
- on_swt_close {
206
+
207
+ on_shell_closed {
208
+ save_config
158
209
  project_dir.selected_child&.write_dirty_content
210
+ if @tab_folder2
211
+ current_tab_folder.swt_widget.getItems.each do |tab_item|
212
+ tab_item.getData('proxy')&.dispose
213
+ end
214
+ close_tab_folder
215
+ end
216
+ current_tab_folder.swt_widget.getItems.each do |tab_item|
217
+ tab_item.getData('proxy')&.dispose
218
+ end
219
+ body_root.close unless current_tab_folder.swt_widget.getItems.empty?
159
220
  }
160
221
  on_widget_disposed {
161
222
  project_dir.selected_child&.write_dirty_content
@@ -167,7 +228,13 @@ module Glimmer
167
228
  save_config
168
229
  }
169
230
  on_shell_deactivated {
170
- @current_text_editor&.file&.write_dirty_content
231
+ project_dir.selected_child&.write_dirty_content
232
+ }
233
+
234
+ display.swt_display.system_menu.items.find {|mi| mi.id == swt(:id_quit)}.add_selection_listener {
235
+ save_config
236
+ project_dir.selected_child&.write_dirty_content
237
+ exit(0)
171
238
  }
172
239
 
173
240
  menu_bar {
@@ -180,7 +247,7 @@ module Glimmer
180
247
  begin
181
248
  project_dir.selected_child_path = ''
182
249
  rescue => e
183
- pd e
250
+ puts e.full_message
184
251
  end
185
252
  }
186
253
  }
@@ -198,11 +265,15 @@ module Glimmer
198
265
  text '&Split'
199
266
  menu_item(:radio) {
200
267
  text '&Horizontal'
201
- selection bind(self, :split_orientation, on_read: ->(o) { o == swt(:horizontal)}, on_write: ->(b) { b ? swt(:horizontal) : swt(:vertical)})
268
+ selection bind(self, :split_orientation,
269
+ on_read: ->(o) { split_pane? && o == swt(:horizontal) },
270
+ on_write: ->(b) { b ? swt(:horizontal) : swt(:vertical) })
202
271
  }
203
272
  menu_item(:radio) {
204
273
  text '&Vertical'
205
- selection bind(self, :split_orientation, on_read: ->(o) { o == swt(:vertical)}, on_write: ->(b) { b ? swt(:vertical) : swt(:horizontal)})
274
+ selection bind(self, :split_orientation,
275
+ on_read: ->(o) { split_pane? && o == swt(:vertical) },
276
+ on_write: ->(b) { b ? swt(:vertical) : swt(:horizontal) })
206
277
  }
207
278
  }
208
279
  }
@@ -228,129 +299,227 @@ module Glimmer
228
299
  }
229
300
  }
230
301
  }
302
+ menu {
303
+ text '&Help'
304
+ menu_item {
305
+ text '&About'
306
+ on_widget_selected {
307
+ display_about_dialog
308
+ }
309
+ }
310
+ }
231
311
  }
232
312
 
233
313
  composite {
234
- grid_layout 1, false
314
+ grid_layout(1, false) {
315
+ margin_width 0
316
+ margin_height 0
317
+ }
318
+
235
319
  layout_data(:fill, :fill, false, true) {
236
320
  width_hint 300
237
321
  }
238
- @filter_text = text {
239
- layout_data :fill, :center, true, false
240
- text bind(project_dir, 'filter')
241
- on_key_pressed { |key_event|
242
- if key_event.keyCode == swt(:tab) ||
243
- key_event.keyCode == swt(:cr) ||
244
- key_event.keyCode == swt(:arrow_up) ||
245
- key_event.keyCode == swt(:arrow_down)
246
- @list.swt_widget.select(0) if @list.swt_widget.getSelectionIndex() == -1
247
- @list.swt_widget.setFocus
248
- end
249
- }
250
- }
251
- composite {
252
- fill_layout(:vertical) {
253
- spacing 5
254
- }
322
+ @side_bar_sash_form = sash_form(:vertical) {
255
323
  layout_data(:fill, :fill, true, true)
256
- @list = list(:border, :h_scroll, :v_scroll) {
257
- #visible bind(self, 'project_dir.filter') {|f| !!f}
258
- selection bind(project_dir, :filtered_path)
259
- on_mouse_up {
260
- project_dir.selected_child_path = @list.swt_widget.getSelection.first
261
- }
262
- on_key_pressed { |key_event|
263
- if Glimmer::SWT::SWTProxy.include?(key_event.keyCode, :cr)
264
- project_dir.selected_child_path = @list.swt_widget.getSelection.first
265
- @current_text_editor&.text_widget&.setFocus
266
- end
324
+ sash_width 4
325
+
326
+ resize_expand_items = lambda { |event=nil|
327
+ @file_lookup_expand_item&.swt_expand_item&.height = @file_lookup_expand_bar.size.y - @file_lookup_expand_item.swt_expand_item.header_height
328
+ @file_explorer_expand_item&.swt_expand_item&.height = @file_explorer_expand_bar.size.y - @file_explorer_expand_item.swt_expand_item.header_height
329
+ }
330
+
331
+ @file_lookup_expand_bar = expand_bar {
332
+ layout_data :fill, :fill, true, true
333
+ font height: 17, style: :bold
334
+ foreground @default_foreground
335
+
336
+ on_swt_show {
337
+ @file_lookup_expand_item.swt_expand_item.height = @file_lookup_expand_bar.size.y - @file_lookup_expand_item.swt_expand_item.header_height
267
338
  }
268
- drag_source(DND::DROP_COPY) {
269
- transfer [TextTransfer.getInstance].to_java(Transfer)
270
- on_drag_set_data { |event|
271
- Gladiator.drag = true
272
- list = event.widget.getControl
273
- event.data = list.getSelection.first
339
+
340
+ on_swt_Resize(&resize_expand_items)
341
+
342
+ @file_lookup_expand_item = expand_item {
343
+ grid_layout {
344
+ margin_width 0
345
+ margin_height 0
346
+ }
347
+ text 'File Lookup'
348
+ height display.bounds.height
349
+
350
+ @filter_text = text {
351
+ layout_data :fill, :center, true, false
352
+ text bind(project_dir, 'filter')
353
+ on_key_pressed { |key_event|
354
+ if key_event.keyCode == swt(:tab) ||
355
+ key_event.keyCode == swt(:cr) ||
356
+ key_event.keyCode == swt(:arrow_up) ||
357
+ key_event.keyCode == swt(:arrow_down)
358
+ @file_lookup_list.swt_widget.select(0) if @file_lookup_list.swt_widget.getSelectionIndex() == -1
359
+ @file_lookup_list.swt_widget.setFocus
360
+ end
361
+ }
362
+ }
363
+
364
+ @file_lookup_list = list(:border, :h_scroll, :v_scroll) {
365
+ layout_data :fill, :fill, true, true
366
+ #visible bind(self, 'project_dir.filter') {|f| !!f}
367
+ selection bind(project_dir, :filtered_path)
368
+ foreground @default_foreground
369
+ on_mouse_up {
370
+ project_dir.selected_child_path = @file_lookup_list.swt_widget.getSelection.first
371
+ }
372
+ on_key_pressed { |key_event|
373
+ if Glimmer::SWT::SWTProxy.include?(key_event.keyCode, :cr)
374
+ project_dir.selected_child_path = @file_lookup_list.swt_widget.getSelection.first
375
+ @current_text_editor&.text_widget&.setFocus
376
+ end
377
+ }
378
+ drag_source(DND::DROP_COPY) {
379
+ transfer [TextTransfer.getInstance].to_java(Transfer)
380
+ on_drag_set_data { |event|
381
+ Gladiator.drag = true
382
+ list = event.widget.getControl
383
+ event.data = list.getSelection.first
384
+ }
385
+ }
274
386
  }
275
387
  }
388
+
389
+ on_item_collapsed { |event|
390
+ if @file_explorer_expand_item.swt_expand_item.get_expanded
391
+ @file_lookup_expand_item_height = @file_lookup_expand_item.swt_expand_item.height
392
+ @file_lookup_expand_item.swt_expand_item.height = 0
393
+ @file_lookup_expand_bar_height = @file_lookup_expand_bar.swt_widget.size.y
394
+ @file_explorer_expand_bar_height = @file_explorer_expand_bar.swt_widget.size.y
395
+ @side_bar_sash_form.weights = [@file_lookup_expand_item.swt_expand_item.header_height, @file_lookup_expand_bar_height + @file_explorer_expand_bar_height - @file_lookup_expand_item.swt_expand_item.header_height]
396
+ end
397
+ }
398
+
399
+ on_item_expanded {
400
+ @file_lookup_expand_item.swt_expand_item.height = @file_lookup_expand_item_height if @file_lookup_expand_item_height
401
+ @side_bar_sash_form.weights = [@file_lookup_expand_bar_height, @file_explorer_expand_bar_height]
402
+ }
403
+
276
404
  }
277
- @file_tree = tree(:virtual, :border, :h_scroll, :v_scroll) {
278
- #visible bind(self, 'project_dir.filter') {|f| !f}
279
- items bind(self, :project_dir), tree_properties(children: :children, text: :name)
280
- drag_source(DND::DROP_COPY) {
281
- transfer [TextTransfer.getInstance].to_java(Transfer)
282
- on_drag_set_data { |event|
283
- Gladiator.drag = true
284
- tree = event.widget.getControl
285
- tree_item = tree.getSelection.first
286
- event.data = tree_item.getData.path
287
- }
405
+
406
+ @file_explorer_expand_bar = expand_bar {
407
+ layout_data :fill, :fill, true, true
408
+ font height: 17, style: :bold
409
+ foreground @default_foreground
410
+
411
+ on_swt_show {
412
+ @file_explorer_expand_item.swt_expand_item.height = @file_explorer_expand_bar.size.y - @file_explorer_expand_item.swt_expand_item.header_height
288
413
  }
289
- menu {
290
- @open_menu_item = menu_item {
291
- text 'Open'
292
- on_widget_selected {
293
- project_dir.selected_child_path = extract_tree_item_path(@file_tree.swt_widget.getSelection.first)
294
- }
414
+
415
+ on_swt_Resize(&resize_expand_items)
416
+
417
+ @file_explorer_expand_item = expand_item {
418
+ grid_layout {
419
+ margin_width 0
420
+ margin_height 0
295
421
  }
296
- menu_item(:separator)
297
- menu_item {
298
- text 'Delete'
299
- on_widget_selected {
300
- tree_item = @file_tree.swt_widget.getSelection.first
301
- delete_tree_item(tree_item)
422
+ text 'File Explorer'
423
+ height display.bounds.height
424
+
425
+ @file_tree = tree(:virtual, :border, :h_scroll, :v_scroll) {
426
+ layout_data :fill, :fill, true, true
427
+ #visible bind(self, 'project_dir.filter') {|f| !f}
428
+ items bind(self, :project_dir), tree_properties(children: :children, text: :name)
429
+ foreground @default_foreground
430
+ drag_source(DND::DROP_COPY) {
431
+ transfer [TextTransfer.getInstance].to_java(Transfer)
432
+ on_drag_set_data { |event|
433
+ Gladiator.drag = true
434
+ tree = event.widget.getControl
435
+ tree_item = tree.getSelection.first
436
+ event.data = tree_item.getData.path
437
+ }
302
438
  }
303
- }
304
- menu_item {
305
- text 'Refresh'
306
- on_widget_selected {
307
- project_dir.refresh
439
+ menu {
440
+ @open_menu_item = menu_item {
441
+ text 'Open'
442
+ on_widget_selected {
443
+ project_dir.selected_child_path = extract_tree_item_path(@file_tree.swt_widget.getSelection.first)
444
+ }
445
+ }
446
+ menu_item(:separator)
447
+ menu_item {
448
+ text 'Delete'
449
+ on_widget_selected {
450
+ tree_item = @file_tree.swt_widget.getSelection.first
451
+ delete_tree_item(tree_item)
452
+ }
453
+ }
454
+ menu_item {
455
+ text 'Refresh'
456
+ on_widget_selected {
457
+ project_dir.refresh
458
+ }
459
+ }
460
+ menu_item {
461
+ text 'Rename'
462
+ on_widget_selected {
463
+ rename_selected_tree_item
464
+ }
465
+ }
466
+ menu_item {
467
+ text 'New Directory'
468
+ on_widget_selected {
469
+ add_new_directory_to_selected_tree_item
470
+ }
471
+ }
472
+ menu_item {
473
+ text 'New File'
474
+ on_widget_selected {
475
+ add_new_file_to_selected_tree_item
476
+ }
477
+ }
308
478
  }
309
- }
310
- menu_item {
311
- text 'Rename'
312
- on_widget_selected {
313
- rename_selected_tree_item
479
+ on_swt_menudetect { |event|
480
+ path = extract_tree_item_path(@file_tree.swt_widget.getSelection.first)
481
+ @open_menu_item.swt_widget.setEnabled(!::Dir.exist?(path)) if path
314
482
  }
315
- }
316
- menu_item {
317
- text 'New Directory'
318
- on_widget_selected {
319
- add_new_directory_to_selected_tree_item
483
+ on_mouse_up {
484
+ if Gladiator.drag_and_drop
485
+ Gladiator.drag_and_drop = false
486
+ else
487
+ project_dir.selected_child_path = extract_tree_item_path(@file_tree.swt_widget.getSelection&.first)
488
+ @current_text_editor&.text_widget&.setFocus
489
+ end
320
490
  }
321
- }
322
- menu_item {
323
- text 'New File'
324
- on_widget_selected {
325
- add_new_file_to_selected_tree_item
491
+ on_key_pressed { |key_event|
492
+ if Glimmer::SWT::SWTProxy.include?(key_event.keyCode, :cr)
493
+ project_dir.selected_child_path = extract_tree_item_path(@file_tree.swt_widget.getSelection&.first)
494
+ @current_text_editor&.text_widget&.setFocus
495
+ end
496
+ }
497
+ on_paint_control {
498
+ root_item = @file_tree.swt_widget.getItems.first
499
+ if root_item && !root_item.getExpanded
500
+ root_item.setExpanded(true)
501
+ end
326
502
  }
327
503
  }
328
504
  }
329
- on_swt_menudetect { |event|
330
- path = extract_tree_item_path(@file_tree.swt_widget.getSelection.first)
331
- @open_menu_item.swt_widget.setEnabled(!::Dir.exist?(path)) if path
332
- }
333
- on_mouse_up {
334
- if Gladiator.drag_and_drop
335
- Gladiator.drag_and_drop = false
336
- else
337
- project_dir.selected_child_path = extract_tree_item_path(@file_tree.swt_widget.getSelection&.first)
338
- @current_text_editor&.text_widget&.setFocus
339
- end
340
- }
341
- on_key_pressed { |key_event|
342
- if Glimmer::SWT::SWTProxy.include?(key_event.keyCode, :cr)
343
- project_dir.selected_child_path = extract_tree_item_path(@file_tree.swt_widget.getSelection&.first)
344
- @current_text_editor&.text_widget&.setFocus
505
+
506
+ on_item_collapsed { |event|
507
+ if @file_lookup_expand_item.swt_expand_item.get_expanded
508
+ @file_explorer_expand_item_height = @file_explorer_expand_item.swt_expand_item.height
509
+ @file_explorer_expand_item.swt_expand_item.height = 0
510
+ @file_explorer_expand_bar_height = @file_explorer_expand_bar.swt_widget.size.y
511
+ @file_lookup_expand_bar_height = @file_lookup_expand_bar.swt_widget.size.y
512
+ @side_bar_sash_form.weights = [@file_explorer_expand_bar_height + @file_explorer_expand_bar_height - @file_explorer_expand_item.swt_expand_item.header_height, @file_explorer_expand_item.swt_expand_item.header_height]
345
513
  end
346
514
  }
347
- on_paint_control {
348
- root_item = @file_tree.swt_widget.getItems.first
349
- if root_item && !root_item.getExpanded
350
- root_item.setExpanded(true)
351
- end
515
+
516
+ on_item_expanded {
517
+ @file_explorer_expand_item.swt_expand_item.height = @file_explorer_expand_item_height if @file_explorer_expand_item_height
518
+ @side_bar_sash_form.weights = [@file_lookup_expand_bar_height, @file_explorer_expand_bar_height]
352
519
  }
520
+
353
521
  }
522
+
354
523
  }
355
524
 
356
525
  # TODO see if you could replace some of this with Glimmer DSL/API syntax
@@ -360,120 +529,224 @@ module Glimmer
360
529
  @file_tree_editor.minimumHeight = 20;
361
530
 
362
531
  }
363
- @editor_container = composite {
364
- grid_layout 1, false
532
+
533
+ composite {
534
+ grid_layout(1, false) {
535
+ margin_width 0
536
+ margin_height 0
537
+ }
365
538
  layout_data :fill, :fill, true, true
366
- composite {
367
- grid_layout 3, false
368
-
369
- # row 1
539
+
540
+ @navigation_expand_bar = expand_bar {
541
+ layout_data :fill, :top, true, false
542
+ font height: 17, style: :bold
543
+ foreground @default_foreground
544
+
545
+ @navigation_expand_item = expand_item {
546
+ text 'Navigation'
547
+ height 115
370
548
 
371
- label {
372
- text 'File:'
373
- }
374
-
375
- @file_path_label = styled_text(:none) {
376
- layout_data(:fill, :fill, true, false) {
377
- horizontal_span 2
549
+ grid_layout(5, false) {
550
+ margin_right 5
378
551
  }
379
- background color(:widget_background)
380
- editable false
381
- caret nil
382
- text bind(project_dir, 'selected_child.path')
383
- on_mouse_up {
384
- @file_path_label.swt_widget.selectAll
552
+
553
+ stat_font = {name: 'Consolas', height: OS.mac? ? 15 : 12}
554
+
555
+ # row 1
556
+
557
+ label {
558
+ layout_data(:left, :center, false, false)
559
+ text 'File:'
560
+ foreground @default_foreground
385
561
  }
386
- on_focus_lost {
387
- @file_path_label.swt_widget.setSelection(0, 0)
562
+
563
+ @file_path_label = styled_text(:none) {
564
+ layout_data(:fill, :center, true, false) {
565
+ horizontal_span 2
566
+ }
567
+ background color(:widget_background)
568
+ foreground @default_foreground
569
+ editable false
570
+ caret nil
571
+ text bind(project_dir, 'selected_child.path')
572
+ on_mouse_up {
573
+ @file_path_label.swt_widget.selectAll
574
+ }
575
+ on_focus_lost {
576
+ @file_path_label.swt_widget.setSelection(0, 0)
577
+ }
388
578
  }
389
- }
390
-
391
- # row 2
392
-
393
- label {
394
- text 'Line:'
395
- }
396
- @line_number_text = text {
397
- layout_data(:fill, :fill, true, false) {
398
- minimum_width 400
399
- }
400
- text bind(project_dir, 'selected_child.line_number', on_read: :to_s, on_write: :to_i)
401
- on_key_pressed { |key_event|
402
- if key_event.keyCode == swt(:cr)
403
- @current_text_editor&.text_widget&.setFocus
404
- end
579
+
580
+ label {
581
+ layout_data(:left, :center, false, false)
582
+ text 'Caret Position:'
583
+ foreground @default_foreground
405
584
  }
406
- on_verify_text { |event|
407
- event.doit = !event.text.match(/^\d*$/).to_a.empty?
585
+ label(:right) {
586
+ layout_data(:fill, :center, true, false)
587
+ text bind(project_dir, 'selected_child.caret_position')
588
+ foreground @default_foreground
589
+ font stat_font
408
590
  }
409
- }
410
- label
411
-
412
- # row 3
413
-
414
- label {
415
- text 'Find:'
416
- }
417
- @find_text = text {
418
- layout_data(:fill, :center, true, false) {
419
- minimum_width 400
420
- }
421
- text bind(project_dir, 'selected_child.find_text')
422
- on_key_pressed { |key_event|
423
- if key_event.stateMask == swt(COMMAND_KEY) && key_event.keyCode == swt(:cr)
424
- project_dir.selected_child.case_sensitive = !project_dir.selected_child.case_sensitive
425
- project_dir.selected_child&.find_next
426
- end
427
- if key_event.keyCode == swt(:cr)
428
- project_dir.selected_child&.find_next
429
- end
591
+
592
+ # row 2
593
+
594
+ label {
595
+ layout_data(:left, :center, false, false)
596
+ text 'Line:'
597
+ foreground @default_foreground
430
598
  }
431
- }
432
- composite {
433
- row_layout
434
- button(:check) {
435
- selection bind(project_dir, 'selected_child.case_sensitive')
599
+ @line_number_text = text {
600
+ layout_data(:fill, :center, true, false) {
601
+ minimum_width 400
602
+ }
603
+ text bind(project_dir, 'selected_child.line_number', on_read: :to_s, on_write: :to_i)
604
+ foreground @default_foreground
605
+ font stat_font
436
606
  on_key_pressed { |key_event|
607
+ if key_event.keyCode == swt(:cr)
608
+ @current_text_editor&.text_widget&.setFocus
609
+ end
610
+ }
611
+ on_verify_text { |event|
612
+ event.doit = !event.text.match(/^\d*$/).to_a.empty?
613
+ }
614
+ }
615
+ label # filler
616
+
617
+ label {
618
+ layout_data(:left, :center, false, false)
619
+ text 'Line Position:'
620
+ foreground @default_foreground
621
+ }
622
+ label(:right) {
623
+ layout_data(:fill, :center, true, false)
624
+ text bind(project_dir, 'selected_child.line_position')
625
+ foreground @default_foreground
626
+ font stat_font
627
+ }
628
+
629
+ # row 3
630
+
631
+ label {
632
+ layout_data(:left, :center, false, false)
633
+ text 'Find:'
634
+ foreground @default_foreground
635
+ }
636
+ @find_text = text {
637
+ layout_data(:fill, :center, true, false) {
638
+ minimum_width 400
639
+ }
640
+ text bind(project_dir, 'selected_child.find_text')
641
+ foreground @default_foreground
642
+ font stat_font
643
+ on_key_pressed { |key_event|
644
+ if key_event.stateMask == swt(COMMAND_KEY) && key_event.keyCode == swt(:cr)
645
+ project_dir.selected_child.case_sensitive = !project_dir.selected_child.case_sensitive
646
+ project_dir.selected_child&.find_next
647
+ end
437
648
  if key_event.keyCode == swt(:cr)
438
649
  project_dir.selected_child&.find_next
439
650
  end
440
651
  }
441
652
  }
653
+ composite {
654
+ layout_data(:left, :center, true, false)
655
+ row_layout {
656
+ margin_width 0
657
+ margin_height 0
658
+ }
659
+ button(:check) {
660
+ selection bind(project_dir, 'selected_child.case_sensitive')
661
+ on_key_pressed { |key_event|
662
+ if key_event.keyCode == swt(:cr)
663
+ project_dir.selected_child&.find_next
664
+ end
665
+ }
666
+ }
667
+ label {
668
+ text 'Case-sensitive'
669
+ foreground @default_foreground
670
+ }
671
+ }
672
+
673
+ label {
674
+ layout_data(:left, :center, false, false)
675
+ text 'Selection Count:'
676
+ foreground @default_foreground
677
+ }
678
+ label(:right) {
679
+ layout_data(:fill, :center, true, false)
680
+ text bind(project_dir, 'selected_child.selection_count')
681
+ foreground @default_foreground
682
+ font stat_font
683
+ }
684
+
685
+ # row 4
686
+
442
687
  label {
443
- text 'Case-sensitive'
688
+ layout_data(:left, :center, false, false)
689
+ text 'Replace:'
690
+ foreground @default_foreground
691
+ }
692
+ @replace_text = text {
693
+ layout_data(:fill, :center, true, false) {
694
+ minimum_width 400
695
+ }
696
+ text bind(project_dir, 'selected_child.replace_text')
697
+ foreground @default_foreground
698
+ font stat_font
699
+ on_focus_gained {
700
+ project_dir.selected_child&.ensure_find_next
701
+ }
702
+ on_key_pressed { |key_event|
703
+ if key_event.keyCode == swt(:cr)
704
+ if project_dir.selected_child
705
+ Command.do(project_dir.selected_child, :replace_next!)
706
+ end
707
+ end
708
+ }
709
+ }
710
+ label # filler
711
+ label {
712
+ layout_data(:left, :center, false, false)
713
+ text 'Top Pixel:'
714
+ foreground @default_foreground
715
+ }
716
+ label(:right) {
717
+ layout_data(:fill, :center, true, false)
718
+ text bind(project_dir, 'selected_child.top_pixel')
719
+ foreground @default_foreground
720
+ font stat_font
444
721
  }
445
722
  }
446
-
447
- # row 4
448
-
449
- label {
450
- text 'Replace:'
723
+
724
+ on_item_collapsed {
725
+ @navigation_expand_item_height = @navigation_expand_item.swt_expand_item.height if @navigation_expand_item.swt_expand_item.height > 0
726
+ @navigation_expand_item.swt_expand_item.height = 0
727
+ async_exec {
728
+ body_root.pack_same_size
729
+ }
451
730
  }
452
- @replace_text = text {
453
- layout_data(:fill, :fill, true, false) {
454
- minimum_width 300
455
- }
456
- text bind(project_dir, 'selected_child.replace_text')
457
- on_focus_gained {
458
- project_dir.selected_child&.ensure_find_next
459
- }
460
- on_key_pressed { |key_event|
461
- if key_event.keyCode == swt(:cr)
462
- if project_dir.selected_child
463
- Command.do(project_dir.selected_child, :replace_next!)
464
- end
465
- end
731
+
732
+ on_item_expanded {
733
+ @navigation_expand_item.swt_expand_item.height = @navigation_expand_item_height if @navigation_expand_item_height
734
+ async_exec {
735
+ body_root.pack_same_size
466
736
  }
467
737
  }
468
- label
738
+
469
739
  }
740
+
470
741
  @tab_folder_sash_form = sash_form {
471
742
  layout_data(:fill, :fill, true, true) {
472
- width_hint 640
473
- height_hint 480
743
+ width_hint 768
744
+ height_hint 576
745
+ minimum_width 768
746
+ minimum_height 576
474
747
  }
475
748
  sash_width 10
476
- orientation bind(self, :split_orientation)
749
+ orientation bind(self, :split_orientation) {|value| async_exec { body_root.pack_same_size}; value}
477
750
  @current_tab_folder = tab_folder {
478
751
  drag_source(DND::DROP_COPY) {
479
752
  transfer [TextTransfer.getInstance].to_java(Transfer)
@@ -517,20 +790,77 @@ module Glimmer
517
790
  project_dir.ignore_paths ||= ['packages', 'tmp']
518
791
  open_file_paths1 = @config[:open_file_paths1] || @config[:open_file_paths]
519
792
  open_file_paths2 = @config[:open_file_paths2]
520
- open_file_paths1.to_a.each do |file_path|
521
- project_dir.selected_child_path = file_path
793
+ self.split_orientation = swt(@config[:split_orientation] || :horizontal) rescue swt(:horizontal)
794
+ if @progress_bar_shell.nil?
795
+ @progress_bar_shell = shell(body_root, :title) {
796
+ text 'Gladiator'
797
+ fill_layout(:vertical) {
798
+ margin_width 15
799
+ margin_height 15
800
+ spacing 5
801
+ }
802
+ label(:center) {
803
+ text "Opening Last Open Files"
804
+ font height: 20
805
+ }
806
+ # @progress_bar = progress_bar(:horizontal, :indeterminate)
807
+ }
808
+ async_exec {
809
+ @progress_bar_shell.open
810
+ }
522
811
  end
523
- # TODO replace the next line with one that selects the visible tab
524
- project_dir.selected_child_path = @config[:selected_child_path] if @config[:selected_child_path] && open_file_paths1.to_a.include?(@config[:selected_child_path])
525
- Gladiator.drag = true
526
- open_file_paths2.to_a.each do |file_path|
527
- project_dir.selected_child_path = file_path
812
+ open_file_paths1.to_a.each do |file_path|
813
+ async_exec {
814
+ Gladiator.drag = false
815
+ Gladiator.startup = file_path != open_file_paths1.to_a[-1]
816
+ project_dir.selected_child_path = file_path
817
+ }
528
818
  end
529
819
  # TODO replace the next line with one that selects the visible tab
530
- project_dir.selected_child_path = @config[:selected_child_path] if @config[:selected_child_path] && open_file_paths2.to_a.include?(@config[:selected_child_path])
531
- Gladiator.drag = false
532
- project_dir.selected_child&.caret_position = project_dir.selected_child&.caret_position_for_caret_position_start_of_line(@config[:caret_position].to_i) if @config[:caret_position]
533
- project_dir.selected_child&.top_pixel = @config[:top_pixel].to_i if @config[:top_pixel]
820
+ async_exec {
821
+ # TODO check why this is not working
822
+ if open_file_paths1.to_a.include?(@config[:selected_child_path])
823
+ Gladiator.drag = false
824
+ Gladiator.startup = false
825
+ project_dir.selected_child_path = @config[:selected_child_path] if @config[:selected_child_path]
826
+ project_dir.selected_child&.caret_position = project_dir.selected_child&.caret_position_for_caret_position_start_of_line(@config[:caret_position].to_i) if @config[:caret_position]
827
+ project_dir.selected_child&.top_pixel = @config[:top_pixel].to_i if @config[:top_pixel]
828
+ end
829
+ }
830
+ async_exec {
831
+ open_file_paths2.to_a.each do |file_path|
832
+ async_exec {
833
+ Gladiator.drag = true
834
+ Gladiator.startup = file_path != open_file_paths2.to_a[-1]
835
+ project_dir.selected_child_path = file_path
836
+ }
837
+ end
838
+ # TODO replace the next line with one that selects the visible tab
839
+ async_exec {
840
+ # TODO check why this is not working
841
+ if open_file_paths2.to_a.include?(@config[:selected_child_path])
842
+ Gladiator.drag = true
843
+ Gladiator.startup = false
844
+ project_dir.selected_child_path = @config[:selected_child_path] if @config[:selected_child_path]
845
+ project_dir.selected_child&.caret_position = project_dir.selected_child&.caret_position_for_caret_position_start_of_line(@config[:caret_position].to_i) if @config[:caret_position]
846
+ project_dir.selected_child&.top_pixel = @config[:top_pixel].to_i if @config[:top_pixel]
847
+ end
848
+ }
849
+ async_exec {
850
+ Gladiator.drag = false
851
+ @progress_bar_shell&.close
852
+ @progress_bar_shell = nil
853
+ @loaded_config = true
854
+ }
855
+ }
856
+ async_exec {
857
+ Thread.new {
858
+ all_files = open_file_paths1.to_a + open_file_paths2.to_a
859
+ all_files.each do |file|
860
+ project_dir.find_child_file(file)&.dirty_content
861
+ end
862
+ }
863
+ }
534
864
  else
535
865
  @loaded_config = true
536
866
  end
@@ -546,6 +876,7 @@ module Glimmer
546
876
  open_file_paths2 = tab_folder2&.swt_widget&.items.to_a.map {|i| i.get_data('file_path')}
547
877
  @config = {
548
878
  selected_child_path: child.path,
879
+ split_orientation: split_orientation == swt(:horizontal) ? 'horizontal' : 'vertical',
549
880
  caret_position: child.caret_position,
550
881
  top_pixel: child.top_pixel,
551
882
  shell_width: swt_widget&.getBounds&.width,
@@ -576,8 +907,8 @@ module Glimmer
576
907
  @current_tab_item = @current_tab_folder.swt_widget.getData('selected_tab_item')
577
908
  @current_text_editor = @current_tab_item.swt_tab_item.getData('text_editor')
578
909
  project_dir.selected_child = @current_tab_item.swt_tab_item.getData('file')
579
-
580
- body_root.pack_same_size
910
+
911
+ async_exec { body_root.pack_same_size }
581
912
  end
582
913
  end
583
914
 
@@ -612,17 +943,24 @@ module Glimmer
612
943
  return if tree_item.nil?
613
944
  file = tree_item.getData
614
945
  parent_path = ::File.dirname(file.path)
946
+ if file.is_a?(Gladiator::Dir)
947
+ file_paths = file.all_children.select {|f| f.is_a?(Gladiator::File)}.map(&:path)
948
+ file.remove_all_observers
949
+ else
950
+ file_paths = [file.path]
951
+ end
952
+ file_paths.each do |file_path|
953
+ found_tab_item = find_tab_item(file_path)
954
+ if found_tab_item
955
+ project_dir.selected_child_path_history.delete(found_tab_item.getData('file_path'))
956
+ found_tab_item.getData('proxy')&.dispose
957
+ end
958
+ end
615
959
  file.delete! # TODO consider supporting command undo/redo
616
960
  project_dir.refresh(async: false)
617
961
  parent_tree_item = @file_tree.depth_first_search {|ti| ti.getData.path == parent_path}.first
618
962
  @file_tree.swt_widget.showItem(parent_tree_item)
619
963
  parent_tree_item.setExpanded(true)
620
- # TODO close text editor tab
621
- found_tab_item = find_tab_item(file.path)
622
- if found_tab_item
623
- project_dir.selected_child_path_history.delete(found_tab_item.getData('file_path'))
624
- found_tab_item.getData('proxy')&.dispose
625
- end
626
964
  rescue => e
627
965
  puts e.full_message
628
966
  end
@@ -691,6 +1029,9 @@ module Glimmer
691
1029
  else
692
1030
  selected_tab_item&.getData('text_editor')&.text_widget&.setFocus
693
1031
  end
1032
+ async_exec {
1033
+ @file_tree.swt_widget.showItem(edited_tree_item)
1034
+ }
694
1035
  end
695
1036
  project_dir.resume_refresh
696
1037
  },
@@ -708,8 +1049,9 @@ module Glimmer
708
1049
 
709
1050
  def open_project
710
1051
  selected_directory = directory_dialog.open
711
- @progress_bar_shell = shell(body_root) {
712
- text 'Opening Project'
1052
+ return if selected_directory.nil?
1053
+ @progress_bar_shell = shell(body_root, :title) {
1054
+ text 'Gladiator'
713
1055
  fill_layout(:vertical) {
714
1056
  margin_width 15
715
1057
  margin_height 15
@@ -721,29 +1063,61 @@ module Glimmer
721
1063
  }
722
1064
  # @progress_bar = progress_bar(:horizontal, :indeterminate)
723
1065
  }
724
- Thread.new {
725
- async_exec {
726
- @progress_bar_shell.open
727
- }
1066
+ async_exec {
1067
+ @progress_bar_shell.open
728
1068
  }
729
- Thread.new {
730
- async_exec {
731
- gladiator(project_dir_path: selected_directory) {
732
- on_swt_show {
733
- @progress_bar_shell.close
734
- }
735
- }.open if selected_directory
736
- }
1069
+ async_exec {
1070
+ gladiator(project_dir_path: selected_directory) {
1071
+ on_swt_show {
1072
+ @progress_bar_shell.close
1073
+ @progress_bar_shell = nil
1074
+ }
1075
+ }.open if selected_directory
737
1076
  }
738
1077
  end
739
1078
 
1079
+ def display_about_dialog
1080
+ dialog {
1081
+ grid_layout(2, false) {
1082
+ margin_width 15
1083
+ margin_height 15
1084
+ }
1085
+
1086
+ image ICON
1087
+ text 'About'
1088
+ background :white
1089
+
1090
+ label {
1091
+ layout_data :center, :center, false, false
1092
+ image ICON, height: 260
1093
+ }
1094
+ label {
1095
+ layout_data :fill, :fill, true, true
1096
+ text "Gladiator v#{VERSION}\n\n#{LICENSE}\n\nGladiator icon made by Freepik from www.flaticon.com"
1097
+ background :white
1098
+ }
1099
+ }.open
1100
+ end
1101
+
740
1102
  def handle_display_shortcut(key_event)
741
1103
  if key_event.stateMask == swt(COMMAND_KEY) && extract_char(key_event) == 'f'
742
- if current_text_editor&.text_widget&.getSelectionText && current_text_editor&.text_widget&.getSelectionText&.size.to_i > 0
743
- find_text.swt_widget.setText current_text_editor.text_widget.getSelectionText
1104
+ find_action = lambda do
1105
+ if current_text_editor&.text_widget&.getSelectionText && current_text_editor&.text_widget&.getSelectionText&.size.to_i > 0
1106
+ find_text.swt_widget.setText current_text_editor.text_widget.getSelectionText
1107
+ end
1108
+ find_text.swt_widget.selectAll
1109
+ find_text.swt_widget.setFocus
1110
+ end
1111
+ if @navigation_expand_item.swt_expand_item.get_expanded
1112
+ find_action.call
1113
+ else
1114
+ @navigation_expand_item.swt_expand_item.set_expanded true
1115
+ @navigation_expand_item.swt_expand_item.height = @navigation_expand_item_height if @navigation_expand_item_height
1116
+ async_exec {
1117
+ body_root.pack_same_size
1118
+ }
1119
+ async_exec(&find_action)
744
1120
  end
745
- find_text.swt_widget.selectAll
746
- find_text.swt_widget.setFocus
747
1121
  elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask, COMMAND_KEY, :shift) && extract_char(key_event) == 'c'
748
1122
  Clipboard.copy(project_dir.selected_child.path)
749
1123
  elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask, COMMAND_KEY, :shift) && extract_char(key_event) == 'g'
@@ -780,7 +1154,7 @@ module Glimmer
780
1154
  end
781
1155
  end
782
1156
  elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask, COMMAND_KEY, :shift) && extract_char(key_event) == 'o'
783
- self.split_orientation = split_orientation == swt(:horizontal) ? swt(:vertical) : swt(:horizontal)
1157
+ self.split_orientation = split_pane? && split_orientation == swt(:horizontal) ? swt(:vertical) : swt(:horizontal)
784
1158
  elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask, COMMAND_KEY, :shift) && extract_char(key_event) == ']'
785
1159
  current_tab_folder.swt_widget.setSelection((current_tab_folder.swt_widget.getSelectionIndex() + 1) % current_tab_folder.swt_widget.getItemCount) if current_tab_folder.swt_widget.getItemCount > 0
786
1160
  current_text_editor&.text_widget&.setFocus
@@ -839,12 +1213,34 @@ module Glimmer
839
1213
  elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask, COMMAND_KEY) && extract_char(key_event) == 'g'
840
1214
  project_dir.selected_child.find_next
841
1215
  elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask, COMMAND_KEY) && extract_char(key_event) == 'l'
842
- line_number_text.swt_widget.selectAll
843
- line_number_text.swt_widget.setFocus
1216
+ unless @navigation_expand_item.swt_expand_item.get_expanded
1217
+ @navigation_expand_item.swt_expand_item.set_expanded true
1218
+ @navigation_expand_item.swt_expand_item.height = @navigation_expand_item_height if @navigation_expand_item_height
1219
+ async_exec {
1220
+ body_root.pack_same_size
1221
+ }
1222
+ async_exec {
1223
+ line_number_text.swt_widget.selectAll
1224
+ line_number_text.swt_widget.setFocus
1225
+ }
1226
+ else
1227
+ line_number_text.swt_widget.selectAll
1228
+ line_number_text.swt_widget.setFocus
1229
+ end
844
1230
  elsif key_event.stateMask == swt(COMMAND_KEY) && extract_char(key_event) == 'r'
1231
+ unless @file_lookup_expand_item.swt_expand_item.get_expanded
1232
+ @file_lookup_expand_item.swt_expand_item.set_expanded true
1233
+ @file_lookup_expand_item.swt_expand_item.height = @file_lookup_expand_item_height if @file_lookup_expand_item_height
1234
+ @side_bar_sash_form.weights = [@file_lookup_expand_bar_height, @file_explorer_expand_bar_height]
1235
+ end
845
1236
  filter_text.swt_widget.selectAll
846
1237
  filter_text.swt_widget.setFocus
847
1238
  elsif key_event.stateMask == swt(COMMAND_KEY) && extract_char(key_event) == 't'
1239
+ unless @file_explorer_expand_item.swt_expand_item.get_expanded
1240
+ @file_explorer_expand_item.swt_expand_item.set_expanded true
1241
+ @file_explorer_expand_item.swt_expand_item.height = @file_explorer_expand_item_height if @file_explorer_expand_item_height
1242
+ @side_bar_sash_form.weights = [@file_lookup_expand_bar_height, @file_explorer_expand_bar_height]
1243
+ end
848
1244
  select_tree_item unless rename_in_progress
849
1245
  file_tree.swt_widget.setFocus
850
1246
  elsif key_event.keyCode == swt(:esc)