glimmer-cs-gladiator 0.7.0 → 0.8.1
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 +45 -0
- data/LICENSE.txt +20 -20
- data/README.md +60 -14
- data/VERSION +1 -1
- data/bin/gladiator +34 -13
- data/bin/gladiator-setup +80 -0
- data/bin/glimmer-cs-gladiator +22 -0
- data/glimmer-cs-gladiator.gemspec +20 -9
- data/lib/glimmer-cs-gladiator.rb +30 -29
- data/lib/glimmer-cs-gladiator/launch.rb +6 -0
- data/lib/models/glimmer/gladiator/command.rb +112 -112
- data/lib/models/glimmer/gladiator/dir.rb +8 -4
- data/lib/models/glimmer/gladiator/file.rb +662 -599
- data/lib/views/glimmer/gladiator.rb +510 -801
- 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 +189 -0
- data/lib/views/glimmer/gladiator/progress_shell.rb +31 -0
- data/lib/views/glimmer/gladiator/text_editor.rb +40 -19
- metadata +32 -6
- 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
|
@@ -18,6 +43,7 @@ module Glimmer
|
|
18
43
|
APP_ROOT = ::File.expand_path('../../../..', __FILE__)
|
19
44
|
# TODO make sure COMMAND_KEY doesn't clash on Linux/Windows for CMD+CTRL shortcuts
|
20
45
|
COMMAND_KEY = OS.mac? ? :command : :ctrl
|
46
|
+
CONTROL_KEY = OS.mac? ? :ctrl : :alt
|
21
47
|
VERSION = ::File.read(::File.join(APP_ROOT, 'VERSION')).to_s.strip
|
22
48
|
LICENSE = ::File.read(::File.join(APP_ROOT, 'LICENSE.txt')).to_s.strip
|
23
49
|
ICON = ::File.expand_path(::File.join(APP_ROOT, 'images', 'glimmer-cs-gladiator-logo.png'))
|
@@ -57,7 +83,7 @@ module Glimmer
|
|
57
83
|
pane_count && pane_count > 1
|
58
84
|
end
|
59
85
|
|
60
|
-
attr_reader :find_text, :filter_text, :
|
86
|
+
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, :file_explorer_expand_item, :file_explorer_expand_item, :file_lookup_expand_item, :file_explorer_expand_item, :file_lookup_expand_item_height, :file_explorer_expand_item_height
|
61
87
|
attr_accessor :current_tab_item, :current_tab_folder, :current_text_editor, :tab_folder1, :tab_folder2, :maximized_pane, :maximized_editor
|
62
88
|
alias maximized_pane? maximized_pane
|
63
89
|
alias maximized_editor? maximized_editor
|
@@ -72,6 +98,7 @@ module Glimmer
|
|
72
98
|
project_dir.selected_child&.write_raw_dirty_content
|
73
99
|
end
|
74
100
|
Display.setAppName('Gladiator')
|
101
|
+
Display.setAppVersion(VERSION)
|
75
102
|
# make sure the display events are only hooked once if multiple gladiators are created
|
76
103
|
unless defined?(@@display)
|
77
104
|
@@display = display {
|
@@ -79,12 +106,15 @@ module Glimmer
|
|
79
106
|
on_about {
|
80
107
|
display_about_dialog
|
81
108
|
}
|
109
|
+
on_quit {
|
110
|
+
project_dir.selected_child&.write_dirty_content
|
111
|
+
display.swt_display.shells.each(&:close)
|
112
|
+
}
|
82
113
|
on_swt_keydown { |key_event|
|
83
114
|
focused_gladiator = display.focus_control.shell&.get_data('custom_shell')
|
84
115
|
focused_gladiator.handle_display_shortcut(key_event) if !focused_gladiator.nil? && key_event.widget.shell == focused_gladiator&.swt_widget
|
85
116
|
}
|
86
117
|
on_swt_Close {
|
87
|
-
save_config
|
88
118
|
project_dir.selected_child&.write_dirty_content
|
89
119
|
}
|
90
120
|
}
|
@@ -102,73 +132,80 @@ module Glimmer
|
|
102
132
|
#
|
103
133
|
after_body {
|
104
134
|
observe(project_dir, 'children') do
|
105
|
-
select_tree_item unless
|
135
|
+
@file_explorer_tree.select_tree_item unless Gladiator.startup
|
106
136
|
end
|
107
137
|
observe(project_dir, 'selected_child') do |selected_file|
|
108
138
|
if selected_file
|
109
139
|
if Gladiator.drag && !@tab_folder2
|
110
140
|
self.tab_folder1 = current_tab_folder
|
111
141
|
@tab_folder_sash_form.content {
|
112
|
-
self.current_tab_folder = self.tab_folder2 =
|
142
|
+
self.current_tab_folder = self.tab_folder2 = text_editor_group_tab_folder
|
113
143
|
@current_tab_folder.swt_widget.setData('proxy', @current_tab_folder)
|
114
144
|
}
|
115
145
|
body_root.pack_same_size
|
116
146
|
end
|
117
|
-
select_tree_item unless
|
147
|
+
@file_explorer_tree.select_tree_item unless Gladiator.startup
|
118
148
|
found_tab_item = selected_tab_item
|
119
149
|
if found_tab_item
|
120
150
|
@current_tab_folder.swt_widget.setSelection(found_tab_item)
|
121
151
|
@current_tab_item = found_tab_item.getData('proxy')
|
122
152
|
@current_text_editor = found_tab_item.getData('text_editor') unless found_tab_item.getData('text_editor').nil?
|
123
153
|
@current_tab_folder.swt_widget.setData('selected_tab_item', @current_tab_item)
|
124
|
-
|
125
|
-
|
126
|
-
@
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
154
|
+
else
|
155
|
+
begin
|
156
|
+
@current_tab_folder.content {
|
157
|
+
@current_tab_item = tab_item { |the_tab_item|
|
158
|
+
text selected_file.name
|
159
|
+
fill_layout(:horizontal) {
|
160
|
+
margin_width 0
|
161
|
+
margin_height 0
|
162
|
+
}
|
163
|
+
tab_folder = nil
|
164
|
+
the_text_editor = nil
|
165
|
+
the_tab_item.content {
|
166
|
+
@current_text_editor = the_text_editor = text_editor(project_dir: project_dir, file: selected_file) {
|
167
|
+
layout_data :fill, :fill, true, true
|
168
|
+
}
|
169
|
+
@current_tab_folder.swt_widget.setData('selected_tab_item', @current_tab_item)
|
170
|
+
the_tab_item.swt_tab_item.setData('text_editor', @current_text_editor)
|
171
|
+
@current_text_editor.text_proxy.content {
|
172
|
+
on_focus_gained {
|
173
|
+
tab_folder = the_text_editor.swt_widget.getParent.getParent
|
174
|
+
self.current_tab_folder = tab_folder.getData('proxy')
|
175
|
+
@current_tab_item = the_tab_item
|
176
|
+
@current_text_editor = the_text_editor
|
177
|
+
@current_tab_folder.swt_widget.setData('selected_tab_item', @current_tab_item)
|
178
|
+
@current_tab_folder.swt_widget.setSelection(@current_tab_item.swt_tab_item)
|
179
|
+
project_dir.selected_child = @current_tab_item.swt_tab_item.getData('file')
|
180
|
+
}
|
147
181
|
}
|
148
182
|
}
|
183
|
+
on_swt_show {
|
184
|
+
@current_tab_item = the_tab_item
|
185
|
+
@current_text_editor = the_text_editor
|
186
|
+
self.current_tab_folder = @current_tab_item.swt_widget.getParent.getData('proxy')
|
187
|
+
@current_tab_folder.swt_widget.setData('selected_tab_item', @current_tab_item)
|
188
|
+
@current_tab_folder.swt_widget.setSelection(@current_tab_item.swt_tab_item)
|
189
|
+
project_dir.selected_child = selected_file
|
190
|
+
@current_text_editor&.load_content
|
191
|
+
@current_text_editor&.text_widget&.setFocus
|
192
|
+
save_config unless selected_file.nil?
|
193
|
+
}
|
194
|
+
on_widget_disposed {
|
195
|
+
project_dir.selected_child&.write_dirty_content
|
196
|
+
tab_item_file = the_tab_item.swt_tab_item.get_data('file')
|
197
|
+
tab_item_file.close unless [@tab_folder1, @tab_folder2].compact.map(&:items).flatten(1).detect {|ti| ti.get_data('file') == tab_item_file}
|
198
|
+
}
|
149
199
|
}
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
@current_text_editor = the_text_editor
|
154
|
-
self.current_tab_folder = @current_tab_item.swt_widget.getParent.getData('proxy')
|
155
|
-
@current_tab_folder.swt_widget.setData('selected_tab_item', @current_tab_item)
|
156
|
-
@current_tab_folder.swt_widget.setSelection(@current_tab_item.swt_tab_item)
|
157
|
-
project_dir.selected_child = selected_file
|
158
|
-
@current_text_editor&.text_widget&.setFocus
|
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
|
-
}
|
200
|
+
@current_tab_item.swt_tab_item.setData('file_path', selected_file.path)
|
201
|
+
@current_tab_item.swt_tab_item.setData('file', selected_file)
|
202
|
+
@current_tab_item.swt_tab_item.setData('proxy', @current_tab_item)
|
165
203
|
}
|
166
|
-
@
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
body_root.pack_same_size
|
204
|
+
@current_tab_folder.swt_widget.setSelection(@current_tab_item.swt_tab_item)
|
205
|
+
body_root.pack_same_size
|
206
|
+
rescue => e
|
207
|
+
puts e.full_message
|
208
|
+
end
|
172
209
|
end
|
173
210
|
@current_text_editor&.text_widget&.setFocus
|
174
211
|
end
|
@@ -180,8 +217,14 @@ module Glimmer
|
|
180
217
|
end
|
181
218
|
observe(self, 'maximized_editor') do
|
182
219
|
@file_area_and_editor_area_sash_form.maximized_control = (@editor_area_composite.swt_widget if maximized_editor?)
|
220
|
+
if !maximized_editor?
|
221
|
+
expand_navigation_expand_bar_height
|
222
|
+
else
|
223
|
+
collapse_navigation_expand_bar_height
|
224
|
+
end
|
183
225
|
@navigation_expand_item.swt_expand_item.set_expanded !maximized_editor?
|
184
226
|
body_root.pack_same_size
|
227
|
+
async_exec { body_root.pack_same_size }
|
185
228
|
end
|
186
229
|
observe(project_dir, 'selected_child') do
|
187
230
|
save_config
|
@@ -199,640 +242,449 @@ module Glimmer
|
|
199
242
|
## Top-most widget must be a shell or another custom shell
|
200
243
|
#
|
201
244
|
body {
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
swt_widget.setSize(@config[:shell_width], @config[:shell_height]) if @config[:shell_width] && @config[:shell_height]
|
210
|
-
swt_widget.setLocation(@config[:shell_x], @config[:shell_y]) if @config[:shell_x] && @config[:shell_y]
|
211
|
-
@loaded_config = true
|
245
|
+
if !::Dir.glob(::File.join(project_dir_path, 'glimmer-cs-gladiator.jar')).empty?
|
246
|
+
shell(:no_trim, :no_background) {
|
247
|
+
gladiator_menu_bar(gladiator: self, editing: false)
|
248
|
+
|
249
|
+
on_swt_show {
|
250
|
+
open_project
|
251
|
+
}
|
212
252
|
}
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
253
|
+
else
|
254
|
+
shell {
|
255
|
+
text "Gladiator - #{::File.expand_path(project_dir.path)}"
|
256
|
+
minimum_size 590, 250
|
257
|
+
image ICON
|
258
|
+
|
259
|
+
on_swt_show {
|
260
|
+
unless @shell_visible
|
261
|
+
if @config[:shell_width] && @config[:shell_height]
|
262
|
+
swt_widget.set_size(@config[:shell_width], @config[:shell_height])
|
263
|
+
else
|
264
|
+
swt_widget.set_size(display.bounds.width, display.bounds.height)
|
265
|
+
end
|
266
|
+
end
|
267
|
+
swt_widget.setLocation(@config[:shell_x], @config[:shell_y]) if @config[:shell_x] && @config[:shell_y]
|
268
|
+
@loaded_config = true
|
269
|
+
@shell_visible = true
|
270
|
+
}
|
271
|
+
|
272
|
+
on_shell_closed {
|
273
|
+
project_dir.selected_child&.write_dirty_content
|
274
|
+
if @tab_folder2
|
275
|
+
current_tab_folder.swt_widget.getItems.each do |tab_item|
|
276
|
+
tab_item.getData('proxy')&.dispose
|
277
|
+
end
|
278
|
+
close_tab_folder
|
279
|
+
end
|
218
280
|
current_tab_folder.swt_widget.getItems.each do |tab_item|
|
219
281
|
tab_item.getData('proxy')&.dispose
|
220
282
|
end
|
221
|
-
|
222
|
-
end
|
223
|
-
current_tab_folder.swt_widget.getItems.each do |tab_item|
|
224
|
-
tab_item.getData('proxy')&.dispose
|
225
|
-
end
|
226
|
-
body_root.close unless current_tab_folder.swt_widget.getItems.empty?
|
227
|
-
}
|
228
|
-
on_widget_disposed {
|
229
|
-
project_dir.selected_child&.write_dirty_content
|
230
|
-
}
|
231
|
-
on_control_resized {
|
232
|
-
save_config
|
233
|
-
}
|
234
|
-
on_control_moved {
|
235
|
-
save_config
|
236
|
-
}
|
237
|
-
on_shell_deactivated {
|
238
|
-
project_dir.selected_child&.write_dirty_content
|
239
|
-
}
|
240
|
-
|
241
|
-
if OS.mac?
|
242
|
-
display.swt_display.system_menu.items.find {|mi| mi.id == swt(:id_quit)}.add_selection_listener {
|
243
|
-
save_config
|
244
|
-
project_dir.selected_child&.write_dirty_content
|
245
|
-
display.swt_display.shells.each(&:close)
|
283
|
+
body_root.close unless current_tab_folder.swt_widget.getItems.empty?
|
246
284
|
}
|
247
|
-
|
248
|
-
|
249
|
-
menu_bar {
|
250
|
-
menu {
|
251
|
-
text '&File'
|
252
|
-
|
253
|
-
menu_item {
|
254
|
-
text 'New &Scratchpad'
|
255
|
-
accelerator COMMAND_KEY, :shift, :s
|
256
|
-
on_widget_selected {
|
257
|
-
project_dir.selected_child_path = ''
|
258
|
-
}
|
259
|
-
}
|
260
|
-
menu_item {
|
261
|
-
text 'Open &Project...'
|
262
|
-
accelerator COMMAND_KEY, :o
|
263
|
-
on_widget_selected {
|
264
|
-
open_project
|
265
|
-
}
|
266
|
-
}
|
267
|
-
menu_item(:separator)
|
268
|
-
menu_item {
|
269
|
-
text '&Quit Project'
|
270
|
-
accelerator COMMAND_KEY, :alt, :q
|
271
|
-
on_widget_selected {
|
272
|
-
save_config
|
273
|
-
project_dir.selected_child&.write_dirty_content
|
274
|
-
body_root.close
|
275
|
-
}
|
276
|
-
}
|
285
|
+
on_widget_disposed {
|
286
|
+
project_dir.selected_child&.write_dirty_content
|
277
287
|
}
|
278
|
-
|
279
|
-
|
280
|
-
menu {
|
281
|
-
text '&Split Pane'
|
282
|
-
menu { |menu_proxy|
|
283
|
-
text '&Orientation'
|
284
|
-
menu_item(:radio) {
|
285
|
-
text '&Horizontal'
|
286
|
-
selection bind(self, :split_orientation,
|
287
|
-
on_read: ->(o) { split_pane? && o == swt(:horizontal) },
|
288
|
-
on_write: ->(b) { b.nil? ? nil : (b ? swt(:horizontal) : swt(:vertical)) })
|
289
|
-
}
|
290
|
-
menu_item(:radio) {
|
291
|
-
text '&Vertical'
|
292
|
-
selection bind(self, :split_orientation,
|
293
|
-
on_read: ->(o) { split_pane? && o == swt(:vertical) },
|
294
|
-
on_write: ->(b) { b.nil? ? nil : (b ? swt(:vertical) : swt(:horizontal)) })
|
295
|
-
}
|
296
|
-
}
|
297
|
-
menu_item(:check) {
|
298
|
-
text '&Maximize Pane'
|
299
|
-
enabled bind(self, :tab_folder2)
|
300
|
-
accelerator COMMAND_KEY, :shift, :m
|
301
|
-
selection bind(self, :maximized_pane)
|
302
|
-
}
|
303
|
-
menu_item {
|
304
|
-
text 'Reset &Panes'
|
305
|
-
enabled bind(self, :tab_folder2)
|
306
|
-
accelerator COMMAND_KEY, :shift, :p
|
307
|
-
on_widget_selected {
|
308
|
-
if tab_folder2
|
309
|
-
self.maximized_pane = false
|
310
|
-
@tab_folder_sash_form.weights = [1, 1]
|
311
|
-
end
|
312
|
-
}
|
313
|
-
}
|
314
|
-
menu_item {
|
315
|
-
text '&Unsplit'
|
316
|
-
enabled bind(self, :tab_folder2)
|
317
|
-
accelerator COMMAND_KEY, :shift, :u
|
318
|
-
on_widget_selected {
|
319
|
-
if tab_folder2
|
320
|
-
self.maximized_pane = false
|
321
|
-
navigate_to_next_tab_folder if current_tab_folder != tab_folder2
|
322
|
-
close_all_tabs(tab_folder2)
|
323
|
-
self.split_orientation = nil
|
324
|
-
body_root.pack_same_size
|
325
|
-
end
|
326
|
-
}
|
327
|
-
}
|
328
|
-
}
|
329
|
-
menu_item(:check) {
|
330
|
-
text '&Maximize Editor'
|
331
|
-
accelerator COMMAND_KEY, :ctrl, :m
|
332
|
-
selection bind(self, :maximized_editor)
|
333
|
-
}
|
334
|
-
menu_item {
|
335
|
-
text '&Reset All'
|
336
|
-
accelerator COMMAND_KEY, :ctrl, :r
|
337
|
-
on_widget_selected {
|
338
|
-
self.maximized_editor = false
|
339
|
-
@file_area_and_editor_area_sash_form.weights = [1, 5]
|
340
|
-
}
|
341
|
-
}
|
288
|
+
on_control_resized {
|
289
|
+
save_config
|
342
290
|
}
|
343
|
-
|
344
|
-
|
345
|
-
# menu_item {
|
346
|
-
# text 'Launch Glimmer &App'
|
347
|
-
# on_widget_selected {
|
348
|
-
# parent_path = project_dir.path
|
349
|
-
## current_directory_name = ::File.basename(parent_path)
|
350
|
-
## assumed_shell_script = ::File.join(parent_path, 'bin', current_directory_name)
|
351
|
-
## 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)
|
352
|
-
## load assumed_shell_script
|
353
|
-
# FileUtils.cd(parent_path) do
|
354
|
-
# system 'glimmer run'
|
355
|
-
# end
|
356
|
-
# }
|
357
|
-
# }
|
358
|
-
menu_item {
|
359
|
-
text '&Ruby'
|
360
|
-
accelerator COMMAND_KEY, :shift, :r
|
361
|
-
on_widget_selected {
|
362
|
-
begin
|
363
|
-
project_dir.selected_child.run
|
364
|
-
rescue Exception => e
|
365
|
-
dialog {
|
366
|
-
text 'Run - Ruby - Error Encountered!'
|
367
|
-
label {
|
368
|
-
text e.full_message
|
369
|
-
}
|
370
|
-
}.open
|
371
|
-
end
|
372
|
-
}
|
373
|
-
}
|
291
|
+
on_control_moved {
|
292
|
+
save_config
|
374
293
|
}
|
375
|
-
|
376
|
-
|
377
|
-
menu_item {
|
378
|
-
text '&About'
|
379
|
-
accelerator COMMAND_KEY, :shift, :a
|
380
|
-
on_widget_selected {
|
381
|
-
display_about_dialog
|
382
|
-
}
|
383
|
-
}
|
294
|
+
on_shell_deactivated {
|
295
|
+
project_dir.selected_child&.write_dirty_content
|
384
296
|
}
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
@side_bar_sash_form = sash_form(:vertical) {
|
397
|
-
layout_data(:fill, :fill, true, true)
|
398
|
-
sash_width 4
|
399
|
-
|
400
|
-
resize_expand_items = lambda { |event=nil|
|
401
|
-
@file_lookup_expand_item&.swt_expand_item&.height = @file_lookup_expand_bar.size.y - @file_lookup_expand_item.swt_expand_item.header_height
|
402
|
-
@file_explorer_expand_item&.swt_expand_item&.height = @file_explorer_expand_bar.size.y - @file_explorer_expand_item.swt_expand_item.header_height
|
297
|
+
|
298
|
+
# Menu Bar
|
299
|
+
gladiator_menu_bar(gladiator: self, editing: true)
|
300
|
+
|
301
|
+
@file_area_and_editor_area_sash_form = sash_form(:horizontal) {
|
302
|
+
weights 1, 5
|
303
|
+
|
304
|
+
composite {
|
305
|
+
grid_layout(1, false) {
|
306
|
+
margin_width 0
|
307
|
+
margin_height 0
|
403
308
|
}
|
404
309
|
|
405
|
-
@
|
406
|
-
layout_data
|
407
|
-
|
408
|
-
foreground @default_foreground
|
310
|
+
@side_bar_sash_form = sash_form(:vertical) {
|
311
|
+
layout_data(:fill, :fill, true, true)
|
312
|
+
sash_width 4
|
409
313
|
|
410
|
-
|
411
|
-
@file_lookup_expand_item
|
314
|
+
resize_expand_items = lambda { |event=nil|
|
315
|
+
@file_lookup_expand_item&.swt_expand_item&.height = @file_lookup_expand_bar.size.y - @file_lookup_expand_item.swt_expand_item.header_height
|
316
|
+
@file_explorer_expand_item&.swt_expand_item&.height = @file_explorer_expand_bar.size.y - @file_explorer_expand_item.swt_expand_item.header_height
|
412
317
|
}
|
413
318
|
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
319
|
+
@file_lookup_expand_bar = expand_bar {
|
320
|
+
layout_data :fill, :fill, true, true
|
321
|
+
font height: 17, style: :bold
|
322
|
+
foreground @default_foreground
|
323
|
+
|
324
|
+
on_swt_show {
|
325
|
+
@file_lookup_expand_item.swt_expand_item.height = @file_lookup_expand_bar.size.y - @file_lookup_expand_item.swt_expand_item.header_height
|
420
326
|
}
|
421
|
-
text 'File Lookup'
|
422
|
-
height display.bounds.height
|
423
327
|
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
328
|
+
on_swt_Resize(&resize_expand_items)
|
329
|
+
|
330
|
+
@file_lookup_expand_item = expand_item {
|
331
|
+
grid_layout {
|
332
|
+
margin_width 0
|
333
|
+
margin_height 0
|
334
|
+
}
|
335
|
+
text 'File Lookup'
|
336
|
+
height display.bounds.height
|
337
|
+
|
338
|
+
@filter_text = text {
|
339
|
+
layout_data :fill, :center, true, false
|
340
|
+
text bind(project_dir, 'filter')
|
341
|
+
on_key_pressed { |key_event|
|
342
|
+
if key_event.keyCode == swt(:tab) ||
|
343
|
+
key_event.keyCode == swt(:cr) ||
|
344
|
+
key_event.keyCode == swt(:arrow_up) ||
|
345
|
+
key_event.keyCode == swt(:arrow_down)
|
346
|
+
@file_lookup_list.swt_widget.select(0) if @file_lookup_list.swt_widget.getSelectionIndex() == -1
|
347
|
+
@file_lookup_list.swt_widget.setFocus
|
348
|
+
end
|
349
|
+
}
|
435
350
|
}
|
351
|
+
|
352
|
+
@file_lookup_list = file_lookup_list(gladiator: self, foreground_color: @default_foreground) {
|
353
|
+
layout_data :fill, :fill, true, true
|
354
|
+
}
|
355
|
+
}
|
356
|
+
|
357
|
+
on_item_collapsed { |event|
|
358
|
+
if @file_explorer_expand_item.swt_expand_item.get_expanded
|
359
|
+
@file_lookup_expand_item_height = @file_lookup_expand_item.swt_expand_item.height
|
360
|
+
@file_lookup_expand_item.swt_expand_item.height = 0
|
361
|
+
@file_lookup_expand_bar_height = @file_lookup_expand_bar.swt_widget.size.y
|
362
|
+
@file_explorer_expand_bar_height = @file_explorer_expand_bar.swt_widget.size.y
|
363
|
+
@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]
|
364
|
+
end
|
436
365
|
}
|
437
366
|
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
367
|
+
on_item_expanded {
|
368
|
+
@file_lookup_expand_item.swt_expand_item.height = @file_lookup_expand_item_height if @file_lookup_expand_item_height
|
369
|
+
@side_bar_sash_form.weights = [@file_lookup_expand_bar_height, @file_explorer_expand_bar_height]
|
370
|
+
}
|
371
|
+
|
372
|
+
}
|
373
|
+
|
374
|
+
@file_explorer_expand_bar = expand_bar {
|
375
|
+
layout_data :fill, :fill, true, true
|
376
|
+
font height: 17, style: :bold
|
377
|
+
foreground @default_foreground
|
378
|
+
|
379
|
+
on_swt_show {
|
380
|
+
@file_explorer_expand_item.swt_expand_item.height = @file_explorer_expand_bar.size.y - @file_explorer_expand_item.swt_expand_item.header_height
|
381
|
+
}
|
382
|
+
|
383
|
+
on_swt_Resize(&resize_expand_items)
|
384
|
+
|
385
|
+
@file_explorer_expand_item = expand_item {
|
386
|
+
grid_layout {
|
387
|
+
margin_width 0
|
388
|
+
margin_height 0
|
451
389
|
}
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
event.data = list.getSelection.first
|
458
|
-
}
|
390
|
+
text 'File Explorer'
|
391
|
+
height display.bounds.height
|
392
|
+
|
393
|
+
@file_explorer_tree = file_explorer_tree(gladiator: self, foreground_color: @default_foreground) {
|
394
|
+
layout_data :fill, :fill, true, true
|
459
395
|
}
|
460
396
|
}
|
461
|
-
|
397
|
+
|
398
|
+
on_item_collapsed { |event|
|
399
|
+
if @file_lookup_expand_item.swt_expand_item.get_expanded
|
400
|
+
@file_explorer_expand_item_height = @file_explorer_expand_item.swt_expand_item.height
|
401
|
+
@file_explorer_expand_item.swt_expand_item.height = 0
|
402
|
+
@file_explorer_expand_bar_height = @file_explorer_expand_bar.swt_widget.size.y
|
403
|
+
@file_lookup_expand_bar_height = @file_lookup_expand_bar.swt_widget.size.y
|
404
|
+
@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]
|
405
|
+
end
|
406
|
+
}
|
462
407
|
|
463
|
-
|
464
|
-
|
465
|
-
@
|
466
|
-
|
467
|
-
|
468
|
-
@file_explorer_expand_bar_height = @file_explorer_expand_bar.swt_widget.size.y
|
469
|
-
@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]
|
470
|
-
end
|
471
|
-
}
|
472
|
-
|
473
|
-
on_item_expanded {
|
474
|
-
@file_lookup_expand_item.swt_expand_item.height = @file_lookup_expand_item_height if @file_lookup_expand_item_height
|
475
|
-
@side_bar_sash_form.weights = [@file_lookup_expand_bar_height, @file_explorer_expand_bar_height]
|
408
|
+
on_item_expanded {
|
409
|
+
@file_explorer_expand_item.swt_expand_item.height = @file_explorer_expand_item_height if @file_explorer_expand_item_height
|
410
|
+
@side_bar_sash_form.weights = [@file_lookup_expand_bar_height, @file_explorer_expand_bar_height]
|
411
|
+
}
|
412
|
+
|
476
413
|
}
|
477
|
-
|
414
|
+
|
415
|
+
}
|
416
|
+
|
417
|
+
}
|
418
|
+
|
419
|
+
@editor_area_composite = composite {
|
420
|
+
grid_layout(1, false) {
|
421
|
+
margin_width 0
|
422
|
+
margin_height 0
|
478
423
|
}
|
479
424
|
|
480
|
-
@
|
481
|
-
layout_data
|
425
|
+
@navigation_expand_bar = expand_bar {
|
426
|
+
layout_data(:fill, :top, true, false) {
|
427
|
+
minimum_width 480
|
428
|
+
}
|
482
429
|
font height: 17, style: :bold
|
483
430
|
foreground @default_foreground
|
484
431
|
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
@file_explorer_expand_item = expand_item {
|
492
|
-
grid_layout {
|
493
|
-
margin_width 0
|
494
|
-
margin_height 0
|
432
|
+
@navigation_expand_item = expand_item {
|
433
|
+
text 'Navigation'
|
434
|
+
height 115
|
435
|
+
|
436
|
+
grid_layout(5, false) {
|
437
|
+
margin_right 5
|
495
438
|
}
|
496
|
-
text 'File Explorer'
|
497
|
-
height display.bounds.height
|
498
439
|
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
440
|
+
stat_font = {name: 'Consolas', height: OS.mac? ? 15 : 12}
|
441
|
+
|
442
|
+
# row 1
|
443
|
+
|
444
|
+
label {
|
445
|
+
layout_data(:left, :center, false, false)
|
446
|
+
text 'File:'
|
503
447
|
foreground @default_foreground
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
tree_item = tree.getSelection.first
|
510
|
-
event.data = tree_item.getData.path
|
511
|
-
}
|
448
|
+
}
|
449
|
+
|
450
|
+
@file_path_label = styled_text(:none) {
|
451
|
+
layout_data(:fill, :center, true, false) {
|
452
|
+
horizontal_span 2
|
512
453
|
}
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
menu_item(:separator)
|
521
|
-
menu_item {
|
522
|
-
text 'Delete'
|
523
|
-
on_widget_selected {
|
524
|
-
tree_item = @file_tree.swt_widget.getSelection.first
|
525
|
-
delete_tree_item(tree_item)
|
526
|
-
}
|
527
|
-
}
|
528
|
-
menu_item {
|
529
|
-
text 'Refresh'
|
530
|
-
on_widget_selected {
|
531
|
-
project_dir.refresh
|
532
|
-
}
|
533
|
-
}
|
534
|
-
menu_item {
|
535
|
-
text 'Rename'
|
536
|
-
on_widget_selected {
|
537
|
-
rename_selected_tree_item
|
538
|
-
}
|
539
|
-
}
|
540
|
-
menu_item {
|
541
|
-
text 'New Directory'
|
542
|
-
on_widget_selected {
|
543
|
-
add_new_directory_to_selected_tree_item
|
544
|
-
}
|
545
|
-
}
|
546
|
-
menu_item {
|
547
|
-
text 'New File'
|
548
|
-
on_widget_selected {
|
549
|
-
add_new_file_to_selected_tree_item
|
550
|
-
}
|
551
|
-
}
|
454
|
+
background color(:widget_background)
|
455
|
+
foreground @default_foreground
|
456
|
+
editable false
|
457
|
+
caret nil
|
458
|
+
text bind(project_dir, 'selected_child.path')
|
459
|
+
on_mouse_up {
|
460
|
+
@file_path_label.swt_widget.selectAll
|
552
461
|
}
|
553
|
-
|
554
|
-
|
555
|
-
@open_menu_item.swt_widget.setEnabled(!::Dir.exist?(path)) if path
|
462
|
+
on_focus_lost {
|
463
|
+
@file_path_label.swt_widget.setSelection(0, 0)
|
556
464
|
}
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
465
|
+
}
|
466
|
+
|
467
|
+
label {
|
468
|
+
layout_data(:left, :center, false, false) {
|
469
|
+
minimum_width 100
|
470
|
+
}
|
471
|
+
text 'Caret Position:'
|
472
|
+
foreground @default_foreground
|
473
|
+
}
|
474
|
+
label(:right) {
|
475
|
+
layout_data(:fill, :center, true, false) {
|
476
|
+
minimum_width 50
|
477
|
+
}
|
478
|
+
text bind(project_dir, 'selected_child.caret_position')
|
479
|
+
foreground @default_foreground
|
480
|
+
font stat_font
|
481
|
+
}
|
482
|
+
|
483
|
+
# row 2
|
484
|
+
|
485
|
+
label {
|
486
|
+
layout_data(:left, :center, false, false)
|
487
|
+
text 'Line:'
|
488
|
+
foreground @default_foreground
|
489
|
+
}
|
490
|
+
@line_number_text = text {
|
491
|
+
layout_data(:fill, :center, true, false) {
|
492
|
+
width_hint 400
|
493
|
+
minimum_width 100
|
564
494
|
}
|
495
|
+
text bind(project_dir, 'selected_child.line_number', on_read: :to_s, on_write: :to_i)
|
496
|
+
foreground @default_foreground
|
497
|
+
font stat_font
|
565
498
|
on_key_pressed { |key_event|
|
566
|
-
if
|
567
|
-
project_dir.selected_child_path = extract_tree_item_path(@file_tree.swt_widget.getSelection&.first)
|
499
|
+
if key_event.keyCode == swt(:cr)
|
568
500
|
@current_text_editor&.text_widget&.setFocus
|
569
501
|
end
|
570
502
|
}
|
571
|
-
|
572
|
-
|
573
|
-
if root_item && !root_item.getExpanded
|
574
|
-
root_item.setExpanded(true)
|
575
|
-
end
|
503
|
+
on_verify_text { |event|
|
504
|
+
event.doit = !event.text.match(/^\d*$/).to_a.empty?
|
576
505
|
}
|
577
506
|
}
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
@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]
|
587
|
-
end
|
588
|
-
}
|
589
|
-
|
590
|
-
on_item_expanded {
|
591
|
-
@file_explorer_expand_item.swt_expand_item.height = @file_explorer_expand_item_height if @file_explorer_expand_item_height
|
592
|
-
@side_bar_sash_form.weights = [@file_lookup_expand_bar_height, @file_explorer_expand_bar_height]
|
593
|
-
}
|
594
|
-
|
595
|
-
}
|
596
|
-
|
597
|
-
}
|
598
|
-
|
599
|
-
# TODO see if you could replace some of this with Glimmer DSL/API syntax
|
600
|
-
@file_tree_editor = TreeEditor.new(@file_tree.swt_widget);
|
601
|
-
@file_tree_editor.horizontalAlignment = swt(:left);
|
602
|
-
@file_tree_editor.grabHorizontal = true;
|
603
|
-
@file_tree_editor.minimumHeight = 20;
|
604
|
-
|
605
|
-
}
|
606
|
-
|
607
|
-
@editor_area_composite = composite {
|
608
|
-
grid_layout(1, false) {
|
609
|
-
margin_width 0
|
610
|
-
margin_height 0
|
611
|
-
}
|
612
|
-
|
613
|
-
@navigation_expand_bar = expand_bar {
|
614
|
-
layout_data :fill, :top, true, false
|
615
|
-
font height: 17, style: :bold
|
616
|
-
foreground @default_foreground
|
617
|
-
|
618
|
-
@navigation_expand_item = expand_item {
|
619
|
-
text 'Navigation'
|
620
|
-
height 115
|
621
|
-
|
622
|
-
grid_layout(5, false) {
|
623
|
-
margin_right 5
|
624
|
-
}
|
625
|
-
|
626
|
-
stat_font = {name: 'Consolas', height: OS.mac? ? 15 : 12}
|
627
|
-
|
628
|
-
# row 1
|
629
|
-
|
630
|
-
label {
|
631
|
-
layout_data(:left, :center, false, false)
|
632
|
-
text 'File:'
|
633
|
-
foreground @default_foreground
|
634
|
-
}
|
635
|
-
|
636
|
-
@file_path_label = styled_text(:none) {
|
637
|
-
layout_data(:fill, :center, true, false) {
|
638
|
-
horizontal_span 2
|
639
|
-
}
|
640
|
-
background color(:widget_background)
|
641
|
-
foreground @default_foreground
|
642
|
-
editable false
|
643
|
-
caret nil
|
644
|
-
text bind(project_dir, 'selected_child.path')
|
645
|
-
on_mouse_up {
|
646
|
-
@file_path_label.swt_widget.selectAll
|
507
|
+
label # filler
|
508
|
+
|
509
|
+
label {
|
510
|
+
layout_data(:left, :center, false, false) {
|
511
|
+
minimum_width 100
|
512
|
+
}
|
513
|
+
text 'Line Position:'
|
514
|
+
foreground @default_foreground
|
647
515
|
}
|
648
|
-
|
649
|
-
|
516
|
+
label(:right) {
|
517
|
+
layout_data(:fill, :center, true, false) {
|
518
|
+
minimum_width 50
|
519
|
+
}
|
520
|
+
text bind(project_dir, 'selected_child.line_position')
|
521
|
+
foreground @default_foreground
|
522
|
+
font stat_font
|
650
523
|
}
|
651
|
-
|
652
|
-
|
653
|
-
|
654
|
-
|
655
|
-
|
656
|
-
|
657
|
-
|
658
|
-
label(:right) {
|
659
|
-
layout_data(:fill, :center, true, false)
|
660
|
-
text bind(project_dir, 'selected_child.caret_position')
|
661
|
-
foreground @default_foreground
|
662
|
-
font stat_font
|
663
|
-
}
|
664
|
-
|
665
|
-
# row 2
|
666
|
-
|
667
|
-
label {
|
668
|
-
layout_data(:left, :center, false, false)
|
669
|
-
text 'Line:'
|
670
|
-
foreground @default_foreground
|
671
|
-
}
|
672
|
-
@line_number_text = text {
|
673
|
-
layout_data(:fill, :center, true, false) {
|
674
|
-
minimum_width 400
|
524
|
+
|
525
|
+
# row 3
|
526
|
+
|
527
|
+
label {
|
528
|
+
layout_data(:left, :center, false, false)
|
529
|
+
text 'Find:'
|
530
|
+
foreground @default_foreground
|
675
531
|
}
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
|
532
|
+
@find_text = text {
|
533
|
+
layout_data(:fill, :center, true, false) {
|
534
|
+
width_hint 400
|
535
|
+
minimum_width 100
|
536
|
+
}
|
537
|
+
text bind(project_dir, 'selected_child.find_text')
|
538
|
+
foreground @default_foreground
|
539
|
+
font stat_font
|
540
|
+
on_key_pressed { |key_event|
|
541
|
+
if key_event.stateMask == swt(COMMAND_KEY) && key_event.keyCode == swt(:cr)
|
542
|
+
project_dir.selected_child.case_sensitive = !project_dir.selected_child.case_sensitive
|
543
|
+
project_dir.selected_child&.find_next
|
544
|
+
end
|
545
|
+
if key_event.keyCode == swt(:cr)
|
546
|
+
project_dir.selected_child&.find_next
|
547
|
+
end
|
548
|
+
}
|
683
549
|
}
|
684
|
-
|
685
|
-
|
550
|
+
composite {
|
551
|
+
layout_data(:left, :center, true, false) {
|
552
|
+
minimum_width 120
|
553
|
+
}
|
554
|
+
row_layout {
|
555
|
+
margin_width 0
|
556
|
+
margin_height 0
|
557
|
+
}
|
558
|
+
button(:check) {
|
559
|
+
selection bind(project_dir, 'selected_child.case_sensitive')
|
560
|
+
on_key_pressed { |key_event|
|
561
|
+
if key_event.keyCode == swt(:cr)
|
562
|
+
project_dir.selected_child&.find_next
|
563
|
+
end
|
564
|
+
}
|
565
|
+
}
|
566
|
+
label {
|
567
|
+
text 'Case-sensitive'
|
568
|
+
foreground @default_foreground
|
569
|
+
}
|
686
570
|
}
|
687
|
-
|
688
|
-
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
}
|
695
|
-
label(:right) {
|
696
|
-
layout_data(:fill, :center, true, false)
|
697
|
-
text bind(project_dir, 'selected_child.line_position')
|
698
|
-
foreground @default_foreground
|
699
|
-
font stat_font
|
700
|
-
}
|
701
|
-
|
702
|
-
# row 3
|
703
|
-
|
704
|
-
label {
|
705
|
-
layout_data(:left, :center, false, false)
|
706
|
-
text 'Find:'
|
707
|
-
foreground @default_foreground
|
708
|
-
}
|
709
|
-
@find_text = text {
|
710
|
-
layout_data(:fill, :center, true, false) {
|
711
|
-
minimum_width 400
|
571
|
+
|
572
|
+
label {
|
573
|
+
layout_data(:left, :center, false, false) {
|
574
|
+
minimum_width 100
|
575
|
+
}
|
576
|
+
text 'Selection Count:'
|
577
|
+
foreground @default_foreground
|
712
578
|
}
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
|
718
|
-
|
719
|
-
|
720
|
-
end
|
721
|
-
if key_event.keyCode == swt(:cr)
|
722
|
-
project_dir.selected_child&.find_next
|
723
|
-
end
|
579
|
+
label(:right) {
|
580
|
+
layout_data(:fill, :center, true, false) {
|
581
|
+
minimum_width 50
|
582
|
+
}
|
583
|
+
text bind(project_dir, 'selected_child.selection_count')
|
584
|
+
foreground @default_foreground
|
585
|
+
font stat_font
|
724
586
|
}
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
|
587
|
+
|
588
|
+
# row 4
|
589
|
+
|
590
|
+
label {
|
591
|
+
layout_data(:left, :center, false, false)
|
592
|
+
text 'Replace:'
|
593
|
+
foreground @default_foreground
|
731
594
|
}
|
732
|
-
|
733
|
-
|
595
|
+
@replace_text = text {
|
596
|
+
layout_data(:fill, :center, true, false) {
|
597
|
+
width_hint 400
|
598
|
+
minimum_width 100
|
599
|
+
}
|
600
|
+
text bind(project_dir, 'selected_child.replace_text')
|
601
|
+
foreground @default_foreground
|
602
|
+
font stat_font
|
603
|
+
on_focus_gained {
|
604
|
+
project_dir.selected_child&.ensure_find_next
|
605
|
+
}
|
734
606
|
on_key_pressed { |key_event|
|
735
607
|
if key_event.keyCode == swt(:cr)
|
736
|
-
project_dir.selected_child
|
608
|
+
if project_dir.selected_child
|
609
|
+
Command.do(project_dir.selected_child, :replace_next!)
|
610
|
+
end
|
737
611
|
end
|
738
612
|
}
|
739
613
|
}
|
614
|
+
label # filler
|
740
615
|
label {
|
741
|
-
|
616
|
+
layout_data(:left, :center, false, false) {
|
617
|
+
minimum_width 100
|
618
|
+
}
|
619
|
+
text 'Top Pixel:'
|
742
620
|
foreground @default_foreground
|
743
621
|
}
|
744
|
-
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
|
749
|
-
|
750
|
-
|
751
|
-
label(:right) {
|
752
|
-
layout_data(:fill, :center, true, false)
|
753
|
-
text bind(project_dir, 'selected_child.selection_count')
|
754
|
-
foreground @default_foreground
|
755
|
-
font stat_font
|
756
|
-
}
|
757
|
-
|
758
|
-
# row 4
|
759
|
-
|
760
|
-
label {
|
761
|
-
layout_data(:left, :center, false, false)
|
762
|
-
text 'Replace:'
|
763
|
-
foreground @default_foreground
|
764
|
-
}
|
765
|
-
@replace_text = text {
|
766
|
-
layout_data(:fill, :center, true, false) {
|
767
|
-
minimum_width 400
|
768
|
-
}
|
769
|
-
text bind(project_dir, 'selected_child.replace_text')
|
770
|
-
foreground @default_foreground
|
771
|
-
font stat_font
|
772
|
-
on_focus_gained {
|
773
|
-
project_dir.selected_child&.ensure_find_next
|
774
|
-
}
|
775
|
-
on_key_pressed { |key_event|
|
776
|
-
if key_event.keyCode == swt(:cr)
|
777
|
-
if project_dir.selected_child
|
778
|
-
Command.do(project_dir.selected_child, :replace_next!)
|
779
|
-
end
|
780
|
-
end
|
622
|
+
label(:right) {
|
623
|
+
layout_data(:fill, :center, true, false) {
|
624
|
+
minimum_width 50
|
625
|
+
}
|
626
|
+
text bind(project_dir, 'selected_child.top_pixel')
|
627
|
+
foreground @default_foreground
|
628
|
+
font stat_font
|
781
629
|
}
|
782
630
|
}
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
text 'Top Pixel:'
|
787
|
-
foreground @default_foreground
|
631
|
+
|
632
|
+
on_item_collapsed {
|
633
|
+
collapse_navigation_expand_bar_height
|
788
634
|
}
|
789
|
-
|
790
|
-
|
791
|
-
|
792
|
-
foreground @default_foreground
|
793
|
-
font stat_font
|
635
|
+
|
636
|
+
on_item_expanded {
|
637
|
+
expand_navigation_expand_bar_height
|
794
638
|
}
|
795
|
-
}
|
796
639
|
|
797
|
-
on_item_collapsed {
|
798
|
-
collapse_navigation_expand_bar_height
|
799
640
|
}
|
800
|
-
|
801
|
-
|
802
|
-
|
803
|
-
|
804
|
-
|
805
|
-
|
806
|
-
|
807
|
-
@tab_folder_sash_form = sash_form {
|
808
|
-
layout_data(:fill, :fill, true, true) {
|
809
|
-
width_hint 768
|
810
|
-
height_hint 576
|
811
|
-
minimum_width 768
|
812
|
-
minimum_height 576
|
813
|
-
}
|
814
|
-
orientation bind(self, :split_orientation) {|value| async_exec { body_root.pack_same_size}; value}
|
815
|
-
self.current_tab_folder = self.tab_folder1 = tab_folder {
|
816
|
-
drag_source(DND::DROP_COPY) {
|
817
|
-
transfer [TextTransfer.getInstance].to_java(Transfer)
|
818
|
-
event_data = nil
|
819
|
-
on_drag_start {|event|
|
820
|
-
Gladiator.drag = true
|
821
|
-
tab_folder = event.widget.getControl
|
822
|
-
tab_item = tab_folder.getItem(Point.new(event.x, event.y))
|
823
|
-
event_data = tab_item.getData('file_path')
|
824
|
-
}
|
825
|
-
on_drag_set_data { |event|
|
826
|
-
event.data = event_data
|
827
|
-
}
|
641
|
+
|
642
|
+
@tab_folder_sash_form = sash_form {
|
643
|
+
layout_data(:fill, :fill, true, true) {
|
644
|
+
width_hint 768
|
645
|
+
height_hint 576
|
646
|
+
minimum_width 168
|
647
|
+
minimum_height 176
|
828
648
|
}
|
649
|
+
orientation bind(self, :split_orientation) {|value| async_exec { body_root.pack_same_size}; value}
|
650
|
+
self.current_tab_folder = self.tab_folder1 = text_editor_group_tab_folder
|
651
|
+
@current_tab_folder.swt_widget.setData('proxy', @current_tab_folder) # TODO see if we could get rid of this as it seems redundant
|
829
652
|
}
|
830
|
-
@current_tab_folder.swt_widget.setData('proxy', @current_tab_folder)
|
831
653
|
}
|
654
|
+
} # end of sash form
|
655
|
+
}
|
656
|
+
end
|
657
|
+
}
|
658
|
+
|
659
|
+
def text_editor_group_tab_folder
|
660
|
+
tab_folder { |tab_folder_proxy|
|
661
|
+
on_widget_selected {
|
662
|
+
self.current_tab_folder = tab_folder_proxy
|
663
|
+
selected_file = @current_tab_item&.swt_tab_item&.getData('file')
|
664
|
+
if selected_file
|
665
|
+
project_dir.selected_child = selected_file
|
666
|
+
@current_tab_item = @current_tab_folder.swt_widget.getSelection.first.getData('proxy')
|
667
|
+
@current_tab_folder.swt_widget.setData('selected_tab_item', @current_tab_item) #TODO see if we can get rid of this as it seems redundant
|
668
|
+
@current_text_editor = @current_tab_item.swt_tab_item.getData('text_editor')
|
669
|
+
@current_text_editor&.load_content
|
670
|
+
@current_text_editor&.text_widget&.setFocus
|
671
|
+
end
|
672
|
+
}
|
673
|
+
drag_source(DND::DROP_COPY) {
|
674
|
+
transfer [TextTransfer.getInstance].to_java(Transfer)
|
675
|
+
event_data = nil
|
676
|
+
on_drag_start {|event|
|
677
|
+
Gladiator.drag = true
|
678
|
+
tab_folder = event.widget.getControl
|
679
|
+
tab_item = tab_folder.getItem(Point.new(event.x, event.y))
|
680
|
+
event_data = tab_item.getData('file_path')
|
681
|
+
}
|
682
|
+
on_drag_set_data { |event|
|
683
|
+
event.data = event_data
|
832
684
|
}
|
833
|
-
}
|
685
|
+
}
|
834
686
|
}
|
835
|
-
|
687
|
+
end
|
836
688
|
|
837
689
|
def load_config_ignore_paths
|
838
690
|
# TODO eliminate duplication with load_config
|
@@ -857,22 +709,10 @@ module Glimmer
|
|
857
709
|
open_file_paths1 = @config[:open_file_paths1] || @config[:open_file_paths]
|
858
710
|
open_file_paths2 = @config[:open_file_paths2]
|
859
711
|
self.split_orientation = (swt(@config[:split_orientation]) rescue swt(:horizontal)) if @config[:split_orientation]
|
860
|
-
if @
|
861
|
-
@
|
862
|
-
text 'Gladiator'
|
863
|
-
fill_layout(:vertical) {
|
864
|
-
margin_width 15
|
865
|
-
margin_height 15
|
866
|
-
spacing 5
|
867
|
-
}
|
868
|
-
label(:center) {
|
869
|
-
text "Opening Last Open Files"
|
870
|
-
font height: 20
|
871
|
-
}
|
872
|
-
# @progress_bar = progress_bar(:horizontal, :indeterminate)
|
873
|
-
}
|
712
|
+
if @progress_shell.nil?
|
713
|
+
@progress_shell = progress_shell(gladiator: self, progress_text: 'Opening Last Open Files')
|
874
714
|
async_exec {
|
875
|
-
@
|
715
|
+
@progress_shell.open
|
876
716
|
}
|
877
717
|
end
|
878
718
|
open_file_paths1.to_a.each do |file_path|
|
@@ -914,8 +754,8 @@ module Glimmer
|
|
914
754
|
}
|
915
755
|
async_exec {
|
916
756
|
Gladiator.drag = false
|
917
|
-
@
|
918
|
-
@
|
757
|
+
@progress_shell&.close
|
758
|
+
@progress_shell = nil
|
919
759
|
@loaded_config = true
|
920
760
|
}
|
921
761
|
}
|
@@ -933,16 +773,16 @@ module Glimmer
|
|
933
773
|
end
|
934
774
|
|
935
775
|
def save_config
|
936
|
-
return if !@loaded_config || body_root
|
776
|
+
return if !@loaded_config || body_root&.disposed?
|
937
777
|
child = project_dir.selected_child
|
938
778
|
return if child.nil?
|
939
779
|
tab_folder1 = @tab_folder1 || @current_tab_folder
|
940
780
|
tab_folder2 = @tab_folder2
|
941
|
-
open_file_paths1 = tab_folder1&.swt_widget&.items.to_a.map {|i| i.get_data('file_path')}
|
942
|
-
open_file_paths2 = tab_folder2&.swt_widget&.items.to_a.map {|i| i.get_data('file_path')}
|
781
|
+
open_file_paths1 = tab_folder1&.swt_widget&.items.to_a.map {|i| i.get_data('file_path')}.reject {|path| path.to_s.strip.empty?}
|
782
|
+
open_file_paths2 = tab_folder2&.swt_widget&.items.to_a.map {|i| i.get_data('file_path')}.reject {|path| path.to_s.strip.empty?}
|
943
783
|
split_orientation_value = split_orientation == swt(:horizontal) ? 'horizontal' : (split_orientation == swt(:vertical) ? 'vertical' : nil)
|
944
784
|
@config = {
|
945
|
-
selected_child_path: child.path,
|
785
|
+
selected_child_path: child.nil? ? open_file_paths1&.first&.path : child.path,
|
946
786
|
split_orientation: split_orientation_value,
|
947
787
|
caret_position: child.caret_position,
|
948
788
|
top_pixel: child.top_pixel,
|
@@ -1003,7 +843,7 @@ module Glimmer
|
|
1003
843
|
end
|
1004
844
|
end
|
1005
845
|
|
1006
|
-
def close_tab_folder(closing_tab_folder = nil)
|
846
|
+
def close_tab_folder(closing_tab_folder = nil, single_tab: false)
|
1007
847
|
closing_tab_folder ||= current_tab_folder
|
1008
848
|
if @tab_folder2 && !selected_tab_item
|
1009
849
|
if closing_tab_folder == @tab_folder2
|
@@ -1021,7 +861,7 @@ module Glimmer
|
|
1021
861
|
project_dir.selected_child = @current_tab_item.swt_tab_item.getData('file')
|
1022
862
|
@current_text_editor&.text_widget&.setFocus
|
1023
863
|
async_exec { @current_text_editor&.text_widget&.setFocus }
|
1024
|
-
|
864
|
+
elsif !single_tab
|
1025
865
|
self.current_tab_item = self.current_text_editor = project_dir.selected_child = nil
|
1026
866
|
end
|
1027
867
|
end
|
@@ -1042,136 +882,13 @@ module Glimmer
|
|
1042
882
|
@navigation_expand_item_height = @navigation_expand_item.swt_expand_item.height if @navigation_expand_item.swt_expand_item.height > 0
|
1043
883
|
@navigation_expand_item.swt_expand_item.height = 0
|
1044
884
|
body_root.pack_same_size
|
1045
|
-
async_exec {
|
1046
|
-
body_root.pack_same_size
|
1047
|
-
}
|
885
|
+
async_exec { body_root.pack_same_size }
|
1048
886
|
end
|
1049
887
|
|
1050
888
|
def expand_navigation_expand_bar_height
|
1051
|
-
@navigation_expand_item.swt_expand_item.height = @navigation_expand_item_height
|
889
|
+
@navigation_expand_item.swt_expand_item.height = @navigation_expand_item_height || 140
|
1052
890
|
body_root.pack_same_size
|
1053
|
-
async_exec {
|
1054
|
-
body_root.pack_same_size
|
1055
|
-
}
|
1056
|
-
end
|
1057
|
-
|
1058
|
-
def extract_tree_item_path(tree_item)
|
1059
|
-
return if tree_item.nil?
|
1060
|
-
if tree_item.getParentItem
|
1061
|
-
::File.join(extract_tree_item_path(tree_item.getParentItem), tree_item.getText)
|
1062
|
-
else
|
1063
|
-
project_dir.path
|
1064
|
-
end
|
1065
|
-
end
|
1066
|
-
|
1067
|
-
def select_tree_item
|
1068
|
-
return unless project_dir.selected_child&.name
|
1069
|
-
tree_items_to_select = @file_tree.depth_first_search { |ti| ti.getData.path == project_dir.selected_child.path }
|
1070
|
-
@file_tree.swt_widget.setSelection(tree_items_to_select)
|
1071
|
-
end
|
1072
|
-
|
1073
|
-
def delete_tree_item(tree_item)
|
1074
|
-
return if tree_item.nil?
|
1075
|
-
file = tree_item.getData
|
1076
|
-
parent_path = ::File.dirname(file.path)
|
1077
|
-
if file.is_a?(Gladiator::Dir)
|
1078
|
-
file_paths = file.all_children.select {|f| f.is_a?(Gladiator::File)}.map(&:path)
|
1079
|
-
file.remove_all_observers
|
1080
|
-
else
|
1081
|
-
file_paths = [file.path]
|
1082
|
-
end
|
1083
|
-
file_paths.each do |file_path|
|
1084
|
-
found_tab_item = find_tab_item(file_path)
|
1085
|
-
if found_tab_item
|
1086
|
-
project_dir.selected_child_path_history.delete(found_tab_item.getData('file_path'))
|
1087
|
-
found_tab_item.getData('proxy')&.dispose
|
1088
|
-
end
|
1089
|
-
end
|
1090
|
-
file.delete! # TODO consider supporting command undo/redo
|
1091
|
-
project_dir.refresh(async: false)
|
1092
|
-
parent_tree_item = @file_tree.depth_first_search {|ti| ti.getData.path == parent_path}.first
|
1093
|
-
@file_tree.swt_widget.showItem(parent_tree_item)
|
1094
|
-
parent_tree_item.setExpanded(true)
|
1095
|
-
rescue => e
|
1096
|
-
puts e.full_message
|
1097
|
-
end
|
1098
|
-
|
1099
|
-
def add_new_directory_to_selected_tree_item
|
1100
|
-
project_dir.pause_refresh
|
1101
|
-
tree_item = @file_tree.swt_widget.getSelection.first
|
1102
|
-
directory_path = extract_tree_item_path(tree_item)
|
1103
|
-
return if directory_path.nil?
|
1104
|
-
if !::Dir.exist?(directory_path)
|
1105
|
-
tree_item = tree_item.getParentItem
|
1106
|
-
directory_path = ::File.dirname(directory_path)
|
1107
|
-
end
|
1108
|
-
new_directory_path = ::File.expand_path(::File.join(directory_path, 'new_directory'))
|
1109
|
-
FileUtils.mkdir_p(new_directory_path)
|
1110
|
-
project_dir.refresh(async: false, force: true)
|
1111
|
-
new_tree_item = @file_tree.depth_first_search {|ti| ti.getData.path == new_directory_path}.first
|
1112
|
-
@file_tree.swt_widget.showItem(new_tree_item)
|
1113
|
-
rename_tree_item(new_tree_item)
|
1114
|
-
end
|
1115
|
-
|
1116
|
-
def add_new_file_to_selected_tree_item
|
1117
|
-
project_dir.pause_refresh
|
1118
|
-
tree_item = @file_tree.swt_widget.getSelection.first
|
1119
|
-
directory_path = extract_tree_item_path(tree_item)
|
1120
|
-
if !::Dir.exist?(directory_path)
|
1121
|
-
tree_item = tree_item.getParentItem
|
1122
|
-
directory_path = ::File.dirname(directory_path)
|
1123
|
-
end
|
1124
|
-
new_file_path = ::File.expand_path(::File.join(directory_path, 'new_file'))
|
1125
|
-
FileUtils.touch(new_file_path)
|
1126
|
-
# TODO look into refreshing only the parent directory to avoid slowdown
|
1127
|
-
project_dir.refresh(async: false, force: true)
|
1128
|
-
new_tree_item = @file_tree.depth_first_search {|ti| ti.getData.path == new_file_path}.first
|
1129
|
-
@file_tree.swt_widget.showItem(new_tree_item)
|
1130
|
-
rename_tree_item(new_tree_item, true)
|
1131
|
-
end
|
1132
|
-
|
1133
|
-
def rename_selected_tree_item
|
1134
|
-
project_dir.pause_refresh
|
1135
|
-
tree_item = @file_tree.swt_widget.getSelection.first
|
1136
|
-
rename_tree_item(tree_item)
|
1137
|
-
end
|
1138
|
-
|
1139
|
-
def rename_tree_item(tree_item, new_file = false)
|
1140
|
-
original_file = tree_item.getData
|
1141
|
-
current_file = project_dir.selected_child_path == original_file.path
|
1142
|
-
found_tab_item = find_tab_item(original_file.path)
|
1143
|
-
found_text_editor = found_tab_item&.getData('text_editor')
|
1144
|
-
@file_tree.edit_tree_item(
|
1145
|
-
tree_item,
|
1146
|
-
after_write: -> (edited_tree_item) {
|
1147
|
-
file = edited_tree_item.getData
|
1148
|
-
file_path = file.path
|
1149
|
-
file.name
|
1150
|
-
if ::File.file?(file_path)
|
1151
|
-
if new_file
|
1152
|
-
project_dir.selected_child_path = file_path
|
1153
|
-
else
|
1154
|
-
found_text_editor&.file = file
|
1155
|
-
found_tab_item&.setData('file', file)
|
1156
|
-
found_tab_item&.setData('file_path', file.path)
|
1157
|
-
found_tab_item&.setText(file.name)
|
1158
|
-
body_root.pack_same_size
|
1159
|
-
if current_file
|
1160
|
-
project_dir.selected_child_path = file_path
|
1161
|
-
else
|
1162
|
-
selected_tab_item&.getData('text_editor')&.text_widget&.setFocus
|
1163
|
-
end
|
1164
|
-
async_exec {
|
1165
|
-
@file_tree.swt_widget.showItem(edited_tree_item)
|
1166
|
-
}
|
1167
|
-
end
|
1168
|
-
end
|
1169
|
-
project_dir.resume_refresh
|
1170
|
-
},
|
1171
|
-
after_cancel: -> {
|
1172
|
-
project_dir.resume_refresh
|
1173
|
-
}
|
1174
|
-
)
|
891
|
+
async_exec { body_root.pack_same_size }
|
1175
892
|
end
|
1176
893
|
|
1177
894
|
def extract_char(event)
|
@@ -1183,27 +900,15 @@ module Glimmer
|
|
1183
900
|
def open_project
|
1184
901
|
selected_directory = directory_dialog.open
|
1185
902
|
return if selected_directory.nil?
|
1186
|
-
@
|
1187
|
-
text 'Gladiator'
|
1188
|
-
fill_layout(:vertical) {
|
1189
|
-
margin_width 15
|
1190
|
-
margin_height 15
|
1191
|
-
spacing 5
|
1192
|
-
}
|
1193
|
-
label(:center) {
|
1194
|
-
text "Opening Project: #{::File.basename(selected_directory)}"
|
1195
|
-
font height: 20
|
1196
|
-
}
|
1197
|
-
# @progress_bar = progress_bar(:horizontal, :indeterminate)
|
1198
|
-
}
|
903
|
+
@progress_shell = progress_shell(gladiator: self, progress_text: "Opening Project: #{::File.basename(selected_directory)}")
|
1199
904
|
async_exec {
|
1200
|
-
@
|
905
|
+
@progress_shell.open
|
1201
906
|
}
|
1202
907
|
async_exec {
|
1203
908
|
gladiator(project_dir_path: selected_directory) {
|
1204
909
|
on_swt_show {
|
1205
|
-
@
|
1206
|
-
@
|
910
|
+
@progress_shell.close
|
911
|
+
@progress_shell = nil
|
1207
912
|
}
|
1208
913
|
}.open if selected_directory
|
1209
914
|
}
|
@@ -1228,36 +933,31 @@ module Glimmer
|
|
1228
933
|
label {
|
1229
934
|
layout_data :fill, :fill, true, true
|
1230
935
|
background :white
|
1231
|
-
text "Gladiator v#{VERSION}\n\n#{LICENSE}\n\nGladiator icon made by Freepik from www.flaticon.com"
|
936
|
+
text "Gladiator v#{VERSION} (Beta)\n\n#{LICENSE}\n\nGladiator icon made by Freepik from www.flaticon.com"
|
1232
937
|
}
|
1233
938
|
}.open
|
1234
939
|
end
|
1235
940
|
|
1236
941
|
def handle_display_shortcut(key_event)
|
1237
942
|
if key_event.stateMask == swt(COMMAND_KEY) && extract_char(key_event) == 'f'
|
1238
|
-
|
1239
|
-
|
1240
|
-
find_text.swt_widget.setText current_text_editor.text_widget.getSelectionText
|
1241
|
-
end
|
1242
|
-
find_text.swt_widget.selectAll
|
1243
|
-
find_text.swt_widget.setFocus
|
1244
|
-
end
|
1245
|
-
if @navigation_expand_item.swt_expand_item.get_expanded
|
1246
|
-
find_action.call
|
1247
|
-
else
|
943
|
+
if !@navigation_expand_item.swt_expand_item.get_expanded
|
944
|
+
expand_navigation_expand_bar_height
|
1248
945
|
@navigation_expand_item.swt_expand_item.set_expanded true
|
1249
|
-
async_exec {
|
1250
|
-
body_root.pack_same_size
|
1251
|
-
find_action.call
|
1252
|
-
}
|
1253
946
|
end
|
947
|
+
if current_text_editor&.text_widget&.getSelectionText && current_text_editor&.text_widget&.getSelectionText&.size.to_i > 0
|
948
|
+
find_text.swt_widget.setText current_text_editor.text_widget.getSelectionText
|
949
|
+
end
|
950
|
+
find_text.swt_widget.selectAll
|
951
|
+
find_text.swt_widget.setFocus
|
1254
952
|
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask, COMMAND_KEY, :shift) && extract_char(key_event) == 'c'
|
1255
953
|
Clipboard.copy(project_dir.selected_child.path)
|
1256
954
|
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask, COMMAND_KEY, :shift) && extract_char(key_event) == 'g'
|
1257
955
|
project_dir.selected_child.find_previous
|
1258
956
|
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask, COMMAND_KEY, :shift) && extract_char(key_event) == 'o'
|
1259
957
|
self.maximized_pane = false
|
958
|
+
old_split_orientation = self.split_orientation
|
1260
959
|
self.split_orientation = split_pane? && split_orientation == swt(:horizontal) ? swt(:vertical) : swt(:horizontal)
|
960
|
+
@tab_folder_sash_form.weights = [1, 1] if old_split_orientation.nil?
|
1261
961
|
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask, COMMAND_KEY, :shift) && extract_char(key_event) == 'w'
|
1262
962
|
close_all_tabs
|
1263
963
|
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask, COMMAND_KEY, :alt) && extract_char(key_event) == 'w'
|
@@ -1269,25 +969,34 @@ module Glimmer
|
|
1269
969
|
if selected_tab_item
|
1270
970
|
project_dir.selected_child_path_history.delete(project_dir.selected_child.path)
|
1271
971
|
selected_tab_item.getData('proxy')&.dispose
|
1272
|
-
close_tab_folder
|
972
|
+
close_tab_folder(single_tab: true)
|
973
|
+
# if self.current_tab_item.nil?
|
974
|
+
# filter_text.swt_widget.selectAll
|
975
|
+
# filter_text.swt_widget.setFocus
|
976
|
+
# else
|
977
|
+
# current_text_editor&.text_widget&.setFocus
|
978
|
+
# end
|
1273
979
|
if selected_tab_item.nil?
|
1274
980
|
self.current_tab_item = self.current_text_editor = project_dir.selected_child = nil
|
1275
981
|
filter_text.swt_widget.selectAll
|
1276
982
|
filter_text.swt_widget.setFocus
|
1277
983
|
else
|
1278
984
|
current_text_editor&.text_widget&.setFocus
|
985
|
+
# async_exec { current_text_editor&.text_widget&.setFocus }
|
1279
986
|
end
|
1280
987
|
end
|
1281
|
-
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask, COMMAND_KEY, :shift) && extract_char(key_event) == ']'
|
988
|
+
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask, COMMAND_KEY, :shift) && extract_char(key_event) == ']' || Glimmer::SWT::SWTProxy.include?(key_event.stateMask, :ctrl) && key_event.keyCode == swt(:page_down)
|
1282
989
|
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
|
1283
990
|
current_text_editor&.text_widget&.setFocus
|
1284
|
-
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask, COMMAND_KEY, :shift) && extract_char(key_event) == '['
|
991
|
+
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask, COMMAND_KEY, :shift) && extract_char(key_event) == '[' || Glimmer::SWT::SWTProxy.include?(key_event.stateMask, :ctrl) && key_event.keyCode == swt(:page_up)
|
1285
992
|
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
|
1286
993
|
current_text_editor&.text_widget&.setFocus
|
1287
|
-
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask, COMMAND_KEY,
|
994
|
+
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask, COMMAND_KEY, CONTROL_KEY) && extract_char(key_event) == ']'
|
1288
995
|
navigate_to_next_tab_folder
|
1289
|
-
|
996
|
+
key_event.doit = false
|
997
|
+
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask, COMMAND_KEY, CONTROL_KEY) && extract_char(key_event) == '['
|
1290
998
|
navigate_to_previous_tab_folder
|
999
|
+
key_event.doit = false
|
1291
1000
|
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask, COMMAND_KEY) && extract_char(key_event) == '1'
|
1292
1001
|
current_tab_folder.swt_widget.setSelection(0) if current_tab_folder.swt_widget.getItemCount >= 1
|
1293
1002
|
current_text_editor&.text_widget&.setFocus
|
@@ -1348,8 +1057,8 @@ module Glimmer
|
|
1348
1057
|
@file_explorer_expand_item.swt_expand_item.height = @file_explorer_expand_item_height if @file_explorer_expand_item_height
|
1349
1058
|
@side_bar_sash_form.weights = [@file_lookup_expand_bar_height, @file_explorer_expand_bar_height]
|
1350
1059
|
end
|
1351
|
-
select_tree_item
|
1352
|
-
|
1060
|
+
@file_explorer_tree.select_tree_item
|
1061
|
+
@file_explorer_tree.swt_widget.setFocus
|
1353
1062
|
elsif key_event.keyCode == swt(:esc)
|
1354
1063
|
if current_text_editor
|
1355
1064
|
project_dir.selected_child_path = current_text_editor.file.path
|