glimmer-cs-gladiator 0.6.3 → 0.7.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +48 -0
- data/LICENSE.txt +1 -1
- data/README.md +40 -14
- data/VERSION +1 -1
- data/bin/gladiator +22 -1
- data/bin/gladiator-setup +80 -0
- data/bin/glimmer-cs-gladiator +22 -0
- data/glimmer-cs-gladiator.gemspec +19 -9
- data/lib/glimmer-cs-gladiator.rb +1 -0
- data/lib/glimmer-cs-gladiator/launch.rb +6 -0
- data/lib/models/glimmer/gladiator/dir.rb +2 -2
- data/lib/models/glimmer/gladiator/file.rb +5 -10
- data/lib/views/glimmer/gladiator.rb +536 -733
- data/lib/views/glimmer/gladiator/file_explorer_tree.rb +244 -0
- data/lib/views/glimmer/gladiator/file_lookup_list.rb +64 -0
- data/lib/views/glimmer/gladiator/gladiator_menu_bar.rb +181 -0
- data/lib/views/glimmer/gladiator/progress_shell.rb +31 -0
- data/lib/views/glimmer/gladiator/text_editor.rb +27 -4
- metadata +33 -7
- data/bin/gladiator_runner.rb +0 -6
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
# Copyright (c) 2020-2021 Andy Maleh
|
|
2
|
+
#
|
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
|
4
|
+
# a copy of this software and associated documentation files (the
|
|
5
|
+
# "Software"), to deal in the Software without restriction, including
|
|
6
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
|
8
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
|
9
|
+
# the following conditions:
|
|
10
|
+
#
|
|
11
|
+
# The above copyright notice and this permission notice shall be
|
|
12
|
+
# included in all copies or substantial portions of the Software.
|
|
13
|
+
#
|
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
15
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
18
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
19
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
20
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
21
|
+
|
|
1
22
|
require 'fileutils'
|
|
2
23
|
require 'os'
|
|
3
24
|
|
|
@@ -6,6 +27,10 @@ require 'models/glimmer/gladiator/file'
|
|
|
6
27
|
require 'models/glimmer/gladiator/command'
|
|
7
28
|
|
|
8
29
|
require 'views/glimmer/gladiator/text_editor'
|
|
30
|
+
require 'views/glimmer/gladiator/file_lookup_list'
|
|
31
|
+
require 'views/glimmer/gladiator/file_explorer_tree'
|
|
32
|
+
require 'views/glimmer/gladiator/gladiator_menu_bar'
|
|
33
|
+
require 'views/glimmer/gladiator/progress_shell'
|
|
9
34
|
|
|
10
35
|
Clipboard.implementation = Clipboard::Java
|
|
11
36
|
Clipboard.copy(Clipboard.paste) # pre-initialize library to avoid slowdown during use
|
|
@@ -42,7 +67,7 @@ module Glimmer
|
|
|
42
67
|
def split_orientation=(value)
|
|
43
68
|
@split_orientation = value
|
|
44
69
|
save_config
|
|
45
|
-
if @loaded_config && !split_pane?
|
|
70
|
+
if @loaded_config && !split_pane? && !value.nil?
|
|
46
71
|
Gladiator.drag = true
|
|
47
72
|
child_path = project_dir.selected_child_path
|
|
48
73
|
project_dir.selected_child = nil
|
|
@@ -56,9 +81,11 @@ module Glimmer
|
|
|
56
81
|
pane_count = @tab_folder_sash_form&.children&.size
|
|
57
82
|
pane_count && pane_count > 1
|
|
58
83
|
end
|
|
59
|
-
|
|
60
|
-
attr_reader :find_text, :
|
|
61
|
-
attr_accessor :current_tab_item, :current_tab_folder, :current_text_editor
|
|
84
|
+
|
|
85
|
+
attr_reader :find_text, :filter_text, :line_number_text, :split_orientation, :tab_folder_sash_form, :side_bar_sash_form, :file_area_and_editor_area_sash_form
|
|
86
|
+
attr_accessor :current_tab_item, :current_tab_folder, :current_text_editor, :tab_folder1, :tab_folder2, :maximized_pane, :maximized_editor
|
|
87
|
+
alias maximized_pane? maximized_pane
|
|
88
|
+
alias maximized_editor? maximized_editor
|
|
62
89
|
|
|
63
90
|
## Uncomment before_body block to pre-initialize variables to use in body
|
|
64
91
|
#
|
|
@@ -70,6 +97,7 @@ module Glimmer
|
|
|
70
97
|
project_dir.selected_child&.write_raw_dirty_content
|
|
71
98
|
end
|
|
72
99
|
Display.setAppName('Gladiator')
|
|
100
|
+
Display.setAppVersion(VERSION)
|
|
73
101
|
# make sure the display events are only hooked once if multiple gladiators are created
|
|
74
102
|
unless defined?(@@display)
|
|
75
103
|
@@display = display {
|
|
@@ -100,19 +128,19 @@ module Glimmer
|
|
|
100
128
|
#
|
|
101
129
|
after_body {
|
|
102
130
|
observe(project_dir, 'children') do
|
|
103
|
-
select_tree_item unless
|
|
131
|
+
@file_explorer_tree.select_tree_item unless Gladiator.startup
|
|
104
132
|
end
|
|
105
133
|
observe(project_dir, 'selected_child') do |selected_file|
|
|
106
134
|
if selected_file
|
|
107
135
|
if Gladiator.drag && !@tab_folder2
|
|
108
|
-
|
|
109
|
-
async_exec { body_root.pack_same_size}
|
|
136
|
+
self.tab_folder1 = current_tab_folder
|
|
110
137
|
@tab_folder_sash_form.content {
|
|
111
|
-
|
|
138
|
+
self.current_tab_folder = self.tab_folder2 = tab_folder {}
|
|
112
139
|
@current_tab_folder.swt_widget.setData('proxy', @current_tab_folder)
|
|
113
140
|
}
|
|
141
|
+
body_root.pack_same_size
|
|
114
142
|
end
|
|
115
|
-
select_tree_item unless
|
|
143
|
+
@file_explorer_tree.select_tree_item unless Gladiator.startup
|
|
116
144
|
found_tab_item = selected_tab_item
|
|
117
145
|
if found_tab_item
|
|
118
146
|
@current_tab_folder.swt_widget.setSelection(found_tab_item)
|
|
@@ -136,7 +164,7 @@ module Glimmer
|
|
|
136
164
|
@current_text_editor.text_proxy.content {
|
|
137
165
|
on_focus_gained {
|
|
138
166
|
tab_folder = the_text_editor.swt_widget.getParent.getParent
|
|
139
|
-
|
|
167
|
+
self.current_tab_folder = tab_folder.getData('proxy')
|
|
140
168
|
@current_tab_item = the_tab_item
|
|
141
169
|
@current_text_editor = the_text_editor
|
|
142
170
|
@current_tab_folder.swt_widget.setData('selected_tab_item', @current_tab_item)
|
|
@@ -149,13 +177,11 @@ module Glimmer
|
|
|
149
177
|
on_swt_show {
|
|
150
178
|
@current_tab_item = the_tab_item
|
|
151
179
|
@current_text_editor = the_text_editor
|
|
152
|
-
|
|
180
|
+
self.current_tab_folder = @current_tab_item.swt_widget.getParent.getData('proxy')
|
|
153
181
|
@current_tab_folder.swt_widget.setData('selected_tab_item', @current_tab_item)
|
|
154
182
|
@current_tab_folder.swt_widget.setSelection(@current_tab_item.swt_tab_item)
|
|
155
183
|
project_dir.selected_child = selected_file
|
|
156
|
-
|
|
157
|
-
@current_text_editor&.text_widget&.setFocus
|
|
158
|
-
}
|
|
184
|
+
@current_text_editor&.text_widget&.setFocus
|
|
159
185
|
}
|
|
160
186
|
on_widget_disposed {
|
|
161
187
|
project_dir.selected_child&.write_dirty_content
|
|
@@ -168,13 +194,27 @@ module Glimmer
|
|
|
168
194
|
@current_tab_item.swt_tab_item.setData('proxy', @current_tab_item)
|
|
169
195
|
}
|
|
170
196
|
@current_tab_folder.swt_widget.setSelection(@current_tab_item.swt_tab_item)
|
|
171
|
-
|
|
172
197
|
body_root.pack_same_size
|
|
173
|
-
async_exec { body_root.pack_same_size}
|
|
174
198
|
end
|
|
175
199
|
@current_text_editor&.text_widget&.setFocus
|
|
176
200
|
end
|
|
177
201
|
end
|
|
202
|
+
observe(self, 'maximized_pane') do
|
|
203
|
+
if tab_folder2
|
|
204
|
+
@tab_folder_sash_form.maximized_control = (current_tab_folder.swt_widget if maximized_pane?)
|
|
205
|
+
end
|
|
206
|
+
end
|
|
207
|
+
observe(self, 'maximized_editor') do
|
|
208
|
+
@file_area_and_editor_area_sash_form.maximized_control = (@editor_area_composite.swt_widget if maximized_editor?)
|
|
209
|
+
if !maximized_editor?
|
|
210
|
+
expand_navigation_expand_bar_height
|
|
211
|
+
else
|
|
212
|
+
collapse_navigation_expand_bar_height
|
|
213
|
+
end
|
|
214
|
+
@navigation_expand_item.swt_expand_item.set_expanded !maximized_editor?
|
|
215
|
+
body_root.pack_same_size
|
|
216
|
+
async_exec { body_root.pack_same_size }
|
|
217
|
+
end
|
|
178
218
|
observe(project_dir, 'selected_child') do
|
|
179
219
|
save_config
|
|
180
220
|
end
|
|
@@ -191,581 +231,441 @@ module Glimmer
|
|
|
191
231
|
## Top-most widget must be a shell or another custom shell
|
|
192
232
|
#
|
|
193
233
|
body {
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
on_swt_show {
|
|
202
|
-
swt_widget.setSize(@config[:shell_width], @config[:shell_height]) if @config[:shell_width] && @config[:shell_height]
|
|
203
|
-
swt_widget.setLocation(@config[:shell_x], @config[:shell_y]) if @config[:shell_x] && @config[:shell_y]
|
|
204
|
-
@loaded_config = true
|
|
234
|
+
if !::Dir.glob(::File.join(project_dir_path, 'glimmer-cs-gladiator.jar')).empty?
|
|
235
|
+
shell(:no_trim, :no_background) {
|
|
236
|
+
gladiator_menu_bar(gladiator: self, editing: false)
|
|
237
|
+
|
|
238
|
+
on_swt_show {
|
|
239
|
+
open_project
|
|
240
|
+
}
|
|
205
241
|
}
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
242
|
+
else
|
|
243
|
+
shell {
|
|
244
|
+
text "Gladiator - #{::File.expand_path(project_dir.path)}"
|
|
245
|
+
minimum_size 590, 250
|
|
246
|
+
image ICON
|
|
247
|
+
|
|
248
|
+
on_swt_show {
|
|
249
|
+
unless @shell_visible
|
|
250
|
+
if @config[:shell_width] && @config[:shell_height]
|
|
251
|
+
swt_widget.set_size(@config[:shell_width], @config[:shell_height])
|
|
252
|
+
else
|
|
253
|
+
swt_widget.set_size(display.bounds.width, display.bounds.height)
|
|
254
|
+
end
|
|
255
|
+
end
|
|
256
|
+
swt_widget.setLocation(@config[:shell_x], @config[:shell_y]) if @config[:shell_x] && @config[:shell_y]
|
|
257
|
+
@loaded_config = true
|
|
258
|
+
@shell_visible = true
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
on_shell_closed {
|
|
262
|
+
save_config
|
|
263
|
+
project_dir.selected_child&.write_dirty_content
|
|
264
|
+
if @tab_folder2
|
|
265
|
+
current_tab_folder.swt_widget.getItems.each do |tab_item|
|
|
266
|
+
tab_item.getData('proxy')&.dispose
|
|
267
|
+
end
|
|
268
|
+
close_tab_folder
|
|
269
|
+
end
|
|
211
270
|
current_tab_folder.swt_widget.getItems.each do |tab_item|
|
|
212
271
|
tab_item.getData('proxy')&.dispose
|
|
213
272
|
end
|
|
214
|
-
|
|
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?
|
|
220
|
-
}
|
|
221
|
-
on_widget_disposed {
|
|
222
|
-
project_dir.selected_child&.write_dirty_content
|
|
223
|
-
}
|
|
224
|
-
on_control_resized {
|
|
225
|
-
save_config
|
|
226
|
-
}
|
|
227
|
-
on_control_moved {
|
|
228
|
-
save_config
|
|
229
|
-
}
|
|
230
|
-
on_shell_deactivated {
|
|
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)
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
menu_bar {
|
|
241
|
-
menu {
|
|
242
|
-
text '&File'
|
|
243
|
-
|
|
244
|
-
menu_item {
|
|
245
|
-
text 'New &Scratchpad'
|
|
246
|
-
on_widget_selected {
|
|
247
|
-
begin
|
|
248
|
-
project_dir.selected_child_path = ''
|
|
249
|
-
rescue => e
|
|
250
|
-
puts e.full_message
|
|
251
|
-
end
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
menu_item(:separator)
|
|
255
|
-
menu_item {
|
|
256
|
-
text 'Open &Project...'
|
|
257
|
-
on_widget_selected {
|
|
258
|
-
open_project
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
menu {
|
|
263
|
-
text '&View'
|
|
264
|
-
menu {
|
|
265
|
-
text '&Split'
|
|
266
|
-
menu_item(:radio) {
|
|
267
|
-
text '&Horizontal'
|
|
268
|
-
selection bind(self, :split_orientation,
|
|
269
|
-
on_read: ->(o) { split_pane? && o == swt(:horizontal) },
|
|
270
|
-
on_write: ->(b) { b ? swt(:horizontal) : swt(:vertical) })
|
|
271
|
-
}
|
|
272
|
-
menu_item(:radio) {
|
|
273
|
-
text '&Vertical'
|
|
274
|
-
selection bind(self, :split_orientation,
|
|
275
|
-
on_read: ->(o) { split_pane? && o == swt(:vertical) },
|
|
276
|
-
on_write: ->(b) { b ? swt(:vertical) : swt(:horizontal) })
|
|
277
|
-
}
|
|
278
|
-
}
|
|
273
|
+
body_root.close unless current_tab_folder.swt_widget.getItems.empty?
|
|
279
274
|
}
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
# menu_item {
|
|
283
|
-
# text 'Launch Glimmer &App'
|
|
284
|
-
# on_widget_selected {
|
|
285
|
-
# parent_path = project_dir.path
|
|
286
|
-
## current_directory_name = ::File.basename(parent_path)
|
|
287
|
-
## assumed_shell_script = ::File.join(parent_path, 'bin', current_directory_name)
|
|
288
|
-
## assumed_shell_script = ::Dir.glob(::File.join(parent_path, 'bin', '*')).detect {|f| ::File.file?(f) && !::File.read(f).include?('#!/usr/bin/env')} if !::File.exist?(assumed_shell_script)
|
|
289
|
-
## load assumed_shell_script
|
|
290
|
-
# FileUtils.cd(parent_path) do
|
|
291
|
-
# system 'glimmer run'
|
|
292
|
-
# end
|
|
293
|
-
# }
|
|
294
|
-
# }
|
|
295
|
-
menu_item {
|
|
296
|
-
text '&Ruby'
|
|
297
|
-
on_widget_selected {
|
|
298
|
-
project_dir.selected_child.run
|
|
299
|
-
}
|
|
300
|
-
}
|
|
275
|
+
on_widget_disposed {
|
|
276
|
+
project_dir.selected_child&.write_dirty_content
|
|
301
277
|
}
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
menu_item {
|
|
305
|
-
text '&About'
|
|
306
|
-
on_widget_selected {
|
|
307
|
-
display_about_dialog
|
|
308
|
-
}
|
|
309
|
-
}
|
|
278
|
+
on_control_resized {
|
|
279
|
+
save_config
|
|
310
280
|
}
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
composite {
|
|
314
|
-
grid_layout(1, false) {
|
|
315
|
-
margin_width 0
|
|
316
|
-
margin_height 0
|
|
281
|
+
on_control_moved {
|
|
282
|
+
save_config
|
|
317
283
|
}
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
width_hint 300
|
|
284
|
+
on_shell_deactivated {
|
|
285
|
+
project_dir.selected_child&.write_dirty_content
|
|
321
286
|
}
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
@file_explorer_expand_item&.swt_expand_item&.height = @file_explorer_expand_bar.size.y - @file_explorer_expand_item.swt_expand_item.header_height
|
|
287
|
+
|
|
288
|
+
if OS.mac?
|
|
289
|
+
display.swt_display.system_menu.items.find {|mi| mi.id == swt(:id_quit)}.add_selection_listener {
|
|
290
|
+
save_config
|
|
291
|
+
project_dir.selected_child&.write_dirty_content
|
|
292
|
+
display.swt_display.shells.each(&:close)
|
|
329
293
|
}
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
294
|
+
end
|
|
295
|
+
|
|
296
|
+
# Menu Bar
|
|
297
|
+
gladiator_menu_bar(gladiator: self, editing: true)
|
|
298
|
+
|
|
299
|
+
@file_area_and_editor_area_sash_form = sash_form(:horizontal) {
|
|
300
|
+
weights 1, 5
|
|
301
|
+
|
|
302
|
+
composite {
|
|
303
|
+
grid_layout(1, false) {
|
|
304
|
+
margin_width 0
|
|
305
|
+
margin_height 0
|
|
338
306
|
}
|
|
339
307
|
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
308
|
+
@side_bar_sash_form = sash_form(:vertical) {
|
|
309
|
+
layout_data(:fill, :fill, true, true)
|
|
310
|
+
sash_width 4
|
|
311
|
+
|
|
312
|
+
resize_expand_items = lambda { |event=nil|
|
|
313
|
+
@file_lookup_expand_item&.swt_expand_item&.height = @file_lookup_expand_bar.size.y - @file_lookup_expand_item.swt_expand_item.header_height
|
|
314
|
+
@file_explorer_expand_item&.swt_expand_item&.height = @file_explorer_expand_bar.size.y - @file_explorer_expand_item.swt_expand_item.header_height
|
|
346
315
|
}
|
|
347
|
-
text 'File Lookup'
|
|
348
|
-
height display.bounds.height
|
|
349
316
|
|
|
350
|
-
@
|
|
351
|
-
layout_data :fill, :
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
317
|
+
@file_lookup_expand_bar = expand_bar {
|
|
318
|
+
layout_data :fill, :fill, true, true
|
|
319
|
+
font height: 17, style: :bold
|
|
320
|
+
foreground @default_foreground
|
|
321
|
+
|
|
322
|
+
on_swt_show {
|
|
323
|
+
@file_lookup_expand_item.swt_expand_item.height = @file_lookup_expand_bar.size.y - @file_lookup_expand_item.swt_expand_item.header_height
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
on_swt_Resize(&resize_expand_items)
|
|
327
|
+
|
|
328
|
+
@file_lookup_expand_item = expand_item {
|
|
329
|
+
grid_layout {
|
|
330
|
+
margin_width 0
|
|
331
|
+
margin_height 0
|
|
332
|
+
}
|
|
333
|
+
text 'File Lookup'
|
|
334
|
+
height display.bounds.height
|
|
335
|
+
|
|
336
|
+
@filter_text = text {
|
|
337
|
+
layout_data :fill, :center, true, false
|
|
338
|
+
text bind(project_dir, 'filter')
|
|
339
|
+
on_key_pressed { |key_event|
|
|
340
|
+
if key_event.keyCode == swt(:tab) ||
|
|
341
|
+
key_event.keyCode == swt(:cr) ||
|
|
342
|
+
key_event.keyCode == swt(:arrow_up) ||
|
|
343
|
+
key_event.keyCode == swt(:arrow_down)
|
|
344
|
+
@file_lookup_list.swt_widget.select(0) if @file_lookup_list.swt_widget.getSelectionIndex() == -1
|
|
345
|
+
@file_lookup_list.swt_widget.setFocus
|
|
346
|
+
end
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
@file_lookup_list = file_lookup_list(gladiator: self, foreground_color: @default_foreground) {
|
|
351
|
+
layout_data :fill, :fill, true, true
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
on_item_collapsed { |event|
|
|
356
|
+
if @file_explorer_expand_item.swt_expand_item.get_expanded
|
|
357
|
+
@file_lookup_expand_item_height = @file_lookup_expand_item.swt_expand_item.height
|
|
358
|
+
@file_lookup_expand_item.swt_expand_item.height = 0
|
|
359
|
+
@file_lookup_expand_bar_height = @file_lookup_expand_bar.swt_widget.size.y
|
|
360
|
+
@file_explorer_expand_bar_height = @file_explorer_expand_bar.swt_widget.size.y
|
|
361
|
+
@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]
|
|
360
362
|
end
|
|
361
363
|
}
|
|
364
|
+
|
|
365
|
+
on_item_expanded {
|
|
366
|
+
@file_lookup_expand_item.swt_expand_item.height = @file_lookup_expand_item_height if @file_lookup_expand_item_height
|
|
367
|
+
@side_bar_sash_form.weights = [@file_lookup_expand_bar_height, @file_explorer_expand_bar_height]
|
|
368
|
+
}
|
|
369
|
+
|
|
362
370
|
}
|
|
363
|
-
|
|
364
|
-
@
|
|
371
|
+
|
|
372
|
+
@file_explorer_expand_bar = expand_bar {
|
|
365
373
|
layout_data :fill, :fill, true, true
|
|
366
|
-
|
|
367
|
-
selection bind(project_dir, :filtered_path)
|
|
374
|
+
font height: 17, style: :bold
|
|
368
375
|
foreground @default_foreground
|
|
369
|
-
|
|
370
|
-
|
|
376
|
+
|
|
377
|
+
on_swt_show {
|
|
378
|
+
@file_explorer_expand_item.swt_expand_item.height = @file_explorer_expand_bar.size.y - @file_explorer_expand_item.swt_expand_item.header_height
|
|
371
379
|
}
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
380
|
+
|
|
381
|
+
on_swt_Resize(&resize_expand_items)
|
|
382
|
+
|
|
383
|
+
@file_explorer_expand_item = expand_item {
|
|
384
|
+
grid_layout {
|
|
385
|
+
margin_width 0
|
|
386
|
+
margin_height 0
|
|
387
|
+
}
|
|
388
|
+
text 'File Explorer'
|
|
389
|
+
height display.bounds.height
|
|
390
|
+
|
|
391
|
+
@file_explorer_tree = file_explorer_tree(gladiator: self, foreground_color: @default_foreground) {
|
|
392
|
+
layout_data :fill, :fill, true, true
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
on_item_collapsed { |event|
|
|
397
|
+
if @file_lookup_expand_item.swt_expand_item.get_expanded
|
|
398
|
+
@file_explorer_expand_item_height = @file_explorer_expand_item.swt_expand_item.height
|
|
399
|
+
@file_explorer_expand_item.swt_expand_item.height = 0
|
|
400
|
+
@file_explorer_expand_bar_height = @file_explorer_expand_bar.swt_widget.size.y
|
|
401
|
+
@file_lookup_expand_bar_height = @file_lookup_expand_bar.swt_widget.size.y
|
|
402
|
+
@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]
|
|
376
403
|
end
|
|
377
404
|
}
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
list = event.widget.getControl
|
|
383
|
-
event.data = list.getSelection.first
|
|
384
|
-
}
|
|
405
|
+
|
|
406
|
+
on_item_expanded {
|
|
407
|
+
@file_explorer_expand_item.swt_expand_item.height = @file_explorer_expand_item_height if @file_explorer_expand_item_height
|
|
408
|
+
@side_bar_sash_form.weights = [@file_lookup_expand_bar_height, @file_explorer_expand_bar_height]
|
|
385
409
|
}
|
|
410
|
+
|
|
386
411
|
}
|
|
412
|
+
|
|
387
413
|
}
|
|
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
|
-
|
|
414
|
+
|
|
404
415
|
}
|
|
405
416
|
|
|
406
|
-
@
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
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
|
|
417
|
+
@editor_area_composite = composite {
|
|
418
|
+
grid_layout(1, false) {
|
|
419
|
+
margin_width 0
|
|
420
|
+
margin_height 0
|
|
413
421
|
}
|
|
414
422
|
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
grid_layout {
|
|
419
|
-
margin_width 0
|
|
420
|
-
margin_height 0
|
|
423
|
+
@navigation_expand_bar = expand_bar {
|
|
424
|
+
layout_data(:fill, :top, true, false) {
|
|
425
|
+
minimum_width 480
|
|
421
426
|
}
|
|
422
|
-
|
|
423
|
-
|
|
427
|
+
font height: 17, style: :bold
|
|
428
|
+
foreground @default_foreground
|
|
424
429
|
|
|
425
|
-
@
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
430
|
+
@navigation_expand_item = expand_item {
|
|
431
|
+
text 'Navigation'
|
|
432
|
+
height 115
|
|
433
|
+
|
|
434
|
+
grid_layout(5, false) {
|
|
435
|
+
margin_right 5
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
stat_font = {name: 'Consolas', height: OS.mac? ? 15 : 12}
|
|
439
|
+
|
|
440
|
+
# row 1
|
|
441
|
+
|
|
442
|
+
label {
|
|
443
|
+
layout_data(:left, :center, false, false)
|
|
444
|
+
text 'File:'
|
|
445
|
+
foreground @default_foreground
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
@file_path_label = styled_text(:none) {
|
|
449
|
+
layout_data(:fill, :center, true, false) {
|
|
450
|
+
horizontal_span 2
|
|
451
|
+
}
|
|
452
|
+
background color(:widget_background)
|
|
453
|
+
foreground @default_foreground
|
|
454
|
+
editable false
|
|
455
|
+
caret nil
|
|
456
|
+
text bind(project_dir, 'selected_child.path')
|
|
457
|
+
on_mouse_up {
|
|
458
|
+
@file_path_label.swt_widget.selectAll
|
|
459
|
+
}
|
|
460
|
+
on_focus_lost {
|
|
461
|
+
@file_path_label.swt_widget.setSelection(0, 0)
|
|
437
462
|
}
|
|
438
463
|
}
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
project_dir.selected_child_path = extract_tree_item_path(@file_tree.swt_widget.getSelection.first)
|
|
444
|
-
}
|
|
464
|
+
|
|
465
|
+
label {
|
|
466
|
+
layout_data(:left, :center, false, false) {
|
|
467
|
+
minimum_width 100
|
|
445
468
|
}
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
}
|
|
469
|
+
text 'Caret Position:'
|
|
470
|
+
foreground @default_foreground
|
|
471
|
+
}
|
|
472
|
+
label(:right) {
|
|
473
|
+
layout_data(:fill, :center, true, false) {
|
|
474
|
+
minimum_width 50
|
|
453
475
|
}
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
476
|
+
text bind(project_dir, 'selected_child.caret_position')
|
|
477
|
+
foreground @default_foreground
|
|
478
|
+
font stat_font
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
# row 2
|
|
482
|
+
|
|
483
|
+
label {
|
|
484
|
+
layout_data(:left, :center, false, false)
|
|
485
|
+
text 'Line:'
|
|
486
|
+
foreground @default_foreground
|
|
487
|
+
}
|
|
488
|
+
@line_number_text = text {
|
|
489
|
+
layout_data(:fill, :center, true, false) {
|
|
490
|
+
width_hint 400
|
|
491
|
+
minimum_width 100
|
|
459
492
|
}
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
493
|
+
text bind(project_dir, 'selected_child.line_number', on_read: :to_s, on_write: :to_i)
|
|
494
|
+
foreground @default_foreground
|
|
495
|
+
font stat_font
|
|
496
|
+
on_key_pressed { |key_event|
|
|
497
|
+
if key_event.keyCode == swt(:cr)
|
|
498
|
+
@current_text_editor&.text_widget&.setFocus
|
|
499
|
+
end
|
|
465
500
|
}
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
501
|
+
on_verify_text { |event|
|
|
502
|
+
event.doit = !event.text.match(/^\d*$/).to_a.empty?
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
label # filler
|
|
506
|
+
|
|
507
|
+
label {
|
|
508
|
+
layout_data(:left, :center, false, false) {
|
|
509
|
+
minimum_width 100
|
|
510
|
+
}
|
|
511
|
+
text 'Line Position:'
|
|
512
|
+
foreground @default_foreground
|
|
513
|
+
}
|
|
514
|
+
label(:right) {
|
|
515
|
+
layout_data(:fill, :center, true, false) {
|
|
516
|
+
minimum_width 50
|
|
517
|
+
}
|
|
518
|
+
text bind(project_dir, 'selected_child.line_position')
|
|
519
|
+
foreground @default_foreground
|
|
520
|
+
font stat_font
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
# row 3
|
|
524
|
+
|
|
525
|
+
label {
|
|
526
|
+
layout_data(:left, :center, false, false)
|
|
527
|
+
text 'Find:'
|
|
528
|
+
foreground @default_foreground
|
|
529
|
+
}
|
|
530
|
+
@find_text = text {
|
|
531
|
+
layout_data(:fill, :center, true, false) {
|
|
532
|
+
width_hint 400
|
|
533
|
+
minimum_width 100
|
|
534
|
+
}
|
|
535
|
+
text bind(project_dir, 'selected_child.find_text')
|
|
536
|
+
foreground @default_foreground
|
|
537
|
+
font stat_font
|
|
538
|
+
on_key_pressed { |key_event|
|
|
539
|
+
if key_event.stateMask == swt(COMMAND_KEY) && key_event.keyCode == swt(:cr)
|
|
540
|
+
project_dir.selected_child.case_sensitive = !project_dir.selected_child.case_sensitive
|
|
541
|
+
project_dir.selected_child&.find_next
|
|
542
|
+
end
|
|
543
|
+
if key_event.keyCode == swt(:cr)
|
|
544
|
+
project_dir.selected_child&.find_next
|
|
545
|
+
end
|
|
471
546
|
}
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
547
|
+
}
|
|
548
|
+
composite {
|
|
549
|
+
layout_data(:left, :center, true, false) {
|
|
550
|
+
minimum_width 120
|
|
551
|
+
}
|
|
552
|
+
row_layout {
|
|
553
|
+
margin_width 0
|
|
554
|
+
margin_height 0
|
|
555
|
+
}
|
|
556
|
+
button(:check) {
|
|
557
|
+
selection bind(project_dir, 'selected_child.case_sensitive')
|
|
558
|
+
on_key_pressed { |key_event|
|
|
559
|
+
if key_event.keyCode == swt(:cr)
|
|
560
|
+
project_dir.selected_child&.find_next
|
|
561
|
+
end
|
|
476
562
|
}
|
|
477
563
|
}
|
|
564
|
+
label {
|
|
565
|
+
text 'Case-sensitive'
|
|
566
|
+
foreground @default_foreground
|
|
567
|
+
}
|
|
478
568
|
}
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
569
|
+
|
|
570
|
+
label {
|
|
571
|
+
layout_data(:left, :center, false, false) {
|
|
572
|
+
minimum_width 100
|
|
573
|
+
}
|
|
574
|
+
text 'Selection Count:'
|
|
575
|
+
foreground @default_foreground
|
|
482
576
|
}
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
577
|
+
label(:right) {
|
|
578
|
+
layout_data(:fill, :center, true, false) {
|
|
579
|
+
minimum_width 50
|
|
580
|
+
}
|
|
581
|
+
text bind(project_dir, 'selected_child.selection_count')
|
|
582
|
+
foreground @default_foreground
|
|
583
|
+
font stat_font
|
|
490
584
|
}
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
585
|
+
|
|
586
|
+
# row 4
|
|
587
|
+
|
|
588
|
+
label {
|
|
589
|
+
layout_data(:left, :center, false, false)
|
|
590
|
+
text 'Replace:'
|
|
591
|
+
foreground @default_foreground
|
|
496
592
|
}
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
593
|
+
@replace_text = text {
|
|
594
|
+
layout_data(:fill, :center, true, false) {
|
|
595
|
+
width_hint 400
|
|
596
|
+
minimum_width 100
|
|
597
|
+
}
|
|
598
|
+
text bind(project_dir, 'selected_child.replace_text')
|
|
599
|
+
foreground @default_foreground
|
|
600
|
+
font stat_font
|
|
601
|
+
on_focus_gained {
|
|
602
|
+
project_dir.selected_child&.ensure_find_next
|
|
603
|
+
}
|
|
604
|
+
on_key_pressed { |key_event|
|
|
605
|
+
if key_event.keyCode == swt(:cr)
|
|
606
|
+
if project_dir.selected_child
|
|
607
|
+
Command.do(project_dir.selected_child, :replace_next!)
|
|
608
|
+
end
|
|
609
|
+
end
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
label # filler
|
|
613
|
+
label {
|
|
614
|
+
layout_data(:left, :center, false, false) {
|
|
615
|
+
minimum_width 100
|
|
616
|
+
}
|
|
617
|
+
text 'Top Pixel:'
|
|
618
|
+
foreground @default_foreground
|
|
619
|
+
}
|
|
620
|
+
label(:right) {
|
|
621
|
+
layout_data(:fill, :center, true, false) {
|
|
622
|
+
minimum_width 50
|
|
623
|
+
}
|
|
624
|
+
text bind(project_dir, 'selected_child.top_pixel')
|
|
625
|
+
foreground @default_foreground
|
|
626
|
+
font stat_font
|
|
502
627
|
}
|
|
503
628
|
}
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
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]
|
|
513
|
-
end
|
|
514
|
-
}
|
|
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]
|
|
519
|
-
}
|
|
520
|
-
|
|
521
|
-
}
|
|
522
|
-
|
|
523
|
-
}
|
|
524
|
-
|
|
525
|
-
# TODO see if you could replace some of this with Glimmer DSL/API syntax
|
|
526
|
-
@file_tree_editor = TreeEditor.new(@file_tree.swt_widget);
|
|
527
|
-
@file_tree_editor.horizontalAlignment = swt(:left);
|
|
528
|
-
@file_tree_editor.grabHorizontal = true;
|
|
529
|
-
@file_tree_editor.minimumHeight = 20;
|
|
530
|
-
|
|
531
|
-
}
|
|
532
|
-
|
|
533
|
-
composite {
|
|
534
|
-
grid_layout(1, false) {
|
|
535
|
-
margin_width 0
|
|
536
|
-
margin_height 0
|
|
537
|
-
}
|
|
538
|
-
layout_data :fill, :fill, true, true
|
|
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
|
|
548
|
-
|
|
549
|
-
grid_layout(5, false) {
|
|
550
|
-
margin_right 5
|
|
551
|
-
}
|
|
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
|
|
561
|
-
}
|
|
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)
|
|
629
|
+
|
|
630
|
+
on_item_collapsed {
|
|
631
|
+
collapse_navigation_expand_bar_height
|
|
577
632
|
}
|
|
578
|
-
}
|
|
579
|
-
|
|
580
|
-
label {
|
|
581
|
-
layout_data(:left, :center, false, false)
|
|
582
|
-
text 'Caret Position:'
|
|
583
|
-
foreground @default_foreground
|
|
584
|
-
}
|
|
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
|
|
590
|
-
}
|
|
591
633
|
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
label {
|
|
595
|
-
layout_data(:left, :center, false, false)
|
|
596
|
-
text 'Line:'
|
|
597
|
-
foreground @default_foreground
|
|
598
|
-
}
|
|
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
|
|
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
|
|
648
|
-
if key_event.keyCode == swt(:cr)
|
|
649
|
-
project_dir.selected_child&.find_next
|
|
650
|
-
end
|
|
651
|
-
}
|
|
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
|
|
634
|
+
on_item_expanded {
|
|
635
|
+
expand_navigation_expand_bar_height
|
|
670
636
|
}
|
|
671
|
-
}
|
|
672
637
|
|
|
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
638
|
}
|
|
684
639
|
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
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
|
|
721
|
-
}
|
|
722
|
-
}
|
|
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
|
-
}
|
|
730
|
-
}
|
|
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
|
|
736
|
-
}
|
|
737
|
-
}
|
|
738
|
-
|
|
739
|
-
}
|
|
740
|
-
|
|
741
|
-
@tab_folder_sash_form = sash_form {
|
|
742
|
-
layout_data(:fill, :fill, true, true) {
|
|
743
|
-
width_hint 768
|
|
744
|
-
height_hint 576
|
|
745
|
-
minimum_width 768
|
|
746
|
-
minimum_height 576
|
|
747
|
-
}
|
|
748
|
-
sash_width 10
|
|
749
|
-
orientation bind(self, :split_orientation) {|value| async_exec { body_root.pack_same_size}; value}
|
|
750
|
-
@current_tab_folder = tab_folder {
|
|
751
|
-
drag_source(DND::DROP_COPY) {
|
|
752
|
-
transfer [TextTransfer.getInstance].to_java(Transfer)
|
|
753
|
-
event_data = nil
|
|
754
|
-
on_drag_start {|event|
|
|
755
|
-
Gladiator.drag = true
|
|
756
|
-
tab_folder = event.widget.getControl
|
|
757
|
-
tab_item = tab_folder.getItem(Point.new(event.x, event.y))
|
|
758
|
-
event_data = tab_item.getData('file_path')
|
|
640
|
+
@tab_folder_sash_form = sash_form {
|
|
641
|
+
layout_data(:fill, :fill, true, true) {
|
|
642
|
+
width_hint 768
|
|
643
|
+
height_hint 576
|
|
644
|
+
minimum_width 168
|
|
645
|
+
minimum_height 176
|
|
759
646
|
}
|
|
760
|
-
|
|
761
|
-
|
|
647
|
+
orientation bind(self, :split_orientation) {|value| async_exec { body_root.pack_same_size}; value}
|
|
648
|
+
self.current_tab_folder = self.tab_folder1 = tab_folder {
|
|
649
|
+
drag_source(DND::DROP_COPY) {
|
|
650
|
+
transfer [TextTransfer.getInstance].to_java(Transfer)
|
|
651
|
+
event_data = nil
|
|
652
|
+
on_drag_start {|event|
|
|
653
|
+
Gladiator.drag = true
|
|
654
|
+
tab_folder = event.widget.getControl
|
|
655
|
+
tab_item = tab_folder.getItem(Point.new(event.x, event.y))
|
|
656
|
+
event_data = tab_item.getData('file_path')
|
|
657
|
+
}
|
|
658
|
+
on_drag_set_data { |event|
|
|
659
|
+
event.data = event_data
|
|
660
|
+
}
|
|
661
|
+
}
|
|
762
662
|
}
|
|
663
|
+
@current_tab_folder.swt_widget.setData('proxy', @current_tab_folder)
|
|
763
664
|
}
|
|
764
665
|
}
|
|
765
|
-
|
|
766
|
-
}
|
|
666
|
+
} # end of sash form
|
|
767
667
|
}
|
|
768
|
-
|
|
668
|
+
end
|
|
769
669
|
}
|
|
770
670
|
|
|
771
671
|
def load_config_ignore_paths
|
|
@@ -790,23 +690,11 @@ module Glimmer
|
|
|
790
690
|
project_dir.ignore_paths ||= ['packages', 'tmp']
|
|
791
691
|
open_file_paths1 = @config[:open_file_paths1] || @config[:open_file_paths]
|
|
792
692
|
open_file_paths2 = @config[:open_file_paths2]
|
|
793
|
-
self.split_orientation = swt(@config[:split_orientation]
|
|
794
|
-
if @
|
|
795
|
-
@
|
|
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
|
-
}
|
|
693
|
+
self.split_orientation = (swt(@config[:split_orientation]) rescue swt(:horizontal)) if @config[:split_orientation]
|
|
694
|
+
if @progress_shell.nil?
|
|
695
|
+
@progress_shell = progress_shell(gladiator: self, progress_text: 'Opening Last Open Files')
|
|
808
696
|
async_exec {
|
|
809
|
-
@
|
|
697
|
+
@progress_shell.open
|
|
810
698
|
}
|
|
811
699
|
end
|
|
812
700
|
open_file_paths1.to_a.each do |file_path|
|
|
@@ -848,8 +736,8 @@ module Glimmer
|
|
|
848
736
|
}
|
|
849
737
|
async_exec {
|
|
850
738
|
Gladiator.drag = false
|
|
851
|
-
@
|
|
852
|
-
@
|
|
739
|
+
@progress_shell&.close
|
|
740
|
+
@progress_shell = nil
|
|
853
741
|
@loaded_config = true
|
|
854
742
|
}
|
|
855
743
|
}
|
|
@@ -867,16 +755,17 @@ module Glimmer
|
|
|
867
755
|
end
|
|
868
756
|
|
|
869
757
|
def save_config
|
|
870
|
-
return
|
|
758
|
+
return if !@loaded_config || body_root&.disposed?
|
|
871
759
|
child = project_dir.selected_child
|
|
872
760
|
return if child.nil?
|
|
873
761
|
tab_folder1 = @tab_folder1 || @current_tab_folder
|
|
874
762
|
tab_folder2 = @tab_folder2
|
|
875
763
|
open_file_paths1 = tab_folder1&.swt_widget&.items.to_a.map {|i| i.get_data('file_path')}
|
|
876
764
|
open_file_paths2 = tab_folder2&.swt_widget&.items.to_a.map {|i| i.get_data('file_path')}
|
|
765
|
+
split_orientation_value = split_orientation == swt(:horizontal) ? 'horizontal' : (split_orientation == swt(:vertical) ? 'vertical' : nil)
|
|
877
766
|
@config = {
|
|
878
767
|
selected_child_path: child.path,
|
|
879
|
-
split_orientation:
|
|
768
|
+
split_orientation: split_orientation_value,
|
|
880
769
|
caret_position: child.caret_position,
|
|
881
770
|
top_pixel: child.top_pixel,
|
|
882
771
|
shell_width: swt_widget&.getBounds&.width,
|
|
@@ -892,23 +781,70 @@ module Glimmer
|
|
|
892
781
|
rescue => e
|
|
893
782
|
puts e.full_message
|
|
894
783
|
end
|
|
784
|
+
|
|
785
|
+
def navigate_to_next_tab_folder
|
|
786
|
+
if tab_folder2
|
|
787
|
+
self.maximized_pane = false
|
|
788
|
+
if current_tab_folder == tab_folder1
|
|
789
|
+
self.current_tab_folder = tab_folder2
|
|
790
|
+
else
|
|
791
|
+
self.current_tab_folder = tab_folder1
|
|
792
|
+
end
|
|
793
|
+
self.current_tab_item = current_tab_folder.swt_widget.getData('selected_tab_item')
|
|
794
|
+
self.project_dir.selected_child = current_tab_item&.swt_tab_item&.getData('file')
|
|
795
|
+
self.current_tab_item = current_tab_folder.swt_widget.getData('selected_tab_item')
|
|
796
|
+
current_tab_item&.swt_tab_item&.getData('text_editor')&.text_widget&.setFocus
|
|
797
|
+
end
|
|
798
|
+
end
|
|
799
|
+
|
|
800
|
+
def navigate_to_previous_tab_folder
|
|
801
|
+
if tab_folder2
|
|
802
|
+
self.maximized_pane = false
|
|
803
|
+
if current_tab_folder == tab_folder2
|
|
804
|
+
self.current_tab_folder = tab_folder1
|
|
805
|
+
else
|
|
806
|
+
self.current_tab_folder = tab_folder2
|
|
807
|
+
end
|
|
808
|
+
self.current_tab_item = current_tab_folder.swt_widget.getData('selected_tab_item')
|
|
809
|
+
self.project_dir.selected_child = current_tab_item&.swt_tab_item&.getData('file')
|
|
810
|
+
self.current_tab_item = current_tab_folder.swt_widget.getData('selected_tab_item')
|
|
811
|
+
current_tab_item&.swt_tab_item&.getData('text_editor')&.text_widget&.setFocus
|
|
812
|
+
end
|
|
813
|
+
end
|
|
895
814
|
|
|
896
|
-
def
|
|
815
|
+
def close_all_tabs(closing_tab_folder = nil)
|
|
816
|
+
closing_tab_folder ||= current_tab_folder
|
|
817
|
+
closing_tab_folder.swt_widget.getItems.each do |tab_item|
|
|
818
|
+
project_dir.selected_child_path_history.delete(tab_item.getData('file_path'))
|
|
819
|
+
tab_item.getData('proxy')&.dispose
|
|
820
|
+
end
|
|
821
|
+
close_tab_folder(closing_tab_folder)
|
|
822
|
+
if self.current_tab_item.nil?
|
|
823
|
+
filter_text.swt_widget.selectAll
|
|
824
|
+
filter_text.swt_widget.setFocus
|
|
825
|
+
end
|
|
826
|
+
end
|
|
827
|
+
|
|
828
|
+
def close_tab_folder(closing_tab_folder = nil, single_tab: false)
|
|
829
|
+
closing_tab_folder ||= current_tab_folder
|
|
897
830
|
if @tab_folder2 && !selected_tab_item
|
|
898
|
-
if
|
|
831
|
+
if closing_tab_folder == @tab_folder2
|
|
899
832
|
@tab_folder2.swt_widget.dispose
|
|
900
|
-
|
|
833
|
+
self.current_tab_folder = @tab_folder1
|
|
901
834
|
else
|
|
902
835
|
@tab_folder1.swt_widget.dispose
|
|
903
|
-
|
|
836
|
+
self.current_tab_folder = self.tab_folder1 = @tab_folder2
|
|
904
837
|
end
|
|
905
|
-
|
|
838
|
+
self.tab_folder2 = nil
|
|
839
|
+
body_root.pack_same_size
|
|
906
840
|
|
|
907
|
-
@current_tab_item =
|
|
841
|
+
@current_tab_item = current_tab_folder.swt_widget.getData('selected_tab_item')
|
|
908
842
|
@current_text_editor = @current_tab_item.swt_tab_item.getData('text_editor')
|
|
909
843
|
project_dir.selected_child = @current_tab_item.swt_tab_item.getData('file')
|
|
910
|
-
|
|
911
|
-
async_exec {
|
|
844
|
+
@current_text_editor&.text_widget&.setFocus
|
|
845
|
+
async_exec { @current_text_editor&.text_widget&.setFocus }
|
|
846
|
+
elsif !single_tab
|
|
847
|
+
self.current_tab_item = self.current_text_editor = project_dir.selected_child = nil
|
|
912
848
|
end
|
|
913
849
|
end
|
|
914
850
|
|
|
@@ -923,122 +859,18 @@ module Glimmer
|
|
|
923
859
|
def other_tab_items
|
|
924
860
|
@current_tab_folder.swt_widget.getItems.reject { |ti| ti.getData('file_path') == project_dir.selected_child&.path }
|
|
925
861
|
end
|
|
926
|
-
|
|
927
|
-
def
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
project_dir.path
|
|
933
|
-
end
|
|
934
|
-
end
|
|
935
|
-
|
|
936
|
-
def select_tree_item
|
|
937
|
-
return unless project_dir.selected_child&.name
|
|
938
|
-
tree_items_to_select = @file_tree.depth_first_search { |ti| ti.getData.path == project_dir.selected_child.path }
|
|
939
|
-
@file_tree.swt_widget.setSelection(tree_items_to_select)
|
|
940
|
-
end
|
|
941
|
-
|
|
942
|
-
def delete_tree_item(tree_item)
|
|
943
|
-
return if tree_item.nil?
|
|
944
|
-
file = tree_item.getData
|
|
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
|
|
959
|
-
file.delete! # TODO consider supporting command undo/redo
|
|
960
|
-
project_dir.refresh(async: false)
|
|
961
|
-
parent_tree_item = @file_tree.depth_first_search {|ti| ti.getData.path == parent_path}.first
|
|
962
|
-
@file_tree.swt_widget.showItem(parent_tree_item)
|
|
963
|
-
parent_tree_item.setExpanded(true)
|
|
964
|
-
rescue => e
|
|
965
|
-
puts e.full_message
|
|
966
|
-
end
|
|
967
|
-
|
|
968
|
-
def add_new_directory_to_selected_tree_item
|
|
969
|
-
project_dir.pause_refresh
|
|
970
|
-
tree_item = @file_tree.swt_widget.getSelection.first
|
|
971
|
-
directory_path = extract_tree_item_path(tree_item)
|
|
972
|
-
return if directory_path.nil?
|
|
973
|
-
if !::Dir.exist?(directory_path)
|
|
974
|
-
tree_item = tree_item.getParentItem
|
|
975
|
-
directory_path = ::File.dirname(directory_path)
|
|
976
|
-
end
|
|
977
|
-
new_directory_path = ::File.expand_path(::File.join(directory_path, 'new_directory'))
|
|
978
|
-
FileUtils.mkdir_p(new_directory_path)
|
|
979
|
-
project_dir.refresh(async: false, force: true)
|
|
980
|
-
new_tree_item = @file_tree.depth_first_search {|ti| ti.getData.path == new_directory_path}.first
|
|
981
|
-
@file_tree.swt_widget.showItem(new_tree_item)
|
|
982
|
-
rename_tree_item(new_tree_item)
|
|
983
|
-
end
|
|
984
|
-
|
|
985
|
-
def add_new_file_to_selected_tree_item
|
|
986
|
-
project_dir.pause_refresh
|
|
987
|
-
tree_item = @file_tree.swt_widget.getSelection.first
|
|
988
|
-
directory_path = extract_tree_item_path(tree_item)
|
|
989
|
-
if !::Dir.exist?(directory_path)
|
|
990
|
-
tree_item = tree_item.getParentItem
|
|
991
|
-
directory_path = ::File.dirname(directory_path)
|
|
992
|
-
end
|
|
993
|
-
new_file_path = ::File.expand_path(::File.join(directory_path, 'new_file'))
|
|
994
|
-
FileUtils.touch(new_file_path)
|
|
995
|
-
# TODO look into refreshing only the parent directory to avoid slowdown
|
|
996
|
-
project_dir.refresh(async: false, force: true)
|
|
997
|
-
new_tree_item = @file_tree.depth_first_search {|ti| ti.getData.path == new_file_path}.first
|
|
998
|
-
@file_tree.swt_widget.showItem(new_tree_item)
|
|
999
|
-
rename_tree_item(new_tree_item, true)
|
|
1000
|
-
end
|
|
1001
|
-
|
|
1002
|
-
def rename_selected_tree_item
|
|
1003
|
-
project_dir.pause_refresh
|
|
1004
|
-
tree_item = @file_tree.swt_widget.getSelection.first
|
|
1005
|
-
rename_tree_item(tree_item)
|
|
862
|
+
|
|
863
|
+
def collapse_navigation_expand_bar_height
|
|
864
|
+
@navigation_expand_item_height = @navigation_expand_item.swt_expand_item.height if @navigation_expand_item.swt_expand_item.height > 0
|
|
865
|
+
@navigation_expand_item.swt_expand_item.height = 0
|
|
866
|
+
body_root.pack_same_size
|
|
867
|
+
async_exec { body_root.pack_same_size }
|
|
1006
868
|
end
|
|
1007
869
|
|
|
1008
|
-
def
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
found_text_editor = found_tab_item&.getData('text_editor')
|
|
1013
|
-
@file_tree.edit_tree_item(
|
|
1014
|
-
tree_item,
|
|
1015
|
-
after_write: -> (edited_tree_item) {
|
|
1016
|
-
file = edited_tree_item.getData
|
|
1017
|
-
file_path = file.path
|
|
1018
|
-
file.name
|
|
1019
|
-
if new_file
|
|
1020
|
-
project_dir.selected_child_path = file_path
|
|
1021
|
-
else
|
|
1022
|
-
found_text_editor&.file = file
|
|
1023
|
-
found_tab_item&.setData('file', file)
|
|
1024
|
-
found_tab_item&.setData('file_path', file.path)
|
|
1025
|
-
found_tab_item&.setText(file.name)
|
|
1026
|
-
body_root.pack_same_size
|
|
1027
|
-
if current_file
|
|
1028
|
-
project_dir.selected_child_path = file_path
|
|
1029
|
-
else
|
|
1030
|
-
selected_tab_item&.getData('text_editor')&.text_widget&.setFocus
|
|
1031
|
-
end
|
|
1032
|
-
async_exec {
|
|
1033
|
-
@file_tree.swt_widget.showItem(edited_tree_item)
|
|
1034
|
-
}
|
|
1035
|
-
end
|
|
1036
|
-
project_dir.resume_refresh
|
|
1037
|
-
},
|
|
1038
|
-
after_cancel: -> {
|
|
1039
|
-
project_dir.resume_refresh
|
|
1040
|
-
}
|
|
1041
|
-
)
|
|
870
|
+
def expand_navigation_expand_bar_height
|
|
871
|
+
@navigation_expand_item.swt_expand_item.height = @navigation_expand_item_height || 140
|
|
872
|
+
body_root.pack_same_size
|
|
873
|
+
async_exec { body_root.pack_same_size }
|
|
1042
874
|
end
|
|
1043
875
|
|
|
1044
876
|
def extract_char(event)
|
|
@@ -1050,27 +882,15 @@ module Glimmer
|
|
|
1050
882
|
def open_project
|
|
1051
883
|
selected_directory = directory_dialog.open
|
|
1052
884
|
return if selected_directory.nil?
|
|
1053
|
-
@
|
|
1054
|
-
text 'Gladiator'
|
|
1055
|
-
fill_layout(:vertical) {
|
|
1056
|
-
margin_width 15
|
|
1057
|
-
margin_height 15
|
|
1058
|
-
spacing 5
|
|
1059
|
-
}
|
|
1060
|
-
label(:center) {
|
|
1061
|
-
text "Opening Project: #{::File.basename(selected_directory)}"
|
|
1062
|
-
font height: 20
|
|
1063
|
-
}
|
|
1064
|
-
# @progress_bar = progress_bar(:horizontal, :indeterminate)
|
|
1065
|
-
}
|
|
885
|
+
@progress_shell = progress_shell(gladiator: self, progress_text: "Opening Project: #{::File.basename(selected_directory)}")
|
|
1066
886
|
async_exec {
|
|
1067
|
-
@
|
|
887
|
+
@progress_shell.open
|
|
1068
888
|
}
|
|
1069
889
|
async_exec {
|
|
1070
890
|
gladiator(project_dir_path: selected_directory) {
|
|
1071
891
|
on_swt_show {
|
|
1072
|
-
@
|
|
1073
|
-
@
|
|
892
|
+
@progress_shell.close
|
|
893
|
+
@progress_shell = nil
|
|
1074
894
|
}
|
|
1075
895
|
}.open if selected_directory
|
|
1076
896
|
}
|
|
@@ -1083,18 +903,19 @@ module Glimmer
|
|
|
1083
903
|
margin_height 15
|
|
1084
904
|
}
|
|
1085
905
|
|
|
906
|
+
background :white
|
|
1086
907
|
image ICON
|
|
1087
908
|
text 'About'
|
|
1088
|
-
background :white
|
|
1089
909
|
|
|
1090
910
|
label {
|
|
1091
911
|
layout_data :center, :center, false, false
|
|
912
|
+
background :white
|
|
1092
913
|
image ICON, height: 260
|
|
1093
914
|
}
|
|
1094
915
|
label {
|
|
1095
916
|
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
917
|
background :white
|
|
918
|
+
text "Gladiator v#{VERSION} (Beta)\n\n#{LICENSE}\n\nGladiator icon made by Freepik from www.flaticon.com"
|
|
1098
919
|
}
|
|
1099
920
|
}.open
|
|
1100
921
|
end
|
|
@@ -1112,29 +933,22 @@ module Glimmer
|
|
|
1112
933
|
find_action.call
|
|
1113
934
|
else
|
|
1114
935
|
@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
936
|
async_exec {
|
|
1117
937
|
body_root.pack_same_size
|
|
938
|
+
find_action.call
|
|
1118
939
|
}
|
|
1119
|
-
async_exec(&find_action)
|
|
1120
940
|
end
|
|
1121
941
|
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask, COMMAND_KEY, :shift) && extract_char(key_event) == 'c'
|
|
1122
942
|
Clipboard.copy(project_dir.selected_child.path)
|
|
1123
943
|
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask, COMMAND_KEY, :shift) && extract_char(key_event) == 'g'
|
|
1124
944
|
project_dir.selected_child.find_previous
|
|
1125
|
-
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask, COMMAND_KEY, :shift) && extract_char(key_event) == '
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
945
|
+
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask, COMMAND_KEY, :shift) && extract_char(key_event) == 'o'
|
|
946
|
+
self.maximized_pane = false
|
|
947
|
+
old_split_orientation = self.split_orientation
|
|
948
|
+
self.split_orientation = split_pane? && split_orientation == swt(:horizontal) ? swt(:vertical) : swt(:horizontal)
|
|
949
|
+
@tab_folder_sash_form.weights = [1, 1] if old_split_orientation.nil?
|
|
1129
950
|
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask, COMMAND_KEY, :shift) && extract_char(key_event) == 'w'
|
|
1130
|
-
|
|
1131
|
-
project_dir.selected_child_path_history.delete(tab_item.getData('file_path'))
|
|
1132
|
-
tab_item.getData('proxy')&.dispose
|
|
1133
|
-
end
|
|
1134
|
-
close_tab_folder
|
|
1135
|
-
self.current_tab_item = self.current_text_editor = project_dir.selected_child = nil
|
|
1136
|
-
filter_text.swt_widget.selectAll
|
|
1137
|
-
filter_text.swt_widget.setFocus
|
|
951
|
+
close_all_tabs
|
|
1138
952
|
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask, COMMAND_KEY, :alt) && extract_char(key_event) == 'w'
|
|
1139
953
|
other_tab_items.each do |tab_item|
|
|
1140
954
|
project_dir.selected_child_path_history.delete(tab_item.getData('file_path'))
|
|
@@ -1144,17 +958,22 @@ module Glimmer
|
|
|
1144
958
|
if selected_tab_item
|
|
1145
959
|
project_dir.selected_child_path_history.delete(project_dir.selected_child.path)
|
|
1146
960
|
selected_tab_item.getData('proxy')&.dispose
|
|
1147
|
-
close_tab_folder
|
|
961
|
+
close_tab_folder(single_tab: true)
|
|
962
|
+
# if self.current_tab_item.nil?
|
|
963
|
+
# filter_text.swt_widget.selectAll
|
|
964
|
+
# filter_text.swt_widget.setFocus
|
|
965
|
+
# else
|
|
966
|
+
# current_text_editor&.text_widget&.setFocus
|
|
967
|
+
# end
|
|
1148
968
|
if selected_tab_item.nil?
|
|
1149
969
|
self.current_tab_item = self.current_text_editor = project_dir.selected_child = nil
|
|
1150
970
|
filter_text.swt_widget.selectAll
|
|
1151
971
|
filter_text.swt_widget.setFocus
|
|
1152
972
|
else
|
|
1153
973
|
current_text_editor&.text_widget&.setFocus
|
|
974
|
+
# async_exec { current_text_editor&.text_widget&.setFocus }
|
|
1154
975
|
end
|
|
1155
976
|
end
|
|
1156
|
-
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask, COMMAND_KEY, :shift) && extract_char(key_event) == 'o'
|
|
1157
|
-
self.split_orientation = split_pane? && split_orientation == swt(:horizontal) ? swt(:vertical) : swt(:horizontal)
|
|
1158
977
|
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask, COMMAND_KEY, :shift) && extract_char(key_event) == ']'
|
|
1159
978
|
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
|
|
1160
979
|
current_text_editor&.text_widget&.setFocus
|
|
@@ -1162,27 +981,9 @@ module Glimmer
|
|
|
1162
981
|
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
|
|
1163
982
|
current_text_editor&.text_widget&.setFocus
|
|
1164
983
|
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask, COMMAND_KEY, :ctrl) && extract_char(key_event) == ']'
|
|
1165
|
-
|
|
1166
|
-
if current_tab_folder == tab_folder1
|
|
1167
|
-
self.current_tab_folder = tab_folder2
|
|
1168
|
-
else
|
|
1169
|
-
self.current_tab_folder = tab_folder1
|
|
1170
|
-
end
|
|
1171
|
-
self.current_tab_item = current_tab_folder.swt_widget.getData('selected_tab_item')
|
|
1172
|
-
self.project_dir.selected_child = current_tab_item&.swt_tab_item&.getData('file')
|
|
1173
|
-
current_tab_item&.swt_tab_item&.getData('text_editor')&.text_widget&.setFocus
|
|
1174
|
-
end
|
|
984
|
+
navigate_to_next_tab_folder
|
|
1175
985
|
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask, COMMAND_KEY, :ctrl) && extract_char(key_event) == '['
|
|
1176
|
-
|
|
1177
|
-
if current_tab_folder == tab_folder2
|
|
1178
|
-
self.current_tab_folder = tab_folder1
|
|
1179
|
-
else
|
|
1180
|
-
self.current_tab_folder = tab_folder2
|
|
1181
|
-
end
|
|
1182
|
-
self.current_tab_item = current_tab_folder.swt_widget.getData('selected_tab_item')
|
|
1183
|
-
self.project_dir.selected_child = current_tab_item&.swt_tab_item&.getData('file')
|
|
1184
|
-
current_tab_item&.swt_tab_item&.getData('text_editor')&.text_widget&.setFocus
|
|
1185
|
-
end
|
|
986
|
+
navigate_to_previous_tab_folder
|
|
1186
987
|
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask, COMMAND_KEY) && extract_char(key_event) == '1'
|
|
1187
988
|
current_tab_folder.swt_widget.setSelection(0) if current_tab_folder.swt_widget.getItemCount >= 1
|
|
1188
989
|
current_text_editor&.text_widget&.setFocus
|
|
@@ -1228,6 +1029,7 @@ module Glimmer
|
|
|
1228
1029
|
line_number_text.swt_widget.setFocus
|
|
1229
1030
|
end
|
|
1230
1031
|
elsif key_event.stateMask == swt(COMMAND_KEY) && extract_char(key_event) == 'r'
|
|
1032
|
+
self.maximized_editor = false
|
|
1231
1033
|
unless @file_lookup_expand_item.swt_expand_item.get_expanded
|
|
1232
1034
|
@file_lookup_expand_item.swt_expand_item.set_expanded true
|
|
1233
1035
|
@file_lookup_expand_item.swt_expand_item.height = @file_lookup_expand_item_height if @file_lookup_expand_item_height
|
|
@@ -1236,13 +1038,14 @@ module Glimmer
|
|
|
1236
1038
|
filter_text.swt_widget.selectAll
|
|
1237
1039
|
filter_text.swt_widget.setFocus
|
|
1238
1040
|
elsif key_event.stateMask == swt(COMMAND_KEY) && extract_char(key_event) == 't'
|
|
1041
|
+
self.maximized_editor = false
|
|
1239
1042
|
unless @file_explorer_expand_item.swt_expand_item.get_expanded
|
|
1240
1043
|
@file_explorer_expand_item.swt_expand_item.set_expanded true
|
|
1241
1044
|
@file_explorer_expand_item.swt_expand_item.height = @file_explorer_expand_item_height if @file_explorer_expand_item_height
|
|
1242
1045
|
@side_bar_sash_form.weights = [@file_lookup_expand_bar_height, @file_explorer_expand_bar_height]
|
|
1243
1046
|
end
|
|
1244
|
-
select_tree_item
|
|
1245
|
-
|
|
1047
|
+
@file_explorer_tree.select_tree_item
|
|
1048
|
+
@file_explorer_tree.swt_widget.setFocus
|
|
1246
1049
|
elsif key_event.keyCode == swt(:esc)
|
|
1247
1050
|
if current_text_editor
|
|
1248
1051
|
project_dir.selected_child_path = current_text_editor.file.path
|