glimmer-cs-gladiator 0.6.4 → 0.8.0
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 +51 -0
- data/LICENSE.txt +1 -1
- data/README.md +71 -15
- 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 +9 -5
- data/lib/models/glimmer/gladiator/file.rb +68 -10
- data/lib/views/glimmer/gladiator.rb +540 -748
- 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 +29 -11
- metadata +33 -7
- data/bin/gladiator_runner.rb +0 -6
data/lib/glimmer-cs-gladiator.rb
CHANGED
@@ -5,6 +5,8 @@ module Glimmer
|
|
5
5
|
class Dir
|
6
6
|
include Glimmer
|
7
7
|
include Glimmer::DataBinding::ObservableModel
|
8
|
+
|
9
|
+
IGNORE_PATHS = ['.gladiator', '.git', 'coverage', 'packages', 'node_modules', 'tmp', 'vendor', 'pkg', 'dist']
|
8
10
|
|
9
11
|
attr_accessor :selected_child, :filter, :children, :filtered_path_options, :filtered_path, :display_path, :ignore_paths
|
10
12
|
attr_reader :name, :parent, :path
|
@@ -36,7 +38,7 @@ module Glimmer
|
|
36
38
|
end
|
37
39
|
self.path = ::File.expand_path(path)
|
38
40
|
@name = ::File.basename(::File.expand_path(path))
|
39
|
-
@ignore_paths =
|
41
|
+
@ignore_paths = IGNORE_PATHS
|
40
42
|
self.filtered_path_options = []
|
41
43
|
end
|
42
44
|
|
@@ -60,7 +62,7 @@ module Glimmer
|
|
60
62
|
def name=(the_name)
|
61
63
|
self.display_path = display_path.sub(/#{Regexp.escape(@name)}$/, the_name)
|
62
64
|
@name = the_name
|
63
|
-
new_path = ::File.expand_path(display_path)
|
65
|
+
new_path = @project_dir.nil? ? ::File.expand_path(display_path) : ::File.join(project_dir.path, display_path)
|
64
66
|
FileUtils.mv(path, new_path)
|
65
67
|
self.path = display_path
|
66
68
|
end
|
@@ -72,8 +74,10 @@ module Glimmer
|
|
72
74
|
def retrieve_children
|
73
75
|
@children = ::Dir.glob(::File.join(@path, '*')).reject do |p|
|
74
76
|
# TODO make sure to configure ignore_paths in a preferences dialog
|
75
|
-
project_dir
|
76
|
-
|
77
|
+
if project_dir == self
|
78
|
+
project_dir.ignore_paths.any? do |ignore_path|
|
79
|
+
p.include?(ignore_path)
|
80
|
+
end
|
77
81
|
end
|
78
82
|
end.map do |p|
|
79
83
|
::File.file?(p) ? File.new(p, project_dir) : Dir.new(p, project_dir)
|
@@ -93,7 +97,7 @@ module Glimmer
|
|
93
97
|
def depth_first_search_file(dir, file_path)
|
94
98
|
dir.children.each do |child|
|
95
99
|
if child.is_a?(File)
|
96
|
-
return child if child.path.include?(file_path)
|
100
|
+
return child if child.path.include?(file_path.to_s)
|
97
101
|
else
|
98
102
|
result = depth_first_search_file(child, file_path)
|
99
103
|
return result unless result.nil?
|
@@ -20,6 +20,69 @@ module Glimmer
|
|
20
20
|
@init = nil
|
21
21
|
end
|
22
22
|
|
23
|
+
def language
|
24
|
+
# TODO consider using Rouge::Lexer.guess_by_filename instead and perhaps guess_by_source when it fails
|
25
|
+
extension = path.split('.').last if path.to_s.include?('.')
|
26
|
+
return 'ruby' if scratchpad?
|
27
|
+
return 'ruby' if path.to_s.end_with?('Gemfile') || path.to_s.end_with?('Rakefile')
|
28
|
+
return 'ruby' if dirty_content.start_with?('#!/usr/bin/env ruby') || dirty_content.start_with?('#!/usr/bin/env jruby')
|
29
|
+
return 'yaml' if path.to_s.end_with?('Gemfile.lock')
|
30
|
+
return 'shell' if extension.nil? && path.to_s.include?('/bin/')
|
31
|
+
case extension
|
32
|
+
# TODO extract case statement to an external config file
|
33
|
+
when 'rb'
|
34
|
+
'ruby'
|
35
|
+
when 'md', 'markdown'
|
36
|
+
'markdown'
|
37
|
+
when 'js', 'es6'
|
38
|
+
'javascript'
|
39
|
+
when 'json'
|
40
|
+
'json'
|
41
|
+
when 'yaml'
|
42
|
+
'yaml'
|
43
|
+
when 'html'
|
44
|
+
'html'
|
45
|
+
when 'h', 'c'
|
46
|
+
'c'
|
47
|
+
when 'hs'
|
48
|
+
'haskell'
|
49
|
+
when 'gradle'
|
50
|
+
'gradle'
|
51
|
+
when 'cpp'
|
52
|
+
'cpp'
|
53
|
+
when 'css'
|
54
|
+
'css'
|
55
|
+
when 'java'
|
56
|
+
'java'
|
57
|
+
when 'jsp'
|
58
|
+
'jsp'
|
59
|
+
when 'plist'
|
60
|
+
'plist'
|
61
|
+
when 'haml'
|
62
|
+
'haml'
|
63
|
+
when 'xml'
|
64
|
+
'xml'
|
65
|
+
when 'ini'
|
66
|
+
'ini'
|
67
|
+
when 'pl'
|
68
|
+
'perl'
|
69
|
+
when 'tcl'
|
70
|
+
'tcl'
|
71
|
+
when 'sass'
|
72
|
+
'sass'
|
73
|
+
when 'scss'
|
74
|
+
'scss'
|
75
|
+
when 'sql'
|
76
|
+
'sql'
|
77
|
+
when 'sh'
|
78
|
+
'shell'
|
79
|
+
when 'vue'
|
80
|
+
'vue'
|
81
|
+
when 'txt', nil
|
82
|
+
'plain_text'
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
23
86
|
def init_content
|
24
87
|
unless @init
|
25
88
|
@init = true
|
@@ -512,16 +575,11 @@ module Glimmer
|
|
512
575
|
end
|
513
576
|
|
514
577
|
def run
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
load path
|
521
|
-
end
|
522
|
-
rescue LoadError, SyntaxError, StandardError => e
|
523
|
-
# TODO consider showing a message dialog or error message console in the future
|
524
|
-
puts e.full_message
|
578
|
+
if scratchpad?
|
579
|
+
eval content
|
580
|
+
else
|
581
|
+
write_dirty_content
|
582
|
+
load path
|
525
583
|
end
|
526
584
|
end
|
527
585
|
|
@@ -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, :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
|
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 {
|
@@ -77,6 +105,11 @@ module Glimmer
|
|
77
105
|
on_about {
|
78
106
|
display_about_dialog
|
79
107
|
}
|
108
|
+
on_quit {
|
109
|
+
save_config
|
110
|
+
project_dir.selected_child&.write_dirty_content
|
111
|
+
display.swt_display.shells.each(&:close)
|
112
|
+
}
|
80
113
|
on_swt_keydown { |key_event|
|
81
114
|
focused_gladiator = display.focus_control.shell&.get_data('custom_shell')
|
82
115
|
focused_gladiator.handle_display_shortcut(key_event) if !focused_gladiator.nil? && key_event.widget.shell == focused_gladiator&.swt_widget
|
@@ -100,19 +133,19 @@ module Glimmer
|
|
100
133
|
#
|
101
134
|
after_body {
|
102
135
|
observe(project_dir, 'children') do
|
103
|
-
select_tree_item unless
|
136
|
+
@file_explorer_tree.select_tree_item unless Gladiator.startup
|
104
137
|
end
|
105
138
|
observe(project_dir, 'selected_child') do |selected_file|
|
106
139
|
if selected_file
|
107
140
|
if Gladiator.drag && !@tab_folder2
|
108
|
-
|
109
|
-
async_exec { body_root.pack_same_size}
|
141
|
+
self.tab_folder1 = current_tab_folder
|
110
142
|
@tab_folder_sash_form.content {
|
111
|
-
|
143
|
+
self.current_tab_folder = self.tab_folder2 = tab_folder {}
|
112
144
|
@current_tab_folder.swt_widget.setData('proxy', @current_tab_folder)
|
113
145
|
}
|
146
|
+
body_root.pack_same_size
|
114
147
|
end
|
115
|
-
select_tree_item unless
|
148
|
+
@file_explorer_tree.select_tree_item unless Gladiator.startup
|
116
149
|
found_tab_item = selected_tab_item
|
117
150
|
if found_tab_item
|
118
151
|
@current_tab_folder.swt_widget.setSelection(found_tab_item)
|
@@ -130,13 +163,15 @@ module Glimmer
|
|
130
163
|
tab_folder = nil
|
131
164
|
the_text_editor = nil
|
132
165
|
the_tab_item.content {
|
133
|
-
@current_text_editor = the_text_editor = text_editor(project_dir: project_dir, file: selected_file)
|
166
|
+
@current_text_editor = the_text_editor = text_editor(project_dir: project_dir, file: selected_file) {
|
167
|
+
layout_data :fill, :fill, true, true
|
168
|
+
}
|
134
169
|
@current_tab_folder.swt_widget.setData('selected_tab_item', @current_tab_item)
|
135
170
|
the_tab_item.swt_tab_item.setData('text_editor', @current_text_editor)
|
136
171
|
@current_text_editor.text_proxy.content {
|
137
172
|
on_focus_gained {
|
138
173
|
tab_folder = the_text_editor.swt_widget.getParent.getParent
|
139
|
-
|
174
|
+
self.current_tab_folder = tab_folder.getData('proxy')
|
140
175
|
@current_tab_item = the_tab_item
|
141
176
|
@current_text_editor = the_text_editor
|
142
177
|
@current_tab_folder.swt_widget.setData('selected_tab_item', @current_tab_item)
|
@@ -149,13 +184,11 @@ module Glimmer
|
|
149
184
|
on_swt_show {
|
150
185
|
@current_tab_item = the_tab_item
|
151
186
|
@current_text_editor = the_text_editor
|
152
|
-
|
187
|
+
self.current_tab_folder = @current_tab_item.swt_widget.getParent.getData('proxy')
|
153
188
|
@current_tab_folder.swt_widget.setData('selected_tab_item', @current_tab_item)
|
154
189
|
@current_tab_folder.swt_widget.setSelection(@current_tab_item.swt_tab_item)
|
155
190
|
project_dir.selected_child = selected_file
|
156
|
-
|
157
|
-
@current_text_editor&.text_widget&.setFocus
|
158
|
-
}
|
191
|
+
@current_text_editor&.text_widget&.setFocus
|
159
192
|
}
|
160
193
|
on_widget_disposed {
|
161
194
|
project_dir.selected_child&.write_dirty_content
|
@@ -168,13 +201,27 @@ module Glimmer
|
|
168
201
|
@current_tab_item.swt_tab_item.setData('proxy', @current_tab_item)
|
169
202
|
}
|
170
203
|
@current_tab_folder.swt_widget.setSelection(@current_tab_item.swt_tab_item)
|
171
|
-
|
172
204
|
body_root.pack_same_size
|
173
|
-
async_exec { body_root.pack_same_size}
|
174
205
|
end
|
175
206
|
@current_text_editor&.text_widget&.setFocus
|
176
207
|
end
|
177
208
|
end
|
209
|
+
observe(self, 'maximized_pane') do
|
210
|
+
if tab_folder2
|
211
|
+
@tab_folder_sash_form.maximized_control = (current_tab_folder.swt_widget if maximized_pane?)
|
212
|
+
end
|
213
|
+
end
|
214
|
+
observe(self, 'maximized_editor') do
|
215
|
+
@file_area_and_editor_area_sash_form.maximized_control = (@editor_area_composite.swt_widget if maximized_editor?)
|
216
|
+
if !maximized_editor?
|
217
|
+
expand_navigation_expand_bar_height
|
218
|
+
else
|
219
|
+
collapse_navigation_expand_bar_height
|
220
|
+
end
|
221
|
+
@navigation_expand_item.swt_expand_item.set_expanded !maximized_editor?
|
222
|
+
body_root.pack_same_size
|
223
|
+
async_exec { body_root.pack_same_size }
|
224
|
+
end
|
178
225
|
observe(project_dir, 'selected_child') do
|
179
226
|
save_config
|
180
227
|
end
|
@@ -191,583 +238,433 @@ module Glimmer
|
|
191
238
|
## Top-most widget must be a shell or another custom shell
|
192
239
|
#
|
193
240
|
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
|
241
|
+
if !::Dir.glob(::File.join(project_dir_path, 'glimmer-cs-gladiator.jar')).empty?
|
242
|
+
shell(:no_trim, :no_background) {
|
243
|
+
gladiator_menu_bar(gladiator: self, editing: false)
|
244
|
+
|
245
|
+
on_swt_show {
|
246
|
+
open_project
|
247
|
+
}
|
205
248
|
}
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
249
|
+
else
|
250
|
+
shell {
|
251
|
+
text "Gladiator - #{::File.expand_path(project_dir.path)}"
|
252
|
+
minimum_size 590, 250
|
253
|
+
image ICON
|
254
|
+
|
255
|
+
on_swt_show {
|
256
|
+
unless @shell_visible
|
257
|
+
if @config[:shell_width] && @config[:shell_height]
|
258
|
+
swt_widget.set_size(@config[:shell_width], @config[:shell_height])
|
259
|
+
else
|
260
|
+
swt_widget.set_size(display.bounds.width, display.bounds.height)
|
261
|
+
end
|
213
262
|
end
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
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
|
-
if OS.mac?
|
235
|
-
display.swt_display.system_menu.items.find {|mi| mi.id == swt(:id_quit)}.add_selection_listener {
|
263
|
+
swt_widget.setLocation(@config[:shell_x], @config[:shell_y]) if @config[:shell_x] && @config[:shell_y]
|
264
|
+
@loaded_config = true
|
265
|
+
@shell_visible = true
|
266
|
+
}
|
267
|
+
|
268
|
+
on_shell_closed {
|
236
269
|
save_config
|
237
270
|
project_dir.selected_child&.write_dirty_content
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
on_widget_selected {
|
249
|
-
begin
|
250
|
-
project_dir.selected_child_path = ''
|
251
|
-
rescue => e
|
252
|
-
puts e.full_message
|
253
|
-
end
|
254
|
-
}
|
255
|
-
}
|
256
|
-
menu_item(:separator)
|
257
|
-
menu_item {
|
258
|
-
text 'Open &Project...'
|
259
|
-
on_widget_selected {
|
260
|
-
open_project
|
261
|
-
}
|
262
|
-
}
|
271
|
+
if @tab_folder2
|
272
|
+
current_tab_folder.swt_widget.getItems.each do |tab_item|
|
273
|
+
tab_item.getData('proxy')&.dispose
|
274
|
+
end
|
275
|
+
close_tab_folder
|
276
|
+
end
|
277
|
+
current_tab_folder.swt_widget.getItems.each do |tab_item|
|
278
|
+
tab_item.getData('proxy')&.dispose
|
279
|
+
end
|
280
|
+
body_root.close unless current_tab_folder.swt_widget.getItems.empty?
|
263
281
|
}
|
264
|
-
|
265
|
-
|
266
|
-
menu {
|
267
|
-
text '&Split'
|
268
|
-
menu_item(:radio) {
|
269
|
-
text '&Horizontal'
|
270
|
-
selection bind(self, :split_orientation,
|
271
|
-
on_read: ->(o) { split_pane? && o == swt(:horizontal) },
|
272
|
-
on_write: ->(b) { b ? swt(:horizontal) : swt(:vertical) })
|
273
|
-
}
|
274
|
-
menu_item(:radio) {
|
275
|
-
text '&Vertical'
|
276
|
-
selection bind(self, :split_orientation,
|
277
|
-
on_read: ->(o) { split_pane? && o == swt(:vertical) },
|
278
|
-
on_write: ->(b) { b ? swt(:vertical) : swt(:horizontal) })
|
279
|
-
}
|
280
|
-
}
|
282
|
+
on_widget_disposed {
|
283
|
+
project_dir.selected_child&.write_dirty_content
|
281
284
|
}
|
282
|
-
|
283
|
-
|
284
|
-
# menu_item {
|
285
|
-
# text 'Launch Glimmer &App'
|
286
|
-
# on_widget_selected {
|
287
|
-
# parent_path = project_dir.path
|
288
|
-
## current_directory_name = ::File.basename(parent_path)
|
289
|
-
## assumed_shell_script = ::File.join(parent_path, 'bin', current_directory_name)
|
290
|
-
## 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)
|
291
|
-
## load assumed_shell_script
|
292
|
-
# FileUtils.cd(parent_path) do
|
293
|
-
# system 'glimmer run'
|
294
|
-
# end
|
295
|
-
# }
|
296
|
-
# }
|
297
|
-
menu_item {
|
298
|
-
text '&Ruby'
|
299
|
-
on_widget_selected {
|
300
|
-
project_dir.selected_child.run
|
301
|
-
}
|
302
|
-
}
|
285
|
+
on_control_resized {
|
286
|
+
save_config
|
303
287
|
}
|
304
|
-
|
305
|
-
|
306
|
-
menu_item {
|
307
|
-
text '&About'
|
308
|
-
on_widget_selected {
|
309
|
-
display_about_dialog
|
310
|
-
}
|
311
|
-
}
|
288
|
+
on_control_moved {
|
289
|
+
save_config
|
312
290
|
}
|
313
|
-
|
314
|
-
|
315
|
-
composite {
|
316
|
-
grid_layout(1, false) {
|
317
|
-
margin_width 0
|
318
|
-
margin_height 0
|
291
|
+
on_shell_deactivated {
|
292
|
+
project_dir.selected_child&.write_dirty_content
|
319
293
|
}
|
294
|
+
|
295
|
+
# Menu Bar
|
296
|
+
gladiator_menu_bar(gladiator: self, editing: true)
|
320
297
|
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
resize_expand_items = lambda { |event=nil|
|
329
|
-
@file_lookup_expand_item&.swt_expand_item&.height = @file_lookup_expand_bar.size.y - @file_lookup_expand_item.swt_expand_item.header_height
|
330
|
-
@file_explorer_expand_item&.swt_expand_item&.height = @file_explorer_expand_bar.size.y - @file_explorer_expand_item.swt_expand_item.header_height
|
331
|
-
}
|
332
|
-
|
333
|
-
@file_lookup_expand_bar = expand_bar {
|
334
|
-
layout_data :fill, :fill, true, true
|
335
|
-
font height: 17, style: :bold
|
336
|
-
foreground @default_foreground
|
337
|
-
|
338
|
-
on_swt_show {
|
339
|
-
@file_lookup_expand_item.swt_expand_item.height = @file_lookup_expand_bar.size.y - @file_lookup_expand_item.swt_expand_item.header_height
|
298
|
+
@file_area_and_editor_area_sash_form = sash_form(:horizontal) {
|
299
|
+
weights 1, 5
|
300
|
+
|
301
|
+
composite {
|
302
|
+
grid_layout(1, false) {
|
303
|
+
margin_width 0
|
304
|
+
margin_height 0
|
340
305
|
}
|
341
306
|
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
307
|
+
@side_bar_sash_form = sash_form(:vertical) {
|
308
|
+
layout_data(:fill, :fill, true, true)
|
309
|
+
sash_width 4
|
310
|
+
|
311
|
+
resize_expand_items = lambda { |event=nil|
|
312
|
+
@file_lookup_expand_item&.swt_expand_item&.height = @file_lookup_expand_bar.size.y - @file_lookup_expand_item.swt_expand_item.header_height
|
313
|
+
@file_explorer_expand_item&.swt_expand_item&.height = @file_explorer_expand_bar.size.y - @file_explorer_expand_item.swt_expand_item.header_height
|
348
314
|
}
|
349
|
-
text 'File Lookup'
|
350
|
-
height display.bounds.height
|
351
315
|
|
352
|
-
@
|
353
|
-
layout_data :fill, :
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
316
|
+
@file_lookup_expand_bar = expand_bar {
|
317
|
+
layout_data :fill, :fill, true, true
|
318
|
+
font height: 17, style: :bold
|
319
|
+
foreground @default_foreground
|
320
|
+
|
321
|
+
on_swt_show {
|
322
|
+
@file_lookup_expand_item.swt_expand_item.height = @file_lookup_expand_bar.size.y - @file_lookup_expand_item.swt_expand_item.header_height
|
323
|
+
}
|
324
|
+
|
325
|
+
on_swt_Resize(&resize_expand_items)
|
326
|
+
|
327
|
+
@file_lookup_expand_item = expand_item {
|
328
|
+
grid_layout {
|
329
|
+
margin_width 0
|
330
|
+
margin_height 0
|
331
|
+
}
|
332
|
+
text 'File Lookup'
|
333
|
+
height display.bounds.height
|
334
|
+
|
335
|
+
@filter_text = text {
|
336
|
+
layout_data :fill, :center, true, false
|
337
|
+
text bind(project_dir, 'filter')
|
338
|
+
on_key_pressed { |key_event|
|
339
|
+
if key_event.keyCode == swt(:tab) ||
|
340
|
+
key_event.keyCode == swt(:cr) ||
|
341
|
+
key_event.keyCode == swt(:arrow_up) ||
|
342
|
+
key_event.keyCode == swt(:arrow_down)
|
343
|
+
@file_lookup_list.swt_widget.select(0) if @file_lookup_list.swt_widget.getSelectionIndex() == -1
|
344
|
+
@file_lookup_list.swt_widget.setFocus
|
345
|
+
end
|
346
|
+
}
|
347
|
+
}
|
348
|
+
|
349
|
+
@file_lookup_list = file_lookup_list(gladiator: self, foreground_color: @default_foreground) {
|
350
|
+
layout_data :fill, :fill, true, true
|
351
|
+
}
|
352
|
+
}
|
353
|
+
|
354
|
+
on_item_collapsed { |event|
|
355
|
+
if @file_explorer_expand_item.swt_expand_item.get_expanded
|
356
|
+
@file_lookup_expand_item_height = @file_lookup_expand_item.swt_expand_item.height
|
357
|
+
@file_lookup_expand_item.swt_expand_item.height = 0
|
358
|
+
@file_lookup_expand_bar_height = @file_lookup_expand_bar.swt_widget.size.y
|
359
|
+
@file_explorer_expand_bar_height = @file_explorer_expand_bar.swt_widget.size.y
|
360
|
+
@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]
|
362
361
|
end
|
363
362
|
}
|
363
|
+
|
364
|
+
on_item_expanded {
|
365
|
+
@file_lookup_expand_item.swt_expand_item.height = @file_lookup_expand_item_height if @file_lookup_expand_item_height
|
366
|
+
@side_bar_sash_form.weights = [@file_lookup_expand_bar_height, @file_explorer_expand_bar_height]
|
367
|
+
}
|
368
|
+
|
364
369
|
}
|
365
|
-
|
366
|
-
@
|
370
|
+
|
371
|
+
@file_explorer_expand_bar = expand_bar {
|
367
372
|
layout_data :fill, :fill, true, true
|
368
|
-
|
369
|
-
selection bind(project_dir, :filtered_path)
|
373
|
+
font height: 17, style: :bold
|
370
374
|
foreground @default_foreground
|
371
|
-
|
372
|
-
|
375
|
+
|
376
|
+
on_swt_show {
|
377
|
+
@file_explorer_expand_item.swt_expand_item.height = @file_explorer_expand_bar.size.y - @file_explorer_expand_item.swt_expand_item.header_height
|
378
|
+
}
|
379
|
+
|
380
|
+
on_swt_Resize(&resize_expand_items)
|
381
|
+
|
382
|
+
@file_explorer_expand_item = expand_item {
|
383
|
+
grid_layout {
|
384
|
+
margin_width 0
|
385
|
+
margin_height 0
|
386
|
+
}
|
387
|
+
text 'File Explorer'
|
388
|
+
height display.bounds.height
|
389
|
+
|
390
|
+
@file_explorer_tree = file_explorer_tree(gladiator: self, foreground_color: @default_foreground) {
|
391
|
+
layout_data :fill, :fill, true, true
|
392
|
+
}
|
373
393
|
}
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
@
|
394
|
+
|
395
|
+
on_item_collapsed { |event|
|
396
|
+
if @file_lookup_expand_item.swt_expand_item.get_expanded
|
397
|
+
@file_explorer_expand_item_height = @file_explorer_expand_item.swt_expand_item.height
|
398
|
+
@file_explorer_expand_item.swt_expand_item.height = 0
|
399
|
+
@file_explorer_expand_bar_height = @file_explorer_expand_bar.swt_widget.size.y
|
400
|
+
@file_lookup_expand_bar_height = @file_lookup_expand_bar.swt_widget.size.y
|
401
|
+
@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]
|
378
402
|
end
|
379
403
|
}
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
list = event.widget.getControl
|
385
|
-
event.data = list.getSelection.first
|
386
|
-
}
|
404
|
+
|
405
|
+
on_item_expanded {
|
406
|
+
@file_explorer_expand_item.swt_expand_item.height = @file_explorer_expand_item_height if @file_explorer_expand_item_height
|
407
|
+
@side_bar_sash_form.weights = [@file_lookup_expand_bar_height, @file_explorer_expand_bar_height]
|
387
408
|
}
|
409
|
+
|
388
410
|
}
|
411
|
+
|
389
412
|
}
|
390
|
-
|
391
|
-
on_item_collapsed { |event|
|
392
|
-
if @file_explorer_expand_item.swt_expand_item.get_expanded
|
393
|
-
@file_lookup_expand_item_height = @file_lookup_expand_item.swt_expand_item.height
|
394
|
-
@file_lookup_expand_item.swt_expand_item.height = 0
|
395
|
-
@file_lookup_expand_bar_height = @file_lookup_expand_bar.swt_widget.size.y
|
396
|
-
@file_explorer_expand_bar_height = @file_explorer_expand_bar.swt_widget.size.y
|
397
|
-
@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]
|
398
|
-
end
|
399
|
-
}
|
400
|
-
|
401
|
-
on_item_expanded {
|
402
|
-
@file_lookup_expand_item.swt_expand_item.height = @file_lookup_expand_item_height if @file_lookup_expand_item_height
|
403
|
-
@side_bar_sash_form.weights = [@file_lookup_expand_bar_height, @file_explorer_expand_bar_height]
|
404
|
-
}
|
405
|
-
|
413
|
+
|
406
414
|
}
|
407
415
|
|
408
|
-
@
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
on_swt_show {
|
414
|
-
@file_explorer_expand_item.swt_expand_item.height = @file_explorer_expand_bar.size.y - @file_explorer_expand_item.swt_expand_item.header_height
|
416
|
+
@editor_area_composite = composite {
|
417
|
+
grid_layout(1, false) {
|
418
|
+
margin_width 0
|
419
|
+
margin_height 0
|
415
420
|
}
|
416
421
|
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
grid_layout {
|
421
|
-
margin_width 0
|
422
|
-
margin_height 0
|
422
|
+
@navigation_expand_bar = expand_bar {
|
423
|
+
layout_data(:fill, :top, true, false) {
|
424
|
+
minimum_width 480
|
423
425
|
}
|
424
|
-
|
425
|
-
|
426
|
+
font height: 17, style: :bold
|
427
|
+
foreground @default_foreground
|
426
428
|
|
427
|
-
@
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
429
|
+
@navigation_expand_item = expand_item {
|
430
|
+
text 'Navigation'
|
431
|
+
height 115
|
432
|
+
|
433
|
+
grid_layout(5, false) {
|
434
|
+
margin_right 5
|
435
|
+
}
|
436
|
+
|
437
|
+
stat_font = {name: 'Consolas', height: OS.mac? ? 15 : 12}
|
438
|
+
|
439
|
+
# row 1
|
440
|
+
|
441
|
+
label {
|
442
|
+
layout_data(:left, :center, false, false)
|
443
|
+
text 'File:'
|
444
|
+
foreground @default_foreground
|
445
|
+
}
|
446
|
+
|
447
|
+
@file_path_label = styled_text(:none) {
|
448
|
+
layout_data(:fill, :center, true, false) {
|
449
|
+
horizontal_span 2
|
450
|
+
}
|
451
|
+
background color(:widget_background)
|
452
|
+
foreground @default_foreground
|
453
|
+
editable false
|
454
|
+
caret nil
|
455
|
+
text bind(project_dir, 'selected_child.path')
|
456
|
+
on_mouse_up {
|
457
|
+
@file_path_label.swt_widget.selectAll
|
458
|
+
}
|
459
|
+
on_focus_lost {
|
460
|
+
@file_path_label.swt_widget.setSelection(0, 0)
|
439
461
|
}
|
440
462
|
}
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
project_dir.selected_child_path = extract_tree_item_path(@file_tree.swt_widget.getSelection.first)
|
446
|
-
}
|
463
|
+
|
464
|
+
label {
|
465
|
+
layout_data(:left, :center, false, false) {
|
466
|
+
minimum_width 100
|
447
467
|
}
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
}
|
468
|
+
text 'Caret Position:'
|
469
|
+
foreground @default_foreground
|
470
|
+
}
|
471
|
+
label(:right) {
|
472
|
+
layout_data(:fill, :center, true, false) {
|
473
|
+
minimum_width 50
|
455
474
|
}
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
475
|
+
text bind(project_dir, 'selected_child.caret_position')
|
476
|
+
foreground @default_foreground
|
477
|
+
font stat_font
|
478
|
+
}
|
479
|
+
|
480
|
+
# row 2
|
481
|
+
|
482
|
+
label {
|
483
|
+
layout_data(:left, :center, false, false)
|
484
|
+
text 'Line:'
|
485
|
+
foreground @default_foreground
|
486
|
+
}
|
487
|
+
@line_number_text = text {
|
488
|
+
layout_data(:fill, :center, true, false) {
|
489
|
+
width_hint 400
|
490
|
+
minimum_width 100
|
461
491
|
}
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
492
|
+
text bind(project_dir, 'selected_child.line_number', on_read: :to_s, on_write: :to_i)
|
493
|
+
foreground @default_foreground
|
494
|
+
font stat_font
|
495
|
+
on_key_pressed { |key_event|
|
496
|
+
if key_event.keyCode == swt(:cr)
|
497
|
+
@current_text_editor&.text_widget&.setFocus
|
498
|
+
end
|
467
499
|
}
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
500
|
+
on_verify_text { |event|
|
501
|
+
event.doit = !event.text.match(/^\d*$/).to_a.empty?
|
502
|
+
}
|
503
|
+
}
|
504
|
+
label # filler
|
505
|
+
|
506
|
+
label {
|
507
|
+
layout_data(:left, :center, false, false) {
|
508
|
+
minimum_width 100
|
473
509
|
}
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
510
|
+
text 'Line Position:'
|
511
|
+
foreground @default_foreground
|
512
|
+
}
|
513
|
+
label(:right) {
|
514
|
+
layout_data(:fill, :center, true, false) {
|
515
|
+
minimum_width 50
|
516
|
+
}
|
517
|
+
text bind(project_dir, 'selected_child.line_position')
|
518
|
+
foreground @default_foreground
|
519
|
+
font stat_font
|
520
|
+
}
|
521
|
+
|
522
|
+
# row 3
|
523
|
+
|
524
|
+
label {
|
525
|
+
layout_data(:left, :center, false, false)
|
526
|
+
text 'Find:'
|
527
|
+
foreground @default_foreground
|
528
|
+
}
|
529
|
+
@find_text = text {
|
530
|
+
layout_data(:fill, :center, true, false) {
|
531
|
+
width_hint 400
|
532
|
+
minimum_width 100
|
533
|
+
}
|
534
|
+
text bind(project_dir, 'selected_child.find_text')
|
535
|
+
foreground @default_foreground
|
536
|
+
font stat_font
|
537
|
+
on_key_pressed { |key_event|
|
538
|
+
if key_event.stateMask == swt(COMMAND_KEY) && key_event.keyCode == swt(:cr)
|
539
|
+
project_dir.selected_child.case_sensitive = !project_dir.selected_child.case_sensitive
|
540
|
+
project_dir.selected_child&.find_next
|
541
|
+
end
|
542
|
+
if key_event.keyCode == swt(:cr)
|
543
|
+
project_dir.selected_child&.find_next
|
544
|
+
end
|
545
|
+
}
|
546
|
+
}
|
547
|
+
composite {
|
548
|
+
layout_data(:left, :center, true, false) {
|
549
|
+
minimum_width 120
|
550
|
+
}
|
551
|
+
row_layout {
|
552
|
+
margin_width 0
|
553
|
+
margin_height 0
|
554
|
+
}
|
555
|
+
button(:check) {
|
556
|
+
selection bind(project_dir, 'selected_child.case_sensitive')
|
557
|
+
on_key_pressed { |key_event|
|
558
|
+
if key_event.keyCode == swt(:cr)
|
559
|
+
project_dir.selected_child&.find_next
|
560
|
+
end
|
478
561
|
}
|
479
562
|
}
|
563
|
+
label {
|
564
|
+
text 'Case-sensitive'
|
565
|
+
foreground @default_foreground
|
566
|
+
}
|
480
567
|
}
|
481
|
-
|
482
|
-
|
483
|
-
|
568
|
+
|
569
|
+
label {
|
570
|
+
layout_data(:left, :center, false, false) {
|
571
|
+
minimum_width 100
|
572
|
+
}
|
573
|
+
text 'Selection Count:'
|
574
|
+
foreground @default_foreground
|
484
575
|
}
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
576
|
+
label(:right) {
|
577
|
+
layout_data(:fill, :center, true, false) {
|
578
|
+
minimum_width 50
|
579
|
+
}
|
580
|
+
text bind(project_dir, 'selected_child.selection_count')
|
581
|
+
foreground @default_foreground
|
582
|
+
font stat_font
|
492
583
|
}
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
584
|
+
|
585
|
+
# row 4
|
586
|
+
|
587
|
+
label {
|
588
|
+
layout_data(:left, :center, false, false)
|
589
|
+
text 'Replace:'
|
590
|
+
foreground @default_foreground
|
498
591
|
}
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
592
|
+
@replace_text = text {
|
593
|
+
layout_data(:fill, :center, true, false) {
|
594
|
+
width_hint 400
|
595
|
+
minimum_width 100
|
596
|
+
}
|
597
|
+
text bind(project_dir, 'selected_child.replace_text')
|
598
|
+
foreground @default_foreground
|
599
|
+
font stat_font
|
600
|
+
on_focus_gained {
|
601
|
+
project_dir.selected_child&.ensure_find_next
|
602
|
+
}
|
603
|
+
on_key_pressed { |key_event|
|
604
|
+
if key_event.keyCode == swt(:cr)
|
605
|
+
if project_dir.selected_child
|
606
|
+
Command.do(project_dir.selected_child, :replace_next!)
|
607
|
+
end
|
608
|
+
end
|
609
|
+
}
|
610
|
+
}
|
611
|
+
label # filler
|
612
|
+
label {
|
613
|
+
layout_data(:left, :center, false, false) {
|
614
|
+
minimum_width 100
|
615
|
+
}
|
616
|
+
text 'Top Pixel:'
|
617
|
+
foreground @default_foreground
|
618
|
+
}
|
619
|
+
label(:right) {
|
620
|
+
layout_data(:fill, :center, true, false) {
|
621
|
+
minimum_width 50
|
622
|
+
}
|
623
|
+
text bind(project_dir, 'selected_child.top_pixel')
|
624
|
+
foreground @default_foreground
|
625
|
+
font stat_font
|
504
626
|
}
|
505
627
|
}
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
if @file_lookup_expand_item.swt_expand_item.get_expanded
|
510
|
-
@file_explorer_expand_item_height = @file_explorer_expand_item.swt_expand_item.height
|
511
|
-
@file_explorer_expand_item.swt_expand_item.height = 0
|
512
|
-
@file_explorer_expand_bar_height = @file_explorer_expand_bar.swt_widget.size.y
|
513
|
-
@file_lookup_expand_bar_height = @file_lookup_expand_bar.swt_widget.size.y
|
514
|
-
@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]
|
515
|
-
end
|
516
|
-
}
|
517
|
-
|
518
|
-
on_item_expanded {
|
519
|
-
@file_explorer_expand_item.swt_expand_item.height = @file_explorer_expand_item_height if @file_explorer_expand_item_height
|
520
|
-
@side_bar_sash_form.weights = [@file_lookup_expand_bar_height, @file_explorer_expand_bar_height]
|
521
|
-
}
|
522
|
-
|
523
|
-
}
|
524
|
-
|
525
|
-
}
|
526
|
-
|
527
|
-
# TODO see if you could replace some of this with Glimmer DSL/API syntax
|
528
|
-
@file_tree_editor = TreeEditor.new(@file_tree.swt_widget);
|
529
|
-
@file_tree_editor.horizontalAlignment = swt(:left);
|
530
|
-
@file_tree_editor.grabHorizontal = true;
|
531
|
-
@file_tree_editor.minimumHeight = 20;
|
532
|
-
|
533
|
-
}
|
534
|
-
|
535
|
-
composite {
|
536
|
-
grid_layout(1, false) {
|
537
|
-
margin_width 0
|
538
|
-
margin_height 0
|
539
|
-
}
|
540
|
-
layout_data :fill, :fill, true, true
|
541
|
-
|
542
|
-
@navigation_expand_bar = expand_bar {
|
543
|
-
layout_data :fill, :top, true, false
|
544
|
-
font height: 17, style: :bold
|
545
|
-
foreground @default_foreground
|
546
|
-
|
547
|
-
@navigation_expand_item = expand_item {
|
548
|
-
text 'Navigation'
|
549
|
-
height 115
|
550
|
-
|
551
|
-
grid_layout(5, false) {
|
552
|
-
margin_right 5
|
553
|
-
}
|
554
|
-
|
555
|
-
stat_font = {name: 'Consolas', height: OS.mac? ? 15 : 12}
|
556
|
-
|
557
|
-
# row 1
|
558
|
-
|
559
|
-
label {
|
560
|
-
layout_data(:left, :center, false, false)
|
561
|
-
text 'File:'
|
562
|
-
foreground @default_foreground
|
563
|
-
}
|
564
|
-
|
565
|
-
@file_path_label = styled_text(:none) {
|
566
|
-
layout_data(:fill, :center, true, false) {
|
567
|
-
horizontal_span 2
|
568
|
-
}
|
569
|
-
background color(:widget_background)
|
570
|
-
foreground @default_foreground
|
571
|
-
editable false
|
572
|
-
caret nil
|
573
|
-
text bind(project_dir, 'selected_child.path')
|
574
|
-
on_mouse_up {
|
575
|
-
@file_path_label.swt_widget.selectAll
|
576
|
-
}
|
577
|
-
on_focus_lost {
|
578
|
-
@file_path_label.swt_widget.setSelection(0, 0)
|
628
|
+
|
629
|
+
on_item_collapsed {
|
630
|
+
collapse_navigation_expand_bar_height
|
579
631
|
}
|
580
|
-
}
|
581
|
-
|
582
|
-
label {
|
583
|
-
layout_data(:left, :center, false, false)
|
584
|
-
text 'Caret Position:'
|
585
|
-
foreground @default_foreground
|
586
|
-
}
|
587
|
-
label(:right) {
|
588
|
-
layout_data(:fill, :center, true, false)
|
589
|
-
text bind(project_dir, 'selected_child.caret_position')
|
590
|
-
foreground @default_foreground
|
591
|
-
font stat_font
|
592
|
-
}
|
593
632
|
|
594
|
-
|
595
|
-
|
596
|
-
label {
|
597
|
-
layout_data(:left, :center, false, false)
|
598
|
-
text 'Line:'
|
599
|
-
foreground @default_foreground
|
600
|
-
}
|
601
|
-
@line_number_text = text {
|
602
|
-
layout_data(:fill, :center, true, false) {
|
603
|
-
minimum_width 400
|
604
|
-
}
|
605
|
-
text bind(project_dir, 'selected_child.line_number', on_read: :to_s, on_write: :to_i)
|
606
|
-
foreground @default_foreground
|
607
|
-
font stat_font
|
608
|
-
on_key_pressed { |key_event|
|
609
|
-
if key_event.keyCode == swt(:cr)
|
610
|
-
@current_text_editor&.text_widget&.setFocus
|
611
|
-
end
|
612
|
-
}
|
613
|
-
on_verify_text { |event|
|
614
|
-
event.doit = !event.text.match(/^\d*$/).to_a.empty?
|
615
|
-
}
|
616
|
-
}
|
617
|
-
label # filler
|
618
|
-
|
619
|
-
label {
|
620
|
-
layout_data(:left, :center, false, false)
|
621
|
-
text 'Line Position:'
|
622
|
-
foreground @default_foreground
|
623
|
-
}
|
624
|
-
label(:right) {
|
625
|
-
layout_data(:fill, :center, true, false)
|
626
|
-
text bind(project_dir, 'selected_child.line_position')
|
627
|
-
foreground @default_foreground
|
628
|
-
font stat_font
|
629
|
-
}
|
630
|
-
|
631
|
-
# row 3
|
632
|
-
|
633
|
-
label {
|
634
|
-
layout_data(:left, :center, false, false)
|
635
|
-
text 'Find:'
|
636
|
-
foreground @default_foreground
|
637
|
-
}
|
638
|
-
@find_text = text {
|
639
|
-
layout_data(:fill, :center, true, false) {
|
640
|
-
minimum_width 400
|
641
|
-
}
|
642
|
-
text bind(project_dir, 'selected_child.find_text')
|
643
|
-
foreground @default_foreground
|
644
|
-
font stat_font
|
645
|
-
on_key_pressed { |key_event|
|
646
|
-
if key_event.stateMask == swt(COMMAND_KEY) && key_event.keyCode == swt(:cr)
|
647
|
-
project_dir.selected_child.case_sensitive = !project_dir.selected_child.case_sensitive
|
648
|
-
project_dir.selected_child&.find_next
|
649
|
-
end
|
650
|
-
if key_event.keyCode == swt(:cr)
|
651
|
-
project_dir.selected_child&.find_next
|
652
|
-
end
|
653
|
-
}
|
654
|
-
}
|
655
|
-
composite {
|
656
|
-
layout_data(:left, :center, true, false)
|
657
|
-
row_layout {
|
658
|
-
margin_width 0
|
659
|
-
margin_height 0
|
660
|
-
}
|
661
|
-
button(:check) {
|
662
|
-
selection bind(project_dir, 'selected_child.case_sensitive')
|
663
|
-
on_key_pressed { |key_event|
|
664
|
-
if key_event.keyCode == swt(:cr)
|
665
|
-
project_dir.selected_child&.find_next
|
666
|
-
end
|
667
|
-
}
|
668
|
-
}
|
669
|
-
label {
|
670
|
-
text 'Case-sensitive'
|
671
|
-
foreground @default_foreground
|
633
|
+
on_item_expanded {
|
634
|
+
expand_navigation_expand_bar_height
|
672
635
|
}
|
673
|
-
}
|
674
636
|
|
675
|
-
label {
|
676
|
-
layout_data(:left, :center, false, false)
|
677
|
-
text 'Selection Count:'
|
678
|
-
foreground @default_foreground
|
679
|
-
}
|
680
|
-
label(:right) {
|
681
|
-
layout_data(:fill, :center, true, false)
|
682
|
-
text bind(project_dir, 'selected_child.selection_count')
|
683
|
-
foreground @default_foreground
|
684
|
-
font stat_font
|
685
637
|
}
|
686
638
|
|
687
|
-
|
688
|
-
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
}
|
694
|
-
@replace_text = text {
|
695
|
-
layout_data(:fill, :center, true, false) {
|
696
|
-
minimum_width 400
|
697
|
-
}
|
698
|
-
text bind(project_dir, 'selected_child.replace_text')
|
699
|
-
foreground @default_foreground
|
700
|
-
font stat_font
|
701
|
-
on_focus_gained {
|
702
|
-
project_dir.selected_child&.ensure_find_next
|
703
|
-
}
|
704
|
-
on_key_pressed { |key_event|
|
705
|
-
if key_event.keyCode == swt(:cr)
|
706
|
-
if project_dir.selected_child
|
707
|
-
Command.do(project_dir.selected_child, :replace_next!)
|
708
|
-
end
|
709
|
-
end
|
639
|
+
@tab_folder_sash_form = sash_form {
|
640
|
+
layout_data(:fill, :fill, true, true) {
|
641
|
+
width_hint 768
|
642
|
+
height_hint 576
|
643
|
+
minimum_width 168
|
644
|
+
minimum_height 176
|
710
645
|
}
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
|
718
|
-
|
719
|
-
|
720
|
-
|
721
|
-
|
722
|
-
|
723
|
-
|
724
|
-
|
725
|
-
|
726
|
-
on_item_collapsed {
|
727
|
-
@navigation_expand_item_height = @navigation_expand_item.swt_expand_item.height if @navigation_expand_item.swt_expand_item.height > 0
|
728
|
-
@navigation_expand_item.swt_expand_item.height = 0
|
729
|
-
async_exec {
|
730
|
-
body_root.pack_same_size
|
731
|
-
}
|
732
|
-
}
|
733
|
-
|
734
|
-
on_item_expanded {
|
735
|
-
@navigation_expand_item.swt_expand_item.height = @navigation_expand_item_height if @navigation_expand_item_height
|
736
|
-
async_exec {
|
737
|
-
body_root.pack_same_size
|
738
|
-
}
|
739
|
-
}
|
740
|
-
|
741
|
-
}
|
742
|
-
|
743
|
-
@tab_folder_sash_form = sash_form {
|
744
|
-
layout_data(:fill, :fill, true, true) {
|
745
|
-
width_hint 768
|
746
|
-
height_hint 576
|
747
|
-
minimum_width 768
|
748
|
-
minimum_height 576
|
749
|
-
}
|
750
|
-
sash_width 10
|
751
|
-
orientation bind(self, :split_orientation) {|value| async_exec { body_root.pack_same_size}; value}
|
752
|
-
@current_tab_folder = tab_folder {
|
753
|
-
drag_source(DND::DROP_COPY) {
|
754
|
-
transfer [TextTransfer.getInstance].to_java(Transfer)
|
755
|
-
event_data = nil
|
756
|
-
on_drag_start {|event|
|
757
|
-
Gladiator.drag = true
|
758
|
-
tab_folder = event.widget.getControl
|
759
|
-
tab_item = tab_folder.getItem(Point.new(event.x, event.y))
|
760
|
-
event_data = tab_item.getData('file_path')
|
761
|
-
}
|
762
|
-
on_drag_set_data { |event|
|
763
|
-
event.data = event_data
|
646
|
+
orientation bind(self, :split_orientation) {|value| async_exec { body_root.pack_same_size}; value}
|
647
|
+
self.current_tab_folder = self.tab_folder1 = tab_folder {
|
648
|
+
drag_source(DND::DROP_COPY) {
|
649
|
+
transfer [TextTransfer.getInstance].to_java(Transfer)
|
650
|
+
event_data = nil
|
651
|
+
on_drag_start {|event|
|
652
|
+
Gladiator.drag = true
|
653
|
+
tab_folder = event.widget.getControl
|
654
|
+
tab_item = tab_folder.getItem(Point.new(event.x, event.y))
|
655
|
+
event_data = tab_item.getData('file_path')
|
656
|
+
}
|
657
|
+
on_drag_set_data { |event|
|
658
|
+
event.data = event_data
|
659
|
+
}
|
660
|
+
}
|
764
661
|
}
|
662
|
+
@current_tab_folder.swt_widget.setData('proxy', @current_tab_folder)
|
765
663
|
}
|
766
664
|
}
|
767
|
-
|
768
|
-
}
|
665
|
+
} # end of sash form
|
769
666
|
}
|
770
|
-
|
667
|
+
end
|
771
668
|
}
|
772
669
|
|
773
670
|
def load_config_ignore_paths
|
@@ -792,23 +689,11 @@ module Glimmer
|
|
792
689
|
project_dir.ignore_paths ||= ['packages', 'tmp']
|
793
690
|
open_file_paths1 = @config[:open_file_paths1] || @config[:open_file_paths]
|
794
691
|
open_file_paths2 = @config[:open_file_paths2]
|
795
|
-
self.split_orientation = swt(@config[:split_orientation]
|
796
|
-
if @
|
797
|
-
@
|
798
|
-
text 'Gladiator'
|
799
|
-
fill_layout(:vertical) {
|
800
|
-
margin_width 15
|
801
|
-
margin_height 15
|
802
|
-
spacing 5
|
803
|
-
}
|
804
|
-
label(:center) {
|
805
|
-
text "Opening Last Open Files"
|
806
|
-
font height: 20
|
807
|
-
}
|
808
|
-
# @progress_bar = progress_bar(:horizontal, :indeterminate)
|
809
|
-
}
|
692
|
+
self.split_orientation = (swt(@config[:split_orientation]) rescue swt(:horizontal)) if @config[:split_orientation]
|
693
|
+
if @progress_shell.nil?
|
694
|
+
@progress_shell = progress_shell(gladiator: self, progress_text: 'Opening Last Open Files')
|
810
695
|
async_exec {
|
811
|
-
@
|
696
|
+
@progress_shell.open
|
812
697
|
}
|
813
698
|
end
|
814
699
|
open_file_paths1.to_a.each do |file_path|
|
@@ -850,8 +735,8 @@ module Glimmer
|
|
850
735
|
}
|
851
736
|
async_exec {
|
852
737
|
Gladiator.drag = false
|
853
|
-
@
|
854
|
-
@
|
738
|
+
@progress_shell&.close
|
739
|
+
@progress_shell = nil
|
855
740
|
@loaded_config = true
|
856
741
|
}
|
857
742
|
}
|
@@ -869,16 +754,17 @@ module Glimmer
|
|
869
754
|
end
|
870
755
|
|
871
756
|
def save_config
|
872
|
-
return
|
757
|
+
return if !@loaded_config || body_root&.disposed?
|
873
758
|
child = project_dir.selected_child
|
874
759
|
return if child.nil?
|
875
760
|
tab_folder1 = @tab_folder1 || @current_tab_folder
|
876
761
|
tab_folder2 = @tab_folder2
|
877
762
|
open_file_paths1 = tab_folder1&.swt_widget&.items.to_a.map {|i| i.get_data('file_path')}
|
878
763
|
open_file_paths2 = tab_folder2&.swt_widget&.items.to_a.map {|i| i.get_data('file_path')}
|
764
|
+
split_orientation_value = split_orientation == swt(:horizontal) ? 'horizontal' : (split_orientation == swt(:vertical) ? 'vertical' : nil)
|
879
765
|
@config = {
|
880
766
|
selected_child_path: child.path,
|
881
|
-
split_orientation:
|
767
|
+
split_orientation: split_orientation_value,
|
882
768
|
caret_position: child.caret_position,
|
883
769
|
top_pixel: child.top_pixel,
|
884
770
|
shell_width: swt_widget&.getBounds&.width,
|
@@ -894,23 +780,70 @@ module Glimmer
|
|
894
780
|
rescue => e
|
895
781
|
puts e.full_message
|
896
782
|
end
|
783
|
+
|
784
|
+
def navigate_to_next_tab_folder
|
785
|
+
if tab_folder2
|
786
|
+
self.maximized_pane = false
|
787
|
+
if current_tab_folder == tab_folder1
|
788
|
+
self.current_tab_folder = tab_folder2
|
789
|
+
else
|
790
|
+
self.current_tab_folder = tab_folder1
|
791
|
+
end
|
792
|
+
self.current_tab_item = current_tab_folder.swt_widget.getData('selected_tab_item')
|
793
|
+
self.project_dir.selected_child = current_tab_item&.swt_tab_item&.getData('file')
|
794
|
+
self.current_tab_item = current_tab_folder.swt_widget.getData('selected_tab_item')
|
795
|
+
current_tab_item&.swt_tab_item&.getData('text_editor')&.text_widget&.setFocus
|
796
|
+
end
|
797
|
+
end
|
897
798
|
|
898
|
-
def
|
799
|
+
def navigate_to_previous_tab_folder
|
800
|
+
if tab_folder2
|
801
|
+
self.maximized_pane = false
|
802
|
+
if current_tab_folder == tab_folder2
|
803
|
+
self.current_tab_folder = tab_folder1
|
804
|
+
else
|
805
|
+
self.current_tab_folder = tab_folder2
|
806
|
+
end
|
807
|
+
self.current_tab_item = current_tab_folder.swt_widget.getData('selected_tab_item')
|
808
|
+
self.project_dir.selected_child = current_tab_item&.swt_tab_item&.getData('file')
|
809
|
+
self.current_tab_item = current_tab_folder.swt_widget.getData('selected_tab_item')
|
810
|
+
current_tab_item&.swt_tab_item&.getData('text_editor')&.text_widget&.setFocus
|
811
|
+
end
|
812
|
+
end
|
813
|
+
|
814
|
+
def close_all_tabs(closing_tab_folder = nil)
|
815
|
+
closing_tab_folder ||= current_tab_folder
|
816
|
+
closing_tab_folder.swt_widget.getItems.each do |tab_item|
|
817
|
+
project_dir.selected_child_path_history.delete(tab_item.getData('file_path'))
|
818
|
+
tab_item.getData('proxy')&.dispose
|
819
|
+
end
|
820
|
+
close_tab_folder(closing_tab_folder)
|
821
|
+
if self.current_tab_item.nil?
|
822
|
+
filter_text.swt_widget.selectAll
|
823
|
+
filter_text.swt_widget.setFocus
|
824
|
+
end
|
825
|
+
end
|
826
|
+
|
827
|
+
def close_tab_folder(closing_tab_folder = nil, single_tab: false)
|
828
|
+
closing_tab_folder ||= current_tab_folder
|
899
829
|
if @tab_folder2 && !selected_tab_item
|
900
|
-
if
|
830
|
+
if closing_tab_folder == @tab_folder2
|
901
831
|
@tab_folder2.swt_widget.dispose
|
902
|
-
|
832
|
+
self.current_tab_folder = @tab_folder1
|
903
833
|
else
|
904
834
|
@tab_folder1.swt_widget.dispose
|
905
|
-
|
835
|
+
self.current_tab_folder = self.tab_folder1 = @tab_folder2
|
906
836
|
end
|
907
|
-
|
837
|
+
self.tab_folder2 = nil
|
838
|
+
body_root.pack_same_size
|
908
839
|
|
909
|
-
@current_tab_item =
|
840
|
+
@current_tab_item = current_tab_folder.swt_widget.getData('selected_tab_item')
|
910
841
|
@current_text_editor = @current_tab_item.swt_tab_item.getData('text_editor')
|
911
842
|
project_dir.selected_child = @current_tab_item.swt_tab_item.getData('file')
|
912
|
-
|
913
|
-
async_exec {
|
843
|
+
@current_text_editor&.text_widget&.setFocus
|
844
|
+
async_exec { @current_text_editor&.text_widget&.setFocus }
|
845
|
+
elsif !single_tab
|
846
|
+
self.current_tab_item = self.current_text_editor = project_dir.selected_child = nil
|
914
847
|
end
|
915
848
|
end
|
916
849
|
|
@@ -925,122 +858,18 @@ module Glimmer
|
|
925
858
|
def other_tab_items
|
926
859
|
@current_tab_folder.swt_widget.getItems.reject { |ti| ti.getData('file_path') == project_dir.selected_child&.path }
|
927
860
|
end
|
928
|
-
|
929
|
-
def
|
930
|
-
|
931
|
-
|
932
|
-
|
933
|
-
|
934
|
-
project_dir.path
|
935
|
-
end
|
936
|
-
end
|
937
|
-
|
938
|
-
def select_tree_item
|
939
|
-
return unless project_dir.selected_child&.name
|
940
|
-
tree_items_to_select = @file_tree.depth_first_search { |ti| ti.getData.path == project_dir.selected_child.path }
|
941
|
-
@file_tree.swt_widget.setSelection(tree_items_to_select)
|
942
|
-
end
|
943
|
-
|
944
|
-
def delete_tree_item(tree_item)
|
945
|
-
return if tree_item.nil?
|
946
|
-
file = tree_item.getData
|
947
|
-
parent_path = ::File.dirname(file.path)
|
948
|
-
if file.is_a?(Gladiator::Dir)
|
949
|
-
file_paths = file.all_children.select {|f| f.is_a?(Gladiator::File)}.map(&:path)
|
950
|
-
file.remove_all_observers
|
951
|
-
else
|
952
|
-
file_paths = [file.path]
|
953
|
-
end
|
954
|
-
file_paths.each do |file_path|
|
955
|
-
found_tab_item = find_tab_item(file_path)
|
956
|
-
if found_tab_item
|
957
|
-
project_dir.selected_child_path_history.delete(found_tab_item.getData('file_path'))
|
958
|
-
found_tab_item.getData('proxy')&.dispose
|
959
|
-
end
|
960
|
-
end
|
961
|
-
file.delete! # TODO consider supporting command undo/redo
|
962
|
-
project_dir.refresh(async: false)
|
963
|
-
parent_tree_item = @file_tree.depth_first_search {|ti| ti.getData.path == parent_path}.first
|
964
|
-
@file_tree.swt_widget.showItem(parent_tree_item)
|
965
|
-
parent_tree_item.setExpanded(true)
|
966
|
-
rescue => e
|
967
|
-
puts e.full_message
|
968
|
-
end
|
969
|
-
|
970
|
-
def add_new_directory_to_selected_tree_item
|
971
|
-
project_dir.pause_refresh
|
972
|
-
tree_item = @file_tree.swt_widget.getSelection.first
|
973
|
-
directory_path = extract_tree_item_path(tree_item)
|
974
|
-
return if directory_path.nil?
|
975
|
-
if !::Dir.exist?(directory_path)
|
976
|
-
tree_item = tree_item.getParentItem
|
977
|
-
directory_path = ::File.dirname(directory_path)
|
978
|
-
end
|
979
|
-
new_directory_path = ::File.expand_path(::File.join(directory_path, 'new_directory'))
|
980
|
-
FileUtils.mkdir_p(new_directory_path)
|
981
|
-
project_dir.refresh(async: false, force: true)
|
982
|
-
new_tree_item = @file_tree.depth_first_search {|ti| ti.getData.path == new_directory_path}.first
|
983
|
-
@file_tree.swt_widget.showItem(new_tree_item)
|
984
|
-
rename_tree_item(new_tree_item)
|
985
|
-
end
|
986
|
-
|
987
|
-
def add_new_file_to_selected_tree_item
|
988
|
-
project_dir.pause_refresh
|
989
|
-
tree_item = @file_tree.swt_widget.getSelection.first
|
990
|
-
directory_path = extract_tree_item_path(tree_item)
|
991
|
-
if !::Dir.exist?(directory_path)
|
992
|
-
tree_item = tree_item.getParentItem
|
993
|
-
directory_path = ::File.dirname(directory_path)
|
994
|
-
end
|
995
|
-
new_file_path = ::File.expand_path(::File.join(directory_path, 'new_file'))
|
996
|
-
FileUtils.touch(new_file_path)
|
997
|
-
# TODO look into refreshing only the parent directory to avoid slowdown
|
998
|
-
project_dir.refresh(async: false, force: true)
|
999
|
-
new_tree_item = @file_tree.depth_first_search {|ti| ti.getData.path == new_file_path}.first
|
1000
|
-
@file_tree.swt_widget.showItem(new_tree_item)
|
1001
|
-
rename_tree_item(new_tree_item, true)
|
861
|
+
|
862
|
+
def collapse_navigation_expand_bar_height
|
863
|
+
@navigation_expand_item_height = @navigation_expand_item.swt_expand_item.height if @navigation_expand_item.swt_expand_item.height > 0
|
864
|
+
@navigation_expand_item.swt_expand_item.height = 0
|
865
|
+
body_root.pack_same_size
|
866
|
+
async_exec { body_root.pack_same_size }
|
1002
867
|
end
|
1003
868
|
|
1004
|
-
def
|
1005
|
-
|
1006
|
-
|
1007
|
-
|
1008
|
-
end
|
1009
|
-
|
1010
|
-
def rename_tree_item(tree_item, new_file = false)
|
1011
|
-
original_file = tree_item.getData
|
1012
|
-
current_file = project_dir.selected_child_path == original_file.path
|
1013
|
-
found_tab_item = find_tab_item(original_file.path)
|
1014
|
-
found_text_editor = found_tab_item&.getData('text_editor')
|
1015
|
-
@file_tree.edit_tree_item(
|
1016
|
-
tree_item,
|
1017
|
-
after_write: -> (edited_tree_item) {
|
1018
|
-
file = edited_tree_item.getData
|
1019
|
-
file_path = file.path
|
1020
|
-
file.name
|
1021
|
-
if new_file
|
1022
|
-
project_dir.selected_child_path = file_path
|
1023
|
-
else
|
1024
|
-
found_text_editor&.file = file
|
1025
|
-
found_tab_item&.setData('file', file)
|
1026
|
-
found_tab_item&.setData('file_path', file.path)
|
1027
|
-
found_tab_item&.setText(file.name)
|
1028
|
-
body_root.pack_same_size
|
1029
|
-
if current_file
|
1030
|
-
project_dir.selected_child_path = file_path
|
1031
|
-
else
|
1032
|
-
selected_tab_item&.getData('text_editor')&.text_widget&.setFocus
|
1033
|
-
end
|
1034
|
-
async_exec {
|
1035
|
-
@file_tree.swt_widget.showItem(edited_tree_item)
|
1036
|
-
}
|
1037
|
-
end
|
1038
|
-
project_dir.resume_refresh
|
1039
|
-
},
|
1040
|
-
after_cancel: -> {
|
1041
|
-
project_dir.resume_refresh
|
1042
|
-
}
|
1043
|
-
)
|
869
|
+
def expand_navigation_expand_bar_height
|
870
|
+
@navigation_expand_item.swt_expand_item.height = @navigation_expand_item_height || 140
|
871
|
+
body_root.pack_same_size
|
872
|
+
async_exec { body_root.pack_same_size }
|
1044
873
|
end
|
1045
874
|
|
1046
875
|
def extract_char(event)
|
@@ -1052,27 +881,15 @@ module Glimmer
|
|
1052
881
|
def open_project
|
1053
882
|
selected_directory = directory_dialog.open
|
1054
883
|
return if selected_directory.nil?
|
1055
|
-
@
|
1056
|
-
text 'Gladiator'
|
1057
|
-
fill_layout(:vertical) {
|
1058
|
-
margin_width 15
|
1059
|
-
margin_height 15
|
1060
|
-
spacing 5
|
1061
|
-
}
|
1062
|
-
label(:center) {
|
1063
|
-
text "Opening Project: #{::File.basename(selected_directory)}"
|
1064
|
-
font height: 20
|
1065
|
-
}
|
1066
|
-
# @progress_bar = progress_bar(:horizontal, :indeterminate)
|
1067
|
-
}
|
884
|
+
@progress_shell = progress_shell(gladiator: self, progress_text: "Opening Project: #{::File.basename(selected_directory)}")
|
1068
885
|
async_exec {
|
1069
|
-
@
|
886
|
+
@progress_shell.open
|
1070
887
|
}
|
1071
888
|
async_exec {
|
1072
889
|
gladiator(project_dir_path: selected_directory) {
|
1073
890
|
on_swt_show {
|
1074
|
-
@
|
1075
|
-
@
|
891
|
+
@progress_shell.close
|
892
|
+
@progress_shell = nil
|
1076
893
|
}
|
1077
894
|
}.open if selected_directory
|
1078
895
|
}
|
@@ -1097,47 +914,33 @@ module Glimmer
|
|
1097
914
|
label {
|
1098
915
|
layout_data :fill, :fill, true, true
|
1099
916
|
background :white
|
1100
|
-
text "Gladiator v#{VERSION}\n\n#{LICENSE}\n\nGladiator icon made by Freepik from www.flaticon.com"
|
917
|
+
text "Gladiator v#{VERSION} (Beta)\n\n#{LICENSE}\n\nGladiator icon made by Freepik from www.flaticon.com"
|
1101
918
|
}
|
1102
919
|
}.open
|
1103
920
|
end
|
1104
921
|
|
1105
922
|
def handle_display_shortcut(key_event)
|
1106
923
|
if key_event.stateMask == swt(COMMAND_KEY) && extract_char(key_event) == 'f'
|
1107
|
-
|
1108
|
-
|
1109
|
-
find_text.swt_widget.setText current_text_editor.text_widget.getSelectionText
|
1110
|
-
end
|
1111
|
-
find_text.swt_widget.selectAll
|
1112
|
-
find_text.swt_widget.setFocus
|
1113
|
-
end
|
1114
|
-
if @navigation_expand_item.swt_expand_item.get_expanded
|
1115
|
-
find_action.call
|
1116
|
-
else
|
924
|
+
if !@navigation_expand_item.swt_expand_item.get_expanded
|
925
|
+
expand_navigation_expand_bar_height
|
1117
926
|
@navigation_expand_item.swt_expand_item.set_expanded true
|
1118
|
-
@navigation_expand_item.swt_expand_item.height = @navigation_expand_item_height if @navigation_expand_item_height
|
1119
|
-
async_exec {
|
1120
|
-
body_root.pack_same_size
|
1121
|
-
}
|
1122
|
-
async_exec(&find_action)
|
1123
927
|
end
|
928
|
+
if current_text_editor&.text_widget&.getSelectionText && current_text_editor&.text_widget&.getSelectionText&.size.to_i > 0
|
929
|
+
find_text.swt_widget.setText current_text_editor.text_widget.getSelectionText
|
930
|
+
end
|
931
|
+
find_text.swt_widget.selectAll
|
932
|
+
find_text.swt_widget.setFocus
|
1124
933
|
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask, COMMAND_KEY, :shift) && extract_char(key_event) == 'c'
|
1125
934
|
Clipboard.copy(project_dir.selected_child.path)
|
1126
935
|
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask, COMMAND_KEY, :shift) && extract_char(key_event) == 'g'
|
1127
936
|
project_dir.selected_child.find_previous
|
1128
|
-
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask, COMMAND_KEY, :shift) && extract_char(key_event) == '
|
1129
|
-
|
1130
|
-
|
1131
|
-
|
937
|
+
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask, COMMAND_KEY, :shift) && extract_char(key_event) == 'o'
|
938
|
+
self.maximized_pane = false
|
939
|
+
old_split_orientation = self.split_orientation
|
940
|
+
self.split_orientation = split_pane? && split_orientation == swt(:horizontal) ? swt(:vertical) : swt(:horizontal)
|
941
|
+
@tab_folder_sash_form.weights = [1, 1] if old_split_orientation.nil?
|
1132
942
|
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask, COMMAND_KEY, :shift) && extract_char(key_event) == 'w'
|
1133
|
-
|
1134
|
-
project_dir.selected_child_path_history.delete(tab_item.getData('file_path'))
|
1135
|
-
tab_item.getData('proxy')&.dispose
|
1136
|
-
end
|
1137
|
-
close_tab_folder
|
1138
|
-
self.current_tab_item = self.current_text_editor = project_dir.selected_child = nil
|
1139
|
-
filter_text.swt_widget.selectAll
|
1140
|
-
filter_text.swt_widget.setFocus
|
943
|
+
close_all_tabs
|
1141
944
|
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask, COMMAND_KEY, :alt) && extract_char(key_event) == 'w'
|
1142
945
|
other_tab_items.each do |tab_item|
|
1143
946
|
project_dir.selected_child_path_history.delete(tab_item.getData('file_path'))
|
@@ -1147,17 +950,22 @@ module Glimmer
|
|
1147
950
|
if selected_tab_item
|
1148
951
|
project_dir.selected_child_path_history.delete(project_dir.selected_child.path)
|
1149
952
|
selected_tab_item.getData('proxy')&.dispose
|
1150
|
-
close_tab_folder
|
953
|
+
close_tab_folder(single_tab: true)
|
954
|
+
# if self.current_tab_item.nil?
|
955
|
+
# filter_text.swt_widget.selectAll
|
956
|
+
# filter_text.swt_widget.setFocus
|
957
|
+
# else
|
958
|
+
# current_text_editor&.text_widget&.setFocus
|
959
|
+
# end
|
1151
960
|
if selected_tab_item.nil?
|
1152
961
|
self.current_tab_item = self.current_text_editor = project_dir.selected_child = nil
|
1153
962
|
filter_text.swt_widget.selectAll
|
1154
963
|
filter_text.swt_widget.setFocus
|
1155
964
|
else
|
1156
965
|
current_text_editor&.text_widget&.setFocus
|
966
|
+
# async_exec { current_text_editor&.text_widget&.setFocus }
|
1157
967
|
end
|
1158
968
|
end
|
1159
|
-
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask, COMMAND_KEY, :shift) && extract_char(key_event) == 'o'
|
1160
|
-
self.split_orientation = split_pane? && split_orientation == swt(:horizontal) ? swt(:vertical) : swt(:horizontal)
|
1161
969
|
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask, COMMAND_KEY, :shift) && extract_char(key_event) == ']'
|
1162
970
|
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
971
|
current_text_editor&.text_widget&.setFocus
|
@@ -1165,27 +973,9 @@ module Glimmer
|
|
1165
973
|
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
|
1166
974
|
current_text_editor&.text_widget&.setFocus
|
1167
975
|
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask, COMMAND_KEY, :ctrl) && extract_char(key_event) == ']'
|
1168
|
-
|
1169
|
-
if current_tab_folder == tab_folder1
|
1170
|
-
self.current_tab_folder = tab_folder2
|
1171
|
-
else
|
1172
|
-
self.current_tab_folder = tab_folder1
|
1173
|
-
end
|
1174
|
-
self.current_tab_item = current_tab_folder.swt_widget.getData('selected_tab_item')
|
1175
|
-
self.project_dir.selected_child = current_tab_item&.swt_tab_item&.getData('file')
|
1176
|
-
current_tab_item&.swt_tab_item&.getData('text_editor')&.text_widget&.setFocus
|
1177
|
-
end
|
976
|
+
navigate_to_next_tab_folder
|
1178
977
|
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask, COMMAND_KEY, :ctrl) && extract_char(key_event) == '['
|
1179
|
-
|
1180
|
-
if current_tab_folder == tab_folder2
|
1181
|
-
self.current_tab_folder = tab_folder1
|
1182
|
-
else
|
1183
|
-
self.current_tab_folder = tab_folder2
|
1184
|
-
end
|
1185
|
-
self.current_tab_item = current_tab_folder.swt_widget.getData('selected_tab_item')
|
1186
|
-
self.project_dir.selected_child = current_tab_item&.swt_tab_item&.getData('file')
|
1187
|
-
current_tab_item&.swt_tab_item&.getData('text_editor')&.text_widget&.setFocus
|
1188
|
-
end
|
978
|
+
navigate_to_previous_tab_folder
|
1189
979
|
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask, COMMAND_KEY) && extract_char(key_event) == '1'
|
1190
980
|
current_tab_folder.swt_widget.setSelection(0) if current_tab_folder.swt_widget.getItemCount >= 1
|
1191
981
|
current_text_editor&.text_widget&.setFocus
|
@@ -1231,6 +1021,7 @@ module Glimmer
|
|
1231
1021
|
line_number_text.swt_widget.setFocus
|
1232
1022
|
end
|
1233
1023
|
elsif key_event.stateMask == swt(COMMAND_KEY) && extract_char(key_event) == 'r'
|
1024
|
+
self.maximized_editor = false
|
1234
1025
|
unless @file_lookup_expand_item.swt_expand_item.get_expanded
|
1235
1026
|
@file_lookup_expand_item.swt_expand_item.set_expanded true
|
1236
1027
|
@file_lookup_expand_item.swt_expand_item.height = @file_lookup_expand_item_height if @file_lookup_expand_item_height
|
@@ -1239,13 +1030,14 @@ module Glimmer
|
|
1239
1030
|
filter_text.swt_widget.selectAll
|
1240
1031
|
filter_text.swt_widget.setFocus
|
1241
1032
|
elsif key_event.stateMask == swt(COMMAND_KEY) && extract_char(key_event) == 't'
|
1033
|
+
self.maximized_editor = false
|
1242
1034
|
unless @file_explorer_expand_item.swt_expand_item.get_expanded
|
1243
1035
|
@file_explorer_expand_item.swt_expand_item.set_expanded true
|
1244
1036
|
@file_explorer_expand_item.swt_expand_item.height = @file_explorer_expand_item_height if @file_explorer_expand_item_height
|
1245
1037
|
@side_bar_sash_form.weights = [@file_lookup_expand_bar_height, @file_explorer_expand_bar_height]
|
1246
1038
|
end
|
1247
|
-
select_tree_item
|
1248
|
-
|
1039
|
+
@file_explorer_tree.select_tree_item
|
1040
|
+
@file_explorer_tree.swt_widget.setFocus
|
1249
1041
|
elsif key_event.keyCode == swt(:esc)
|
1250
1042
|
if current_text_editor
|
1251
1043
|
project_dir.selected_child_path = current_text_editor.file.path
|