glimmer-cs-gladiator 0.7.2 → 0.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +50 -0
- data/README.md +72 -16
- data/VERSION +1 -1
- data/bin/gladiator +23 -2
- data/bin/gladiator-setup +80 -0
- data/bin/glimmer-cs-gladiator +22 -0
- data/glimmer-cs-gladiator.gemspec +17 -8
- data/images/glimmer-cs-gladiator-logo.png +0 -0
- data/lib/glimmer-cs-gladiator.rb +1 -0
- data/lib/glimmer-cs-gladiator/launch.rb +6 -0
- data/lib/models/glimmer/gladiator/command.rb +2 -2
- data/lib/models/glimmer/gladiator/dir.rb +10 -5
- data/lib/models/glimmer/gladiator/file.rb +133 -8
- data/lib/views/glimmer/gladiator.rb +494 -585
- data/lib/views/glimmer/gladiator/file_edit_menu.rb +67 -0
- data/lib/views/glimmer/gladiator/gladiator_menu_bar.rb +216 -0
- data/lib/views/glimmer/gladiator/progress_shell.rb +29 -0
- data/lib/views/glimmer/gladiator/text_editor.rb +24 -17
- metadata +30 -6
- data/bin/gladiator_runner.rb +0 -6
Binary file
|
data/lib/glimmer-cs-gladiator.rb
CHANGED
@@ -23,7 +23,7 @@ module Glimmer
|
|
23
23
|
command_history_for(file).last.next_command = command
|
24
24
|
end
|
25
25
|
command.do
|
26
|
-
command_history_for(file) << command unless command_history_for(file).last.method == :change_content! && method == :change_content!
|
26
|
+
command_history_for(file) << command unless command_history_for(file).last.method == :change_content! && method == :change_content!
|
27
27
|
else
|
28
28
|
command_history_for(file) << command
|
29
29
|
end
|
@@ -45,7 +45,7 @@ module Glimmer
|
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
|
-
attr_accessor :file, :method, :args, :previous_command, :next_command,
|
48
|
+
attr_accessor :file, :method, :args, :previous_command, :next_command,
|
49
49
|
:file_dirty_content, :file_caret_position, :file_selection_count, :previous_file_dirty_content, :previous_file_caret_position, :previous_file_selection_count
|
50
50
|
|
51
51
|
def initialize(file, method = nil, *args)
|
@@ -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', '.gladiator-scratchpad', '.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
|
|
@@ -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?
|
@@ -173,7 +177,8 @@ module Glimmer
|
|
173
177
|
# scratchpad scenario
|
174
178
|
if selected_path.empty? # Scratchpad
|
175
179
|
@selected_child&.write_dirty_content
|
176
|
-
|
180
|
+
@scratchpad = (self.selected_child = File.new('', project_dir.path)) if @scratchpad.nil? || @scratchpad.closed?
|
181
|
+
return @scratchpad
|
177
182
|
end
|
178
183
|
full_selected_path = selected_path.include?(project_dir.path) ? selected_path : ::File.join(project_dir.path, selected_path)
|
179
184
|
return if ::Dir.exist?(full_selected_path) ||
|
@@ -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
|
@@ -82,7 +145,13 @@ module Glimmer
|
|
82
145
|
end
|
83
146
|
|
84
147
|
def scratchpad?
|
85
|
-
path.to_s.empty?
|
148
|
+
path.to_s.empty? # TODO consider updating to set the .gladiator-scratchpad path directly
|
149
|
+
end
|
150
|
+
|
151
|
+
def scratchpad_file
|
152
|
+
scratchpad_file = ::File.join(project_dir.path, '.gladiator-scratchpad')
|
153
|
+
::File.write(scratchpad_file, content)
|
154
|
+
scratchpad_file
|
86
155
|
end
|
87
156
|
|
88
157
|
def backup_properties
|
@@ -141,6 +210,7 @@ module Glimmer
|
|
141
210
|
|
142
211
|
def change_content!(value)
|
143
212
|
self.dirty_content = value
|
213
|
+
format_dirty_content_for_writing!(force: true) if value.to_s.include?("\r\n")
|
144
214
|
update_line_number_from_caret_position(caret_position)
|
145
215
|
end
|
146
216
|
|
@@ -157,12 +227,17 @@ module Glimmer
|
|
157
227
|
end
|
158
228
|
|
159
229
|
def close
|
230
|
+
@closed = true
|
160
231
|
stop_filewatcher
|
161
232
|
remove_all_observers
|
162
233
|
initialize(path, project_dir)
|
163
234
|
Command.clear(self)
|
164
235
|
end
|
165
236
|
|
237
|
+
def closed?
|
238
|
+
@closed
|
239
|
+
end
|
240
|
+
|
166
241
|
def read_dirty_content
|
167
242
|
path.empty? ? '' : ::File.read(path)
|
168
243
|
end
|
@@ -198,14 +273,15 @@ module Glimmer
|
|
198
273
|
puts e.full_message
|
199
274
|
end
|
200
275
|
|
201
|
-
def format_dirty_content_for_writing!
|
202
|
-
return if @commmand_in_progress
|
203
|
-
# TODO f ix c ar e t pos it ion after formatting dirty content (diff?)
|
276
|
+
def format_dirty_content_for_writing!(force: false)
|
277
|
+
return if !force && @commmand_in_progress
|
204
278
|
new_dirty_content = dirty_content.to_s.split("\n").map {|line| line.strip.empty? ? line : line.rstrip }.join("\n")
|
205
279
|
new_dirty_content = "#{new_dirty_content.gsub("\r\n", "\n").gsub("\r", "\n").sub(/\n+\z/, '')}\n"
|
206
280
|
if new_dirty_content != self.dirty_content
|
207
281
|
@formatting_dirty_content_for_writing = true
|
282
|
+
caret_position_diff = dirty_content.to_s.size - new_dirty_content.size
|
208
283
|
self.dirty_content = new_dirty_content
|
284
|
+
self.caret_position = caret_position - caret_position_diff
|
209
285
|
@formatting_dirty_content_for_writing = false
|
210
286
|
end
|
211
287
|
end
|
@@ -456,21 +532,70 @@ module Glimmer
|
|
456
532
|
end
|
457
533
|
|
458
534
|
def home
|
459
|
-
self.selection_count = 0
|
460
535
|
self.line_number = 1
|
536
|
+
self.selection_count = 0
|
461
537
|
end
|
462
538
|
|
463
539
|
def end
|
464
|
-
self.selection_count = 0
|
465
540
|
self.line_number = lines.size
|
541
|
+
self.selection_count = 0
|
466
542
|
end
|
467
543
|
|
468
544
|
def start_of_line
|
469
545
|
self.caret_position = caret_position_for_line_index(self.line_number - 1)
|
546
|
+
self.selection_count = 0
|
470
547
|
end
|
471
548
|
|
472
549
|
def end_of_line
|
473
550
|
self.caret_position = caret_position_for_line_index(self.line_number) - 1
|
551
|
+
self.selection_count = 0
|
552
|
+
end
|
553
|
+
|
554
|
+
def select_to_start_of_line
|
555
|
+
old_caret_position = caret_position
|
556
|
+
self.caret_position = caret_position_for_line_index(self.line_number - 1)
|
557
|
+
self.selection_count = old_caret_position - caret_position
|
558
|
+
end
|
559
|
+
|
560
|
+
def select_to_end_of_line
|
561
|
+
self.caret_position = selection_count == 0 ? caret_position : caret_position + selection_count
|
562
|
+
self.selection_count = (caret_position_for_line_index(self.line_number) - 1) - caret_position
|
563
|
+
end
|
564
|
+
|
565
|
+
def delete!
|
566
|
+
new_dirty_content = dirty_content
|
567
|
+
new_dirty_content[caret_position...(caret_position + selection_count)] = ''
|
568
|
+
old_caret_position = caret_position
|
569
|
+
self.dirty_content = new_dirty_content
|
570
|
+
self.caret_position = old_caret_position
|
571
|
+
end
|
572
|
+
|
573
|
+
def cut!
|
574
|
+
Clipboard.copy(selected_text)
|
575
|
+
delete!
|
576
|
+
end
|
577
|
+
|
578
|
+
def copy
|
579
|
+
Clipboard.copy(selected_text)
|
580
|
+
end
|
581
|
+
|
582
|
+
def paste!
|
583
|
+
new_dirty_content = dirty_content
|
584
|
+
pasted_text = Clipboard.paste
|
585
|
+
new_dirty_content[caret_position...(caret_position + selection_count)] = pasted_text
|
586
|
+
old_caret_position = caret_position
|
587
|
+
self.dirty_content = new_dirty_content
|
588
|
+
self.caret_position = old_caret_position + pasted_text.to_s.size
|
589
|
+
self.selection_count = 0
|
590
|
+
end
|
591
|
+
|
592
|
+
def select_all
|
593
|
+
self.caret_position = 0
|
594
|
+
self.selection_count = dirty_content.to_s.size
|
595
|
+
end
|
596
|
+
|
597
|
+
def selected_text
|
598
|
+
dirty_content.to_s[caret_position, selection_count]
|
474
599
|
end
|
475
600
|
|
476
601
|
def move_up!
|
@@ -513,13 +638,13 @@ module Glimmer
|
|
513
638
|
|
514
639
|
def run
|
515
640
|
if scratchpad?
|
516
|
-
|
641
|
+
load scratchpad_file
|
517
642
|
else
|
518
643
|
write_dirty_content
|
519
644
|
load path
|
520
645
|
end
|
521
646
|
end
|
522
|
-
|
647
|
+
|
523
648
|
def lines
|
524
649
|
need_padding = dirty_content.to_s.end_with?("\n")
|
525
650
|
splittable_content = need_padding ? "#{dirty_content} " : dirty_content
|
@@ -29,6 +29,9 @@ require 'models/glimmer/gladiator/command'
|
|
29
29
|
require 'views/glimmer/gladiator/text_editor'
|
30
30
|
require 'views/glimmer/gladiator/file_lookup_list'
|
31
31
|
require 'views/glimmer/gladiator/file_explorer_tree'
|
32
|
+
require 'views/glimmer/gladiator/gladiator_menu_bar'
|
33
|
+
require 'views/glimmer/gladiator/progress_shell'
|
34
|
+
require 'views/glimmer/gladiator/file_edit_menu'
|
32
35
|
|
33
36
|
Clipboard.implementation = Clipboard::Java
|
34
37
|
Clipboard.copy(Clipboard.paste) # pre-initialize library to avoid slowdown during use
|
@@ -41,6 +44,7 @@ module Glimmer
|
|
41
44
|
APP_ROOT = ::File.expand_path('../../../..', __FILE__)
|
42
45
|
# TODO make sure COMMAND_KEY doesn't clash on Linux/Windows for CMD+CTRL shortcuts
|
43
46
|
COMMAND_KEY = OS.mac? ? :command : :ctrl
|
47
|
+
CONTROL_KEY = OS.mac? ? :ctrl : :alt
|
44
48
|
VERSION = ::File.read(::File.join(APP_ROOT, 'VERSION')).to_s.strip
|
45
49
|
LICENSE = ::File.read(::File.join(APP_ROOT, 'LICENSE.txt')).to_s.strip
|
46
50
|
ICON = ::File.expand_path(::File.join(APP_ROOT, 'images', 'glimmer-cs-gladiator-logo.png'))
|
@@ -58,6 +62,11 @@ module Glimmer
|
|
58
62
|
# option :height, 240
|
59
63
|
option :project_dir_path
|
60
64
|
|
65
|
+
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
|
66
|
+
attr_accessor :current_tab_item, :current_tab_folder, :current_text_editor, :tab_folder1, :tab_folder2, :maximized_pane, :maximized_editor
|
67
|
+
alias maximized_pane? maximized_pane
|
68
|
+
alias maximized_editor? maximized_editor
|
69
|
+
|
61
70
|
def project_dir
|
62
71
|
@project_dir ||= Dir.new(project_dir_path)
|
63
72
|
end
|
@@ -80,10 +89,9 @@ module Glimmer
|
|
80
89
|
pane_count && pane_count > 1
|
81
90
|
end
|
82
91
|
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
alias maximized_editor? maximized_editor
|
92
|
+
def app_mode?
|
93
|
+
project_dir_path == '.' && ENV['APP_MODE'].to_s == 'true' || !::Dir.glob(::File.join(project_dir_path, 'glimmer-cs-gladiator.jar')).empty?
|
94
|
+
end
|
87
95
|
|
88
96
|
## Uncomment before_body block to pre-initialize variables to use in body
|
89
97
|
#
|
@@ -95,6 +103,7 @@ module Glimmer
|
|
95
103
|
project_dir.selected_child&.write_raw_dirty_content
|
96
104
|
end
|
97
105
|
Display.setAppName('Gladiator')
|
106
|
+
Display.setAppVersion(VERSION)
|
98
107
|
# make sure the display events are only hooked once if multiple gladiators are created
|
99
108
|
unless defined?(@@display)
|
100
109
|
@@display = display {
|
@@ -102,23 +111,27 @@ module Glimmer
|
|
102
111
|
on_about {
|
103
112
|
display_about_dialog
|
104
113
|
}
|
114
|
+
on_quit {
|
115
|
+
display.swt_display.shells.each { |shell|
|
116
|
+
gladiator = shell.get_data('custom_shell')
|
117
|
+
gladiator.project_dir.selected_child&.write_dirty_content
|
118
|
+
shell.close
|
119
|
+
}
|
120
|
+
}
|
105
121
|
on_swt_keydown { |key_event|
|
106
122
|
focused_gladiator = display.focus_control.shell&.get_data('custom_shell')
|
107
|
-
focused_gladiator.handle_display_shortcut(key_event) if !focused_gladiator.nil? && key_event.widget.shell == focused_gladiator&.swt_widget
|
108
|
-
}
|
109
|
-
on_swt_Close {
|
110
|
-
save_config
|
111
|
-
project_dir.selected_child&.write_dirty_content
|
123
|
+
focused_gladiator.handle_display_shortcut(key_event) if !focused_gladiator.nil? && focused_gladiator.is_a?(Glimmer::Gladiator) && key_event.widget.shell == focused_gladiator&.swt_widget
|
112
124
|
}
|
113
125
|
}
|
114
126
|
end
|
115
127
|
|
116
128
|
@default_foreground = :dark_blue
|
117
129
|
@split_orientation = swt(:horizontal)
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
130
|
+
unless app_mode?
|
131
|
+
@config_file_path = ::File.join(project_dir.path, '.gladiator')
|
132
|
+
@config = {}
|
133
|
+
load_config_ignore_paths
|
134
|
+
end
|
122
135
|
}
|
123
136
|
|
124
137
|
## Uncomment after_body block to setup observers for widgets in body
|
@@ -132,7 +145,7 @@ module Glimmer
|
|
132
145
|
if Gladiator.drag && !@tab_folder2
|
133
146
|
self.tab_folder1 = current_tab_folder
|
134
147
|
@tab_folder_sash_form.content {
|
135
|
-
self.current_tab_folder = self.tab_folder2 =
|
148
|
+
self.current_tab_folder = self.tab_folder2 = text_editor_group_tab_folder
|
136
149
|
@current_tab_folder.swt_widget.setData('proxy', @current_tab_folder)
|
137
150
|
}
|
138
151
|
body_root.pack_same_size
|
@@ -144,54 +157,63 @@ module Glimmer
|
|
144
157
|
@current_tab_item = found_tab_item.getData('proxy')
|
145
158
|
@current_text_editor = found_tab_item.getData('text_editor') unless found_tab_item.getData('text_editor').nil?
|
146
159
|
@current_tab_folder.swt_widget.setData('selected_tab_item', @current_tab_item)
|
147
|
-
|
148
|
-
|
149
|
-
@
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
160
|
+
else
|
161
|
+
begin
|
162
|
+
@current_tab_folder.content {
|
163
|
+
@current_tab_item = tab_item { |the_tab_item|
|
164
|
+
text selected_file.name
|
165
|
+
fill_layout(:horizontal) {
|
166
|
+
margin_width 0
|
167
|
+
margin_height 0
|
168
|
+
}
|
169
|
+
tab_folder = nil
|
170
|
+
the_text_editor = nil
|
171
|
+
the_tab_item.content {
|
172
|
+
@current_text_editor = the_text_editor = text_editor(project_dir: project_dir, file: selected_file) {
|
173
|
+
layout_data :fill, :fill, true, true
|
174
|
+
}
|
175
|
+
@current_tab_folder.swt_widget.setData('selected_tab_item', @current_tab_item)
|
176
|
+
the_tab_item.swt_tab_item.setData('text_editor', @current_text_editor)
|
177
|
+
@current_text_editor.text_proxy.content {
|
178
|
+
on_focus_gained {
|
179
|
+
tab_folder = the_text_editor.swt_widget.getParent.getParent
|
180
|
+
self.current_tab_folder = tab_folder.getData('proxy')
|
181
|
+
@current_tab_item = the_tab_item
|
182
|
+
@current_text_editor = the_text_editor
|
183
|
+
@current_tab_folder.swt_widget.setData('selected_tab_item', @current_tab_item)
|
184
|
+
@current_tab_folder.swt_widget.setSelection(@current_tab_item.swt_tab_item)
|
185
|
+
project_dir.selected_child = @current_tab_item.swt_tab_item.getData('file')
|
186
|
+
}
|
170
187
|
}
|
171
188
|
}
|
189
|
+
on_swt_show {
|
190
|
+
@current_tab_item = the_tab_item
|
191
|
+
@current_text_editor = the_text_editor
|
192
|
+
self.current_tab_folder = @current_tab_item.swt_widget.getParent.getData('proxy')
|
193
|
+
@current_tab_folder.swt_widget.setData('selected_tab_item', @current_tab_item)
|
194
|
+
@current_tab_folder.swt_widget.setSelection(@current_tab_item.swt_tab_item)
|
195
|
+
project_dir.selected_child = selected_file
|
196
|
+
@current_text_editor&.load_content
|
197
|
+
@current_text_editor&.text_widget&.setFocus
|
198
|
+
save_config unless selected_file.nil?
|
199
|
+
}
|
200
|
+
on_widget_disposed {
|
201
|
+
project_dir.selected_child&.write_dirty_content
|
202
|
+
tab_item_file = the_tab_item.swt_tab_item.get_data('file')
|
203
|
+
if (@tab_folder1 != @current_tab_folder && !@tab_folder1&.items&.detect {|ti| ti.get_data('file') == tab_item_file}) || (@tab_folder2 != @current_tab_folder && !@tab_folder2&.items&.detect {|ti| ti.get_data('file') == tab_item_file})
|
204
|
+
tab_item_file.close
|
205
|
+
end
|
206
|
+
}
|
172
207
|
}
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
@current_text_editor = the_text_editor
|
177
|
-
self.current_tab_folder = @current_tab_item.swt_widget.getParent.getData('proxy')
|
178
|
-
@current_tab_folder.swt_widget.setData('selected_tab_item', @current_tab_item)
|
179
|
-
@current_tab_folder.swt_widget.setSelection(@current_tab_item.swt_tab_item)
|
180
|
-
project_dir.selected_child = selected_file
|
181
|
-
@current_text_editor&.text_widget&.setFocus
|
182
|
-
}
|
183
|
-
on_widget_disposed {
|
184
|
-
project_dir.selected_child&.write_dirty_content
|
185
|
-
tab_item_file = the_tab_item.swt_tab_item.get_data('file')
|
186
|
-
tab_item_file.close unless [@tab_folder1, @tab_folder2].compact.map(&:items).flatten(1).detect {|ti| ti.get_data('file') == tab_item_file}
|
187
|
-
}
|
208
|
+
@current_tab_item.swt_tab_item.setData('file_path', selected_file.path)
|
209
|
+
@current_tab_item.swt_tab_item.setData('file', selected_file)
|
210
|
+
@current_tab_item.swt_tab_item.setData('proxy', @current_tab_item)
|
188
211
|
}
|
189
|
-
@
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
body_root.pack_same_size
|
212
|
+
@current_tab_folder.swt_widget.setSelection(@current_tab_item.swt_tab_item)
|
213
|
+
body_root.pack_same_size
|
214
|
+
rescue => e
|
215
|
+
Glimmer::Config.logger.error {e.full_message}
|
216
|
+
end
|
195
217
|
end
|
196
218
|
@current_text_editor&.text_widget&.setFocus
|
197
219
|
end
|
@@ -221,546 +243,463 @@ module Glimmer
|
|
221
243
|
observe(project_dir, 'selected_child.top_pixel') do
|
222
244
|
save_config
|
223
245
|
end
|
224
|
-
load_config
|
246
|
+
load_config unless app_mode?
|
225
247
|
}
|
226
248
|
|
227
249
|
## Add widget content inside custom shell body
|
228
250
|
## Top-most widget must be a shell or another custom shell
|
229
251
|
#
|
230
252
|
body {
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
253
|
+
if app_mode?
|
254
|
+
shell {
|
255
|
+
text 'Gladiator'
|
256
|
+
minimum_size 250, 250
|
257
|
+
image ICON
|
258
|
+
gladiator_menu_bar(gladiator: self, editing: false)
|
259
|
+
|
260
|
+
button {
|
261
|
+
text 'Open Project...'
|
262
|
+
|
263
|
+
on_widget_selected {
|
264
|
+
open_project
|
265
|
+
}
|
266
|
+
}
|
241
267
|
}
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
268
|
+
else
|
269
|
+
shell {
|
270
|
+
text "Gladiator - #{::File.expand_path(project_dir.path)}"
|
271
|
+
minimum_size 590, 250
|
272
|
+
image ICON
|
273
|
+
|
274
|
+
on_swt_show {
|
275
|
+
unless @shell_visible
|
276
|
+
if @config[:shell_width] && @config[:shell_height]
|
277
|
+
swt_widget.set_size(@config[:shell_width], @config[:shell_height])
|
278
|
+
else
|
279
|
+
swt_widget.set_size(display.bounds.width, display.bounds.height)
|
280
|
+
end
|
281
|
+
end
|
282
|
+
swt_widget.setLocation(@config[:shell_x], @config[:shell_y]) if @config[:shell_x] && @config[:shell_y]
|
283
|
+
@loaded_config = true
|
284
|
+
@shell_visible = true
|
285
|
+
}
|
286
|
+
|
287
|
+
on_shell_closed {
|
288
|
+
project_dir.selected_child&.write_dirty_content
|
289
|
+
if @tab_folder2
|
290
|
+
current_tab_folder.swt_widget.getItems.each do |tab_item|
|
291
|
+
tab_item.getData('proxy')&.dispose
|
292
|
+
end
|
293
|
+
close_tab_folder
|
294
|
+
end
|
247
295
|
current_tab_folder.swt_widget.getItems.each do |tab_item|
|
248
296
|
tab_item.getData('proxy')&.dispose
|
249
297
|
end
|
250
|
-
|
251
|
-
end
|
252
|
-
current_tab_folder.swt_widget.getItems.each do |tab_item|
|
253
|
-
tab_item.getData('proxy')&.dispose
|
254
|
-
end
|
255
|
-
body_root.close unless current_tab_folder.swt_widget.getItems.empty?
|
256
|
-
}
|
257
|
-
on_widget_disposed {
|
258
|
-
project_dir.selected_child&.write_dirty_content
|
259
|
-
}
|
260
|
-
on_control_resized {
|
261
|
-
save_config
|
262
|
-
}
|
263
|
-
on_control_moved {
|
264
|
-
save_config
|
265
|
-
}
|
266
|
-
on_shell_deactivated {
|
267
|
-
project_dir.selected_child&.write_dirty_content
|
268
|
-
}
|
269
|
-
|
270
|
-
if OS.mac?
|
271
|
-
display.swt_display.system_menu.items.find {|mi| mi.id == swt(:id_quit)}.add_selection_listener {
|
272
|
-
save_config
|
273
|
-
project_dir.selected_child&.write_dirty_content
|
274
|
-
display.swt_display.shells.each(&:close)
|
298
|
+
body_root.close unless current_tab_folder.swt_widget.getItems.empty?
|
275
299
|
}
|
276
|
-
|
277
|
-
|
278
|
-
menu_bar {
|
279
|
-
menu {
|
280
|
-
text '&File'
|
281
|
-
|
282
|
-
menu_item {
|
283
|
-
text 'New &Scratchpad'
|
284
|
-
accelerator COMMAND_KEY, :shift, :s
|
285
|
-
on_widget_selected {
|
286
|
-
project_dir.selected_child_path = ''
|
287
|
-
}
|
288
|
-
}
|
289
|
-
menu_item {
|
290
|
-
text 'Open &Project...'
|
291
|
-
accelerator COMMAND_KEY, :o
|
292
|
-
on_widget_selected {
|
293
|
-
open_project
|
294
|
-
}
|
295
|
-
}
|
296
|
-
menu_item(:separator)
|
297
|
-
menu_item {
|
298
|
-
text '&Quit Project'
|
299
|
-
accelerator COMMAND_KEY, :alt, :q
|
300
|
-
on_widget_selected {
|
301
|
-
save_config
|
302
|
-
project_dir.selected_child&.write_dirty_content
|
303
|
-
body_root.close
|
304
|
-
}
|
305
|
-
}
|
300
|
+
on_widget_disposed {
|
301
|
+
project_dir.selected_child&.write_dirty_content
|
306
302
|
}
|
307
|
-
|
308
|
-
|
309
|
-
menu {
|
310
|
-
text '&Split Pane'
|
311
|
-
menu { |menu_proxy|
|
312
|
-
text '&Orientation'
|
313
|
-
menu_item(:radio) {
|
314
|
-
text '&Horizontal'
|
315
|
-
selection bind(self, :split_orientation,
|
316
|
-
on_read: ->(o) { split_pane? && o == swt(:horizontal) },
|
317
|
-
on_write: ->(b) { b.nil? ? nil : (b ? swt(:horizontal) : swt(:vertical)) })
|
318
|
-
}
|
319
|
-
menu_item(:radio) {
|
320
|
-
text '&Vertical'
|
321
|
-
selection bind(self, :split_orientation,
|
322
|
-
on_read: ->(o) { split_pane? && o == swt(:vertical) },
|
323
|
-
on_write: ->(b) { b.nil? ? nil : (b ? swt(:vertical) : swt(:horizontal)) })
|
324
|
-
}
|
325
|
-
}
|
326
|
-
menu_item(:check) {
|
327
|
-
text '&Maximize Pane'
|
328
|
-
enabled bind(self, :tab_folder2)
|
329
|
-
accelerator COMMAND_KEY, :shift, :m
|
330
|
-
selection bind(self, :maximized_pane)
|
331
|
-
}
|
332
|
-
menu_item {
|
333
|
-
text 'Reset &Panes'
|
334
|
-
enabled bind(self, :tab_folder2)
|
335
|
-
accelerator COMMAND_KEY, :shift, :p
|
336
|
-
on_widget_selected {
|
337
|
-
if tab_folder2
|
338
|
-
self.maximized_pane = false
|
339
|
-
@tab_folder_sash_form.weights = [1, 1]
|
340
|
-
end
|
341
|
-
}
|
342
|
-
}
|
343
|
-
menu_item {
|
344
|
-
text '&Unsplit'
|
345
|
-
enabled bind(self, :tab_folder2)
|
346
|
-
accelerator COMMAND_KEY, :shift, :u
|
347
|
-
on_widget_selected {
|
348
|
-
if tab_folder2
|
349
|
-
self.maximized_pane = false
|
350
|
-
navigate_to_next_tab_folder if current_tab_folder != tab_folder2
|
351
|
-
close_all_tabs(tab_folder2)
|
352
|
-
self.split_orientation = nil
|
353
|
-
body_root.pack_same_size
|
354
|
-
end
|
355
|
-
}
|
356
|
-
}
|
357
|
-
}
|
358
|
-
menu_item(:check) {
|
359
|
-
text '&Maximize Editor'
|
360
|
-
accelerator COMMAND_KEY, :ctrl, :m
|
361
|
-
selection bind(self, :maximized_editor)
|
362
|
-
}
|
363
|
-
menu_item {
|
364
|
-
text '&Reset All'
|
365
|
-
accelerator COMMAND_KEY, :ctrl, :r
|
366
|
-
on_widget_selected {
|
367
|
-
self.maximized_editor = false
|
368
|
-
@file_area_and_editor_area_sash_form.weights = [1, 5]
|
369
|
-
@side_bar_sash_form.weights = [1, 1]
|
370
|
-
}
|
371
|
-
}
|
303
|
+
on_control_resized {
|
304
|
+
save_config
|
372
305
|
}
|
373
|
-
|
374
|
-
|
375
|
-
# menu_item {
|
376
|
-
# text 'Launch Glimmer &App'
|
377
|
-
# on_widget_selected {
|
378
|
-
# parent_path = project_dir.path
|
379
|
-
## current_directory_name = ::File.basename(parent_path)
|
380
|
-
## assumed_shell_script = ::File.join(parent_path, 'bin', current_directory_name)
|
381
|
-
## 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)
|
382
|
-
## load assumed_shell_script
|
383
|
-
# FileUtils.cd(parent_path) do
|
384
|
-
# system 'glimmer run'
|
385
|
-
# end
|
386
|
-
# }
|
387
|
-
# }
|
388
|
-
menu_item {
|
389
|
-
text '&Ruby'
|
390
|
-
accelerator COMMAND_KEY, :shift, :r
|
391
|
-
on_widget_selected {
|
392
|
-
begin
|
393
|
-
project_dir.selected_child.run
|
394
|
-
rescue Exception => e
|
395
|
-
dialog {
|
396
|
-
text 'Run - Ruby - Error Encountered!'
|
397
|
-
label {
|
398
|
-
text e.full_message
|
399
|
-
}
|
400
|
-
}.open
|
401
|
-
end
|
402
|
-
}
|
403
|
-
}
|
306
|
+
on_control_moved {
|
307
|
+
save_config
|
404
308
|
}
|
405
|
-
|
406
|
-
|
407
|
-
menu_item {
|
408
|
-
text '&About'
|
409
|
-
accelerator COMMAND_KEY, :shift, :a
|
410
|
-
on_widget_selected {
|
411
|
-
display_about_dialog
|
412
|
-
}
|
413
|
-
}
|
309
|
+
on_shell_deactivated {
|
310
|
+
project_dir.selected_child&.write_dirty_content
|
414
311
|
}
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
@side_bar_sash_form = sash_form(:vertical) {
|
427
|
-
layout_data(:fill, :fill, true, true)
|
428
|
-
sash_width 4
|
429
|
-
|
430
|
-
resize_expand_items = lambda { |event=nil|
|
431
|
-
@file_lookup_expand_item&.swt_expand_item&.height = @file_lookup_expand_bar.size.y - @file_lookup_expand_item.swt_expand_item.header_height
|
432
|
-
@file_explorer_expand_item&.swt_expand_item&.height = @file_explorer_expand_bar.size.y - @file_explorer_expand_item.swt_expand_item.header_height
|
312
|
+
|
313
|
+
# Menu Bar
|
314
|
+
gladiator_menu_bar(gladiator: self, editing: true)
|
315
|
+
|
316
|
+
@file_area_and_editor_area_sash_form = sash_form(:horizontal) {
|
317
|
+
weights 1, 5
|
318
|
+
|
319
|
+
composite {
|
320
|
+
grid_layout(1, false) {
|
321
|
+
margin_width 0
|
322
|
+
margin_height 0
|
433
323
|
}
|
434
324
|
|
435
|
-
@
|
436
|
-
layout_data
|
437
|
-
|
438
|
-
foreground @default_foreground
|
325
|
+
@side_bar_sash_form = sash_form(:vertical) {
|
326
|
+
layout_data(:fill, :fill, true, true)
|
327
|
+
sash_width 4
|
439
328
|
|
440
|
-
|
441
|
-
@file_lookup_expand_item
|
329
|
+
resize_expand_items = lambda { |event=nil|
|
330
|
+
@file_lookup_expand_item&.swt_expand_item&.height = @file_lookup_expand_bar.size.y - @file_lookup_expand_item.swt_expand_item.header_height
|
331
|
+
@file_explorer_expand_item&.swt_expand_item&.height = @file_explorer_expand_bar.size.y - @file_explorer_expand_item.swt_expand_item.header_height
|
442
332
|
}
|
443
333
|
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
334
|
+
@file_lookup_expand_bar = expand_bar {
|
335
|
+
layout_data :fill, :fill, true, true
|
336
|
+
font height: 17, style: :bold
|
337
|
+
foreground @default_foreground
|
338
|
+
|
339
|
+
on_swt_show {
|
340
|
+
@file_lookup_expand_item.swt_expand_item.height = @file_lookup_expand_bar.size.y - @file_lookup_expand_item.swt_expand_item.header_height
|
450
341
|
}
|
451
|
-
text 'File Lookup'
|
452
|
-
height display.bounds.height
|
453
342
|
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
343
|
+
on_swt_Resize(&resize_expand_items)
|
344
|
+
|
345
|
+
@file_lookup_expand_item = expand_item {
|
346
|
+
grid_layout {
|
347
|
+
margin_width 0
|
348
|
+
margin_height 0
|
349
|
+
}
|
350
|
+
text 'File Lookup'
|
351
|
+
height display.bounds.height
|
352
|
+
|
353
|
+
@filter_text = text {
|
354
|
+
layout_data :fill, :center, true, false
|
355
|
+
text bind(project_dir, 'filter')
|
356
|
+
on_key_pressed { |key_event|
|
357
|
+
if key_event.keyCode == swt(:tab) ||
|
358
|
+
key_event.keyCode == swt(:cr) ||
|
359
|
+
key_event.keyCode == swt(:arrow_up) ||
|
360
|
+
key_event.keyCode == swt(:arrow_down)
|
361
|
+
@file_lookup_list.swt_widget.select(0) if @file_lookup_list.swt_widget.getSelectionIndex() == -1
|
362
|
+
@file_lookup_list.swt_widget.setFocus
|
363
|
+
end
|
364
|
+
}
|
365
|
+
}
|
366
|
+
|
367
|
+
@file_lookup_list = file_lookup_list(gladiator: self, foreground_color: @default_foreground) {
|
368
|
+
layout_data :fill, :fill, true, true
|
465
369
|
}
|
466
370
|
}
|
467
|
-
|
468
|
-
|
469
|
-
|
371
|
+
|
372
|
+
on_item_collapsed { |event|
|
373
|
+
if @file_explorer_expand_item.swt_expand_item.get_expanded
|
374
|
+
@file_lookup_expand_item_height = @file_lookup_expand_item.swt_expand_item.height
|
375
|
+
@file_lookup_expand_item.swt_expand_item.height = 0
|
376
|
+
@file_lookup_expand_bar_height = @file_lookup_expand_bar.swt_widget.size.y
|
377
|
+
@file_explorer_expand_bar_height = @file_explorer_expand_bar.swt_widget.size.y
|
378
|
+
@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]
|
379
|
+
end
|
470
380
|
}
|
471
|
-
}
|
472
381
|
|
473
|
-
|
474
|
-
|
475
|
-
@
|
476
|
-
|
477
|
-
|
478
|
-
@file_explorer_expand_bar_height = @file_explorer_expand_bar.swt_widget.size.y
|
479
|
-
@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]
|
480
|
-
end
|
481
|
-
}
|
482
|
-
|
483
|
-
on_item_expanded {
|
484
|
-
@file_lookup_expand_item.swt_expand_item.height = @file_lookup_expand_item_height if @file_lookup_expand_item_height
|
485
|
-
@side_bar_sash_form.weights = [@file_lookup_expand_bar_height, @file_explorer_expand_bar_height]
|
486
|
-
}
|
487
|
-
|
488
|
-
}
|
489
|
-
|
490
|
-
@file_explorer_expand_bar = expand_bar {
|
491
|
-
layout_data :fill, :fill, true, true
|
492
|
-
font height: 17, style: :bold
|
493
|
-
foreground @default_foreground
|
494
|
-
|
495
|
-
on_swt_show {
|
496
|
-
@file_explorer_expand_item.swt_expand_item.height = @file_explorer_expand_bar.size.y - @file_explorer_expand_item.swt_expand_item.header_height
|
382
|
+
on_item_expanded {
|
383
|
+
@file_lookup_expand_item.swt_expand_item.height = @file_lookup_expand_item_height if @file_lookup_expand_item_height
|
384
|
+
@side_bar_sash_form.weights = [@file_lookup_expand_bar_height, @file_explorer_expand_bar_height]
|
385
|
+
}
|
386
|
+
|
497
387
|
}
|
498
388
|
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
389
|
+
@file_explorer_expand_bar = expand_bar {
|
390
|
+
layout_data :fill, :fill, true, true
|
391
|
+
font height: 17, style: :bold
|
392
|
+
foreground @default_foreground
|
393
|
+
|
394
|
+
on_swt_show {
|
395
|
+
@file_explorer_expand_item.swt_expand_item.height = @file_explorer_expand_bar.size.y - @file_explorer_expand_item.swt_expand_item.header_height
|
505
396
|
}
|
506
|
-
text 'File Explorer'
|
507
|
-
height display.bounds.height
|
508
397
|
|
509
|
-
|
510
|
-
|
398
|
+
on_swt_Resize(&resize_expand_items)
|
399
|
+
|
400
|
+
@file_explorer_expand_item = expand_item {
|
401
|
+
grid_layout {
|
402
|
+
margin_width 0
|
403
|
+
margin_height 0
|
404
|
+
}
|
405
|
+
text 'File Explorer'
|
406
|
+
height display.bounds.height
|
407
|
+
|
408
|
+
@file_explorer_tree = file_explorer_tree(gladiator: self, foreground_color: @default_foreground) {
|
409
|
+
layout_data :fill, :fill, true, true
|
410
|
+
}
|
411
|
+
}
|
412
|
+
|
413
|
+
on_item_collapsed { |event|
|
414
|
+
if @file_lookup_expand_item.swt_expand_item.get_expanded
|
415
|
+
@file_explorer_expand_item_height = @file_explorer_expand_item.swt_expand_item.height
|
416
|
+
@file_explorer_expand_item.swt_expand_item.height = 0
|
417
|
+
@file_explorer_expand_bar_height = @file_explorer_expand_bar.swt_widget.size.y
|
418
|
+
@file_lookup_expand_bar_height = @file_lookup_expand_bar.swt_widget.size.y
|
419
|
+
@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]
|
420
|
+
end
|
511
421
|
}
|
512
|
-
}
|
513
422
|
|
514
|
-
|
515
|
-
|
516
|
-
@
|
517
|
-
|
518
|
-
|
519
|
-
@file_lookup_expand_bar_height = @file_lookup_expand_bar.swt_widget.size.y
|
520
|
-
@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]
|
521
|
-
end
|
522
|
-
}
|
523
|
-
|
524
|
-
on_item_expanded {
|
525
|
-
@file_explorer_expand_item.swt_expand_item.height = @file_explorer_expand_item_height if @file_explorer_expand_item_height
|
526
|
-
@side_bar_sash_form.weights = [@file_lookup_expand_bar_height, @file_explorer_expand_bar_height]
|
423
|
+
on_item_expanded {
|
424
|
+
@file_explorer_expand_item.swt_expand_item.height = @file_explorer_expand_item_height if @file_explorer_expand_item_height
|
425
|
+
@side_bar_sash_form.weights = [@file_lookup_expand_bar_height, @file_explorer_expand_bar_height]
|
426
|
+
}
|
427
|
+
|
527
428
|
}
|
528
|
-
|
529
|
-
}
|
530
|
-
|
531
|
-
}
|
532
429
|
|
533
|
-
|
534
|
-
|
535
|
-
@editor_area_composite = composite {
|
536
|
-
grid_layout(1, false) {
|
537
|
-
margin_width 0
|
538
|
-
margin_height 0
|
430
|
+
}
|
431
|
+
|
539
432
|
}
|
540
433
|
|
541
|
-
@
|
542
|
-
|
543
|
-
|
544
|
-
|
434
|
+
@editor_area_composite = composite {
|
435
|
+
grid_layout(1, false) {
|
436
|
+
margin_width 0
|
437
|
+
margin_height 0
|
438
|
+
}
|
545
439
|
|
546
|
-
@
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
grid_layout(5, false) {
|
551
|
-
margin_right 5
|
440
|
+
@navigation_expand_bar = expand_bar {
|
441
|
+
layout_data(:fill, :top, true, false) {
|
442
|
+
minimum_width 480
|
552
443
|
}
|
444
|
+
font height: 17, style: :bold
|
445
|
+
foreground @default_foreground
|
553
446
|
|
554
|
-
|
555
|
-
|
556
|
-
|
447
|
+
@navigation_expand_item = expand_item {
|
448
|
+
text 'Navigation'
|
449
|
+
height 115
|
557
450
|
|
558
|
-
|
559
|
-
|
560
|
-
text 'File:'
|
561
|
-
foreground @default_foreground
|
562
|
-
}
|
563
|
-
|
564
|
-
@file_path_label = styled_text(:none) {
|
565
|
-
layout_data(:fill, :center, true, false) {
|
566
|
-
horizontal_span 2
|
451
|
+
grid_layout(5, false) {
|
452
|
+
margin_right 5
|
567
453
|
}
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
454
|
+
|
455
|
+
stat_font = {name: 'Consolas', height: OS.mac? ? 15 : 12}
|
456
|
+
|
457
|
+
# row 1
|
458
|
+
|
459
|
+
label {
|
460
|
+
layout_data(:left, :center, false, false)
|
461
|
+
text 'File:'
|
462
|
+
foreground @default_foreground
|
575
463
|
}
|
576
|
-
|
577
|
-
|
464
|
+
|
465
|
+
@file_path_label = styled_text(:none) {
|
466
|
+
layout_data(:fill, :center, true, false) {
|
467
|
+
horizontal_span 2
|
468
|
+
}
|
469
|
+
background color(:widget_background)
|
470
|
+
foreground @default_foreground
|
471
|
+
editable false
|
472
|
+
caret nil
|
473
|
+
text bind(project_dir, 'selected_child.path')
|
474
|
+
on_mouse_up {
|
475
|
+
@file_path_label.swt_widget.selectAll
|
476
|
+
}
|
477
|
+
on_focus_lost {
|
478
|
+
@file_path_label.swt_widget.setSelection(0, 0)
|
479
|
+
}
|
578
480
|
}
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
label(:right) {
|
587
|
-
layout_data(:fill, :center, true, false)
|
588
|
-
text bind(project_dir, 'selected_child.caret_position')
|
589
|
-
foreground @default_foreground
|
590
|
-
font stat_font
|
591
|
-
}
|
592
|
-
|
593
|
-
# row 2
|
594
|
-
|
595
|
-
label {
|
596
|
-
layout_data(:left, :center, false, false)
|
597
|
-
text 'Line:'
|
598
|
-
foreground @default_foreground
|
599
|
-
}
|
600
|
-
@line_number_text = text {
|
601
|
-
layout_data(:fill, :center, true, false) {
|
602
|
-
minimum_width 400
|
481
|
+
|
482
|
+
label {
|
483
|
+
layout_data(:left, :center, false, false) {
|
484
|
+
minimum_width 100
|
485
|
+
}
|
486
|
+
text 'Caret Position:'
|
487
|
+
foreground @default_foreground
|
603
488
|
}
|
604
|
-
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
489
|
+
label(:right) {
|
490
|
+
layout_data(:fill, :center, true, false) {
|
491
|
+
minimum_width 50
|
492
|
+
}
|
493
|
+
text bind(project_dir, 'selected_child.caret_position')
|
494
|
+
foreground @default_foreground
|
495
|
+
font stat_font
|
611
496
|
}
|
612
|
-
|
613
|
-
|
497
|
+
|
498
|
+
# row 2
|
499
|
+
|
500
|
+
label {
|
501
|
+
layout_data(:left, :center, false, false)
|
502
|
+
text 'Line:'
|
503
|
+
foreground @default_foreground
|
614
504
|
}
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
label {
|
633
|
-
layout_data(:left, :center, false, false)
|
634
|
-
text 'Find:'
|
635
|
-
foreground @default_foreground
|
636
|
-
}
|
637
|
-
@find_text = text {
|
638
|
-
layout_data(:fill, :center, true, false) {
|
639
|
-
minimum_width 400
|
505
|
+
@line_number_text = text {
|
506
|
+
layout_data(:fill, :center, true, false) {
|
507
|
+
width_hint 400
|
508
|
+
minimum_width 100
|
509
|
+
}
|
510
|
+
text bind(project_dir, 'selected_child.line_number', on_read: :to_s, on_write: :to_i)
|
511
|
+
foreground @default_foreground
|
512
|
+
font stat_font
|
513
|
+
on_key_pressed { |key_event|
|
514
|
+
if key_event.keyCode == swt(:cr)
|
515
|
+
@current_text_editor&.text_widget&.setFocus
|
516
|
+
end
|
517
|
+
}
|
518
|
+
on_verify_text { |event|
|
519
|
+
event.doit = !event.text.match(/^\d*$/).to_a.empty?
|
520
|
+
}
|
640
521
|
}
|
641
|
-
|
642
|
-
|
643
|
-
|
644
|
-
|
645
|
-
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
if key_event.keyCode == swt(:cr)
|
650
|
-
project_dir.selected_child&.find_next
|
651
|
-
end
|
522
|
+
label # filler
|
523
|
+
|
524
|
+
label {
|
525
|
+
layout_data(:left, :center, false, false) {
|
526
|
+
minimum_width 100
|
527
|
+
}
|
528
|
+
text 'Line Position:'
|
529
|
+
foreground @default_foreground
|
652
530
|
}
|
653
|
-
|
654
|
-
|
655
|
-
|
656
|
-
|
657
|
-
|
658
|
-
|
531
|
+
label(:right) {
|
532
|
+
layout_data(:fill, :center, true, false) {
|
533
|
+
minimum_width 50
|
534
|
+
}
|
535
|
+
text bind(project_dir, 'selected_child.line_position')
|
536
|
+
foreground @default_foreground
|
537
|
+
font stat_font
|
659
538
|
}
|
660
|
-
|
661
|
-
|
539
|
+
|
540
|
+
# row 3
|
541
|
+
|
542
|
+
label {
|
543
|
+
layout_data(:left, :center, false, false)
|
544
|
+
text 'Find:'
|
545
|
+
foreground @default_foreground
|
546
|
+
}
|
547
|
+
@find_text = text {
|
548
|
+
layout_data(:fill, :center, true, false) {
|
549
|
+
width_hint 400
|
550
|
+
minimum_width 100
|
551
|
+
}
|
552
|
+
text bind(project_dir, 'selected_child.find_text')
|
553
|
+
foreground @default_foreground
|
554
|
+
font stat_font
|
662
555
|
on_key_pressed { |key_event|
|
556
|
+
if key_event.stateMask == swt(COMMAND_KEY) && key_event.keyCode == swt(:cr)
|
557
|
+
project_dir.selected_child.case_sensitive = !project_dir.selected_child.case_sensitive
|
558
|
+
project_dir.selected_child&.find_next
|
559
|
+
end
|
663
560
|
if key_event.keyCode == swt(:cr)
|
664
561
|
project_dir.selected_child&.find_next
|
665
562
|
end
|
666
563
|
}
|
667
564
|
}
|
565
|
+
composite {
|
566
|
+
layout_data(:left, :center, true, false) {
|
567
|
+
minimum_width 120
|
568
|
+
}
|
569
|
+
row_layout {
|
570
|
+
margin_width 0
|
571
|
+
margin_height 0
|
572
|
+
}
|
573
|
+
button(:check) {
|
574
|
+
selection bind(project_dir, 'selected_child.case_sensitive')
|
575
|
+
on_key_pressed { |key_event|
|
576
|
+
if key_event.keyCode == swt(:cr)
|
577
|
+
project_dir.selected_child&.find_next
|
578
|
+
end
|
579
|
+
}
|
580
|
+
}
|
581
|
+
label {
|
582
|
+
text 'Case-sensitive'
|
583
|
+
foreground @default_foreground
|
584
|
+
}
|
585
|
+
}
|
586
|
+
|
668
587
|
label {
|
669
|
-
|
588
|
+
layout_data(:left, :center, false, false) {
|
589
|
+
minimum_width 100
|
590
|
+
}
|
591
|
+
text 'Selection Count:'
|
670
592
|
foreground @default_foreground
|
671
593
|
}
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
label(:right) {
|
680
|
-
layout_data(:fill, :center, true, false)
|
681
|
-
text bind(project_dir, 'selected_child.selection_count')
|
682
|
-
foreground @default_foreground
|
683
|
-
font stat_font
|
684
|
-
}
|
685
|
-
|
686
|
-
# row 4
|
687
|
-
|
688
|
-
label {
|
689
|
-
layout_data(:left, :center, false, false)
|
690
|
-
text 'Replace:'
|
691
|
-
foreground @default_foreground
|
692
|
-
}
|
693
|
-
@replace_text = text {
|
694
|
-
layout_data(:fill, :center, true, false) {
|
695
|
-
minimum_width 400
|
594
|
+
label(:right) {
|
595
|
+
layout_data(:fill, :center, true, false) {
|
596
|
+
minimum_width 50
|
597
|
+
}
|
598
|
+
text bind(project_dir, 'selected_child.selection_count')
|
599
|
+
foreground @default_foreground
|
600
|
+
font stat_font
|
696
601
|
}
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
|
602
|
+
|
603
|
+
# row 4
|
604
|
+
|
605
|
+
label {
|
606
|
+
layout_data(:left, :center, false, false)
|
607
|
+
text 'Replace:'
|
608
|
+
foreground @default_foreground
|
702
609
|
}
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
|
610
|
+
@replace_text = text {
|
611
|
+
layout_data(:fill, :center, true, false) {
|
612
|
+
width_hint 400
|
613
|
+
minimum_width 100
|
614
|
+
}
|
615
|
+
text bind(project_dir, 'selected_child.replace_text')
|
616
|
+
foreground @default_foreground
|
617
|
+
font stat_font
|
618
|
+
on_focus_gained {
|
619
|
+
project_dir.selected_child&.ensure_find_next
|
620
|
+
}
|
621
|
+
on_key_pressed { |key_event|
|
622
|
+
if key_event.keyCode == swt(:cr)
|
623
|
+
if project_dir.selected_child
|
624
|
+
Command.do(project_dir.selected_child, :replace_next!)
|
625
|
+
end
|
707
626
|
end
|
708
|
-
|
627
|
+
}
|
628
|
+
}
|
629
|
+
label # filler
|
630
|
+
label {
|
631
|
+
layout_data(:left, :center, false, false) {
|
632
|
+
minimum_width 100
|
633
|
+
}
|
634
|
+
text 'Top Pixel:'
|
635
|
+
foreground @default_foreground
|
636
|
+
}
|
637
|
+
label(:right) {
|
638
|
+
layout_data(:fill, :center, true, false) {
|
639
|
+
minimum_width 50
|
640
|
+
}
|
641
|
+
text bind(project_dir, 'selected_child.top_pixel')
|
642
|
+
foreground @default_foreground
|
643
|
+
font stat_font
|
709
644
|
}
|
710
645
|
}
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
text 'Top Pixel:'
|
715
|
-
foreground @default_foreground
|
646
|
+
|
647
|
+
on_item_collapsed {
|
648
|
+
collapse_navigation_expand_bar_height
|
716
649
|
}
|
717
|
-
|
718
|
-
|
719
|
-
|
720
|
-
foreground @default_foreground
|
721
|
-
font stat_font
|
650
|
+
|
651
|
+
on_item_expanded {
|
652
|
+
expand_navigation_expand_bar_height
|
722
653
|
}
|
723
|
-
}
|
724
654
|
|
725
|
-
on_item_collapsed {
|
726
|
-
collapse_navigation_expand_bar_height
|
727
|
-
}
|
728
|
-
|
729
|
-
on_item_expanded {
|
730
|
-
expand_navigation_expand_bar_height
|
731
655
|
}
|
732
|
-
|
733
|
-
|
734
|
-
|
735
|
-
|
736
|
-
|
737
|
-
|
738
|
-
|
739
|
-
minimum_width 768
|
740
|
-
minimum_height 576
|
741
|
-
}
|
742
|
-
orientation bind(self, :split_orientation) {|value| async_exec { body_root.pack_same_size}; value}
|
743
|
-
self.current_tab_folder = self.tab_folder1 = tab_folder {
|
744
|
-
drag_source(DND::DROP_COPY) {
|
745
|
-
transfer [TextTransfer.getInstance].to_java(Transfer)
|
746
|
-
event_data = nil
|
747
|
-
on_drag_start {|event|
|
748
|
-
Gladiator.drag = true
|
749
|
-
tab_folder = event.widget.getControl
|
750
|
-
tab_item = tab_folder.getItem(Point.new(event.x, event.y))
|
751
|
-
event_data = tab_item.getData('file_path')
|
752
|
-
}
|
753
|
-
on_drag_set_data { |event|
|
754
|
-
event.data = event_data
|
755
|
-
}
|
656
|
+
|
657
|
+
@tab_folder_sash_form = sash_form {
|
658
|
+
layout_data(:fill, :fill, true, true) {
|
659
|
+
width_hint 768
|
660
|
+
height_hint 576
|
661
|
+
minimum_width 168
|
662
|
+
minimum_height 176
|
756
663
|
}
|
664
|
+
orientation bind(self, :split_orientation) {|value| async_exec { body_root.pack_same_size}; value}
|
665
|
+
self.current_tab_folder = self.tab_folder1 = text_editor_group_tab_folder
|
666
|
+
@current_tab_folder.swt_widget.setData('proxy', @current_tab_folder) # TODO see if we could get rid of this as it seems redundant
|
757
667
|
}
|
758
|
-
@current_tab_folder.swt_widget.setData('proxy', @current_tab_folder)
|
759
668
|
}
|
669
|
+
} # end of sash form
|
670
|
+
}
|
671
|
+
end
|
672
|
+
}
|
673
|
+
|
674
|
+
def text_editor_group_tab_folder
|
675
|
+
tab_folder { |tab_folder_proxy|
|
676
|
+
on_widget_selected {
|
677
|
+
self.current_tab_folder = tab_folder_proxy
|
678
|
+
selected_file = @current_tab_item&.swt_tab_item&.getData('file')
|
679
|
+
if selected_file
|
680
|
+
project_dir.selected_child = selected_file
|
681
|
+
@current_tab_item = @current_tab_folder.swt_widget.getSelection.first.getData('proxy')
|
682
|
+
@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
|
683
|
+
@current_text_editor = @current_tab_item.swt_tab_item.getData('text_editor')
|
684
|
+
@current_text_editor&.load_content
|
685
|
+
@current_text_editor&.text_widget&.setFocus
|
686
|
+
end
|
687
|
+
}
|
688
|
+
drag_source(DND::DROP_COPY) {
|
689
|
+
transfer [TextTransfer.getInstance].to_java(Transfer)
|
690
|
+
event_data = nil
|
691
|
+
on_drag_start {|event|
|
692
|
+
Gladiator.drag = true
|
693
|
+
tab_folder = event.widget.getControl
|
694
|
+
tab_item = tab_folder.getItem(Point.new(event.x, event.y))
|
695
|
+
event_data = tab_item&.getData('file_path')
|
760
696
|
}
|
761
|
-
|
697
|
+
on_drag_set_data { |event|
|
698
|
+
event.data = event_data
|
699
|
+
}
|
700
|
+
}
|
762
701
|
}
|
763
|
-
|
702
|
+
end
|
764
703
|
|
765
704
|
def load_config_ignore_paths
|
766
705
|
# TODO eliminate duplication with load_config
|
@@ -770,8 +709,6 @@ module Glimmer
|
|
770
709
|
@config = YAML.load(config_yaml)
|
771
710
|
project_dir.ignore_paths = @config[:ignore_paths] if @config[:ignore_paths]
|
772
711
|
project_dir.ignore_paths ||= ['packages', 'tmp']
|
773
|
-
else
|
774
|
-
@loaded_config = true
|
775
712
|
end
|
776
713
|
end
|
777
714
|
|
@@ -785,22 +722,10 @@ module Glimmer
|
|
785
722
|
open_file_paths1 = @config[:open_file_paths1] || @config[:open_file_paths]
|
786
723
|
open_file_paths2 = @config[:open_file_paths2]
|
787
724
|
self.split_orientation = (swt(@config[:split_orientation]) rescue swt(:horizontal)) if @config[:split_orientation]
|
788
|
-
if @
|
789
|
-
@
|
790
|
-
text 'Gladiator'
|
791
|
-
fill_layout(:vertical) {
|
792
|
-
margin_width 15
|
793
|
-
margin_height 15
|
794
|
-
spacing 5
|
795
|
-
}
|
796
|
-
label(:center) {
|
797
|
-
text "Opening Last Open Files"
|
798
|
-
font height: 20
|
799
|
-
}
|
800
|
-
# @progress_bar = progress_bar(:horizontal, :indeterminate)
|
801
|
-
}
|
725
|
+
if @progress_shell.nil?
|
726
|
+
@progress_shell = progress_shell(gladiator: self, progress_text: 'Opening Last Open Files')
|
802
727
|
async_exec {
|
803
|
-
@
|
728
|
+
@progress_shell.open
|
804
729
|
}
|
805
730
|
end
|
806
731
|
open_file_paths1.to_a.each do |file_path|
|
@@ -842,8 +767,8 @@ module Glimmer
|
|
842
767
|
}
|
843
768
|
async_exec {
|
844
769
|
Gladiator.drag = false
|
845
|
-
@
|
846
|
-
@
|
770
|
+
@progress_shell&.close
|
771
|
+
@progress_shell = nil
|
847
772
|
@loaded_config = true
|
848
773
|
}
|
849
774
|
}
|
@@ -861,16 +786,16 @@ module Glimmer
|
|
861
786
|
end
|
862
787
|
|
863
788
|
def save_config
|
864
|
-
return if !@loaded_config || body_root
|
789
|
+
return if !@loaded_config || body_root&.disposed?
|
865
790
|
child = project_dir.selected_child
|
866
791
|
return if child.nil?
|
867
792
|
tab_folder1 = @tab_folder1 || @current_tab_folder
|
868
793
|
tab_folder2 = @tab_folder2
|
869
|
-
open_file_paths1 = tab_folder1&.swt_widget&.items.to_a.map {|i| i.get_data('file_path')}
|
870
|
-
open_file_paths2 = tab_folder2&.swt_widget&.items.to_a.map {|i| i.get_data('file_path')}
|
794
|
+
open_file_paths1 = tab_folder1&.swt_widget&.items.to_a.map {|i| i.get_data('file_path')}.reject {|path| path.to_s.strip.empty?}
|
795
|
+
open_file_paths2 = tab_folder2&.swt_widget&.items.to_a.map {|i| i.get_data('file_path')}.reject {|path| path.to_s.strip.empty?}
|
871
796
|
split_orientation_value = split_orientation == swt(:horizontal) ? 'horizontal' : (split_orientation == swt(:vertical) ? 'vertical' : nil)
|
872
797
|
@config = {
|
873
|
-
selected_child_path: child.path,
|
798
|
+
selected_child_path: child.nil? ? open_file_paths1&.first&.path : child.path,
|
874
799
|
split_orientation: split_orientation_value,
|
875
800
|
caret_position: child.caret_position,
|
876
801
|
top_pixel: child.top_pixel,
|
@@ -885,7 +810,7 @@ module Glimmer
|
|
885
810
|
config_yaml = YAML.dump(@config)
|
886
811
|
::File.write(@config_file_path, config_yaml) unless config_yaml.to_s.empty?
|
887
812
|
rescue => e
|
888
|
-
|
813
|
+
Glimmer::Config.logger.error {e.full_message}
|
889
814
|
end
|
890
815
|
|
891
816
|
def navigate_to_next_tab_folder
|
@@ -988,27 +913,16 @@ module Glimmer
|
|
988
913
|
def open_project
|
989
914
|
selected_directory = directory_dialog.open
|
990
915
|
return if selected_directory.nil?
|
991
|
-
@
|
992
|
-
text 'Gladiator'
|
993
|
-
fill_layout(:vertical) {
|
994
|
-
margin_width 15
|
995
|
-
margin_height 15
|
996
|
-
spacing 5
|
997
|
-
}
|
998
|
-
label(:center) {
|
999
|
-
text "Opening Project: #{::File.basename(selected_directory)}"
|
1000
|
-
font height: 20
|
1001
|
-
}
|
1002
|
-
# @progress_bar = progress_bar(:horizontal, :indeterminate)
|
1003
|
-
}
|
916
|
+
@progress_shell = progress_shell(gladiator: self, progress_text: "Opening Project: #{::File.basename(selected_directory)}")
|
1004
917
|
async_exec {
|
1005
|
-
@
|
918
|
+
@progress_shell.open
|
1006
919
|
}
|
1007
920
|
async_exec {
|
1008
921
|
gladiator(project_dir_path: selected_directory) {
|
1009
922
|
on_swt_show {
|
1010
|
-
|
1011
|
-
@
|
923
|
+
body_root.close if app_mode?
|
924
|
+
@progress_shell.close
|
925
|
+
@progress_shell = nil
|
1012
926
|
}
|
1013
927
|
}.open if selected_directory
|
1014
928
|
}
|
@@ -1033,29 +947,22 @@ module Glimmer
|
|
1033
947
|
label {
|
1034
948
|
layout_data :fill, :fill, true, true
|
1035
949
|
background :white
|
1036
|
-
text "Gladiator v#{VERSION}\n\n#{LICENSE}\n\nGladiator icon made by Freepik from www.flaticon.com"
|
950
|
+
text "Gladiator v#{VERSION} (Beta)\n\n#{LICENSE}\n\nGladiator icon made by Freepik from www.flaticon.com"
|
1037
951
|
}
|
1038
952
|
}.open
|
1039
953
|
end
|
1040
954
|
|
1041
955
|
def handle_display_shortcut(key_event)
|
1042
956
|
if key_event.stateMask == swt(COMMAND_KEY) && extract_char(key_event) == 'f'
|
1043
|
-
|
1044
|
-
|
1045
|
-
find_text.swt_widget.setText current_text_editor.text_widget.getSelectionText
|
1046
|
-
end
|
1047
|
-
find_text.swt_widget.selectAll
|
1048
|
-
find_text.swt_widget.setFocus
|
1049
|
-
end
|
1050
|
-
if @navigation_expand_item.swt_expand_item.get_expanded
|
1051
|
-
find_action.call
|
1052
|
-
else
|
957
|
+
if !@navigation_expand_item.swt_expand_item.get_expanded
|
958
|
+
expand_navigation_expand_bar_height
|
1053
959
|
@navigation_expand_item.swt_expand_item.set_expanded true
|
1054
|
-
async_exec {
|
1055
|
-
body_root.pack_same_size
|
1056
|
-
find_action.call
|
1057
|
-
}
|
1058
960
|
end
|
961
|
+
if current_text_editor&.text_widget&.getSelectionText && current_text_editor&.text_widget&.getSelectionText&.size.to_i > 0
|
962
|
+
find_text.swt_widget.setText current_text_editor.text_widget.getSelectionText
|
963
|
+
end
|
964
|
+
find_text.swt_widget.selectAll
|
965
|
+
find_text.swt_widget.setFocus
|
1059
966
|
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask, COMMAND_KEY, :shift) && extract_char(key_event) == 'c'
|
1060
967
|
Clipboard.copy(project_dir.selected_child.path)
|
1061
968
|
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask, COMMAND_KEY, :shift) && extract_char(key_event) == 'g'
|
@@ -1092,16 +999,18 @@ module Glimmer
|
|
1092
999
|
# async_exec { current_text_editor&.text_widget&.setFocus }
|
1093
1000
|
end
|
1094
1001
|
end
|
1095
|
-
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask, COMMAND_KEY, :shift) && extract_char(key_event) == ']'
|
1002
|
+
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)
|
1096
1003
|
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
|
1097
1004
|
current_text_editor&.text_widget&.setFocus
|
1098
|
-
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask, COMMAND_KEY, :shift) && extract_char(key_event) == '['
|
1005
|
+
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)
|
1099
1006
|
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
|
1100
1007
|
current_text_editor&.text_widget&.setFocus
|
1101
|
-
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask, COMMAND_KEY,
|
1008
|
+
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask, COMMAND_KEY, CONTROL_KEY) && extract_char(key_event) == ']'
|
1102
1009
|
navigate_to_next_tab_folder
|
1103
|
-
|
1010
|
+
key_event.doit = false
|
1011
|
+
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask, COMMAND_KEY, CONTROL_KEY) && extract_char(key_event) == '['
|
1104
1012
|
navigate_to_previous_tab_folder
|
1013
|
+
key_event.doit = false
|
1105
1014
|
elsif Glimmer::SWT::SWTProxy.include?(key_event.stateMask, COMMAND_KEY) && extract_char(key_event) == '1'
|
1106
1015
|
current_tab_folder.swt_widget.setSelection(0) if current_tab_folder.swt_widget.getItemCount >= 1
|
1107
1016
|
current_text_editor&.text_widget&.setFocus
|