glimmer-cs-gladiator 0.2.1 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 46513e411ce6bac81dafe471f6f8bc7834df2c82c0309f0f1db03c98abf709d7
4
- data.tar.gz: 54321b16f31848472e812d12b43a461bb4e45fb45dd3c400dc943c68ff0669ac
3
+ metadata.gz: 650c712355cabdc815732a44b445b14ba7940daf39905019f10b7cdf1c62a935
4
+ data.tar.gz: 02377cc0cc8891d0ff3128877ee521c0ae6674c86304b0663ce3956e603e3cd1
5
5
  SHA512:
6
- metadata.gz: a807b9c57b441c9f9aa06c5a4662ae436c5ae2409e8343c3fba5b220bf933b29965fc4b205c5fc5479d42d4fdb5796505cf9f33d56da0419193d684e2def2f60
7
- data.tar.gz: 4b37d08afb361322aabcf54a046dd9bb2e5db7d1b557409fc28d124918a8687e1079bd9927dd83fb149f4428ef3c5b9daf7903c17e5c896d07f150d3191b5333
6
+ metadata.gz: fcefebd0897944ec7e6634027c9e44cce3f705001a452d21ad68647b6e5aec70652c0d6cc7d8dfdd4870ddda6995902625eebc91bf085e7b5fbfe5db35c1b479
7
+ data.tar.gz: 4604954cce35346ddb5203f76e45efc492b37421b3f4748be5bbd7b7c34208efb4bb5de92445391f7a537b25aaa74747ffca9fa698139eb11f0a3549e37ede6b
data/README.md CHANGED
@@ -1,13 +1,13 @@
1
- # <img src='https://raw.githubusercontent.com/AndyObtiva/glimmer-cs-gladiator/master/images/glimmer-cs-gladiator-logo.svg' height=85 /> Gladiator (Glimmer Editor) 0.2.1
2
- ## [Glimmer Custom Shell](https://github.com/AndyObtiva/glimmer#custom-shell-gem)
1
+ # <img src='https://raw.githubusercontent.com/AndyObtiva/glimmer-cs-gladiator/master/images/glimmer-cs-gladiator-logo.svg' height=85 /> Gladiator 0.3.1 - [Ugliest Text Editor Ever](https://www.reddit.com/r/ruby/comments/hgve8k/gladiator_glimmer_editor_ugliest_text_editor_ever/)
2
+ ## [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=40 /> Glimmer Custom Shell](https://github.com/AndyObtiva/glimmer-dsl-swt#custom-shell-gem)
3
3
  [![Gem Version](https://badge.fury.io/rb/glimmer-cs-gladiator.svg)](http://badge.fury.io/rb/glimmer-cs-gladiator)
4
4
 
5
5
  ![Gladiator](images/glimmer-gladiator.png)
6
6
 
7
- Gladiator (short for Glimmer Editor) is a [Glimmer](https://github.com/AndyObtiva/glimmer) sample project under on-going development that demonstrates how to build a text editor in [Glimmer](https://github.com/AndyObtiva/glimmer) (Ruby Desktop Development GUI Library).
7
+ Gladiator (short for Glimmer Editor) is a [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt) sample project under on-going development that demonstrates how to build a text editor in [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt) (JRuby Desktop Development GUI Library).
8
8
  It is not intended to be a full-fledged editor by any means, yet mostly a fun educational exercise in using [Glimmer](https://github.com/AndyObtiva/glimmer).
9
9
  Gladiator is also a personal tool for shaping an editor exactly the way I like, with all the keyboard shortcuts I prefer.
10
- I leave building truly professional text editors to software tooling experts who would hopefully use [Glimmer](https://github.com/AndyObtiva/glimmer) one day. Otherwise, I have been happily using Gladiator to develop all my [open-source projects](https://github.com/AndyObtiva) since May 2020.
10
+ I leave building truly professional text editors to software tooling experts who would hopefully use [Glimmer](https://github.com/AndyObtiva/glimmer) one day. Otherwise, I have been happily using Gladiator to develop all my [open-source projects](https://github.com/AndyObtiva) since May of 2020.
11
11
 
12
12
  ## Features
13
13
 
@@ -33,15 +33,15 @@ Gladiator currently supports the following text editing features (including keyb
33
33
 
34
34
  ## Platforms
35
35
 
36
- - Mac: Gladiator works best on the Mac.
37
- - Windows: Gladiator works well on Windows.
38
- - Linux: Gladiator works with handicaps on Linux (performing text editing operations causes scroll jitter)
36
+ - Mac: Gladiator works best on the Mac. This is the platform it is most used on and receives the most maintenance for.
37
+ - Windows: Gladiator works OK on Windows, but has some annoying bugs.
38
+ - Linux: Gladiator works with very bad handicaps on Linux (performing text editing operations causes scroll jitter)
39
39
 
40
40
  ## Pre-requisites
41
41
 
42
- - [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer) (Ruby Desktop Development GUI Library): '>= 0.1.0', '< 2.0.0' (dependency included in Ruby gem).
43
- - [JRuby](https://www.jruby.org/download): Same version required by [Glimmer](https://github.com/AndyObtiva/glimmer)
44
- - [JDK](https://www.oracle.com/java/technologies/javase-downloads.html): Same version required by [Glimmer](https://github.com/AndyObtiva/glimmer)
42
+ - [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt) (JRuby Desktop Development GUI Library): '>= 4.17.2.0', '< 5.0.0.0' (dependency included in Ruby gem).
43
+ - [JRuby](https://www.jruby.org/download): Same version required by [Glimmer](https://github.com/AndyObtiva/glimmer-dsl-swt)
44
+ - [JDK](https://www.oracle.com/java/technologies/javase-downloads.html): Same version required by [Glimmer](https://github.com/AndyObtiva/glimmer-dsl-swt)
45
45
 
46
46
  ## Setup Instructions
47
47
 
@@ -73,6 +73,12 @@ You may run the `gladiator` command to bring up the text editor in the project d
73
73
  gladiator
74
74
  ```
75
75
 
76
+ On Windows, you may need to run with extra memory via this command instead:
77
+
78
+ ```
79
+ gladiator -J-Xmx3000M
80
+ ```
81
+
76
82
  If you are in a different directory from the project you would like to edit, then pass its path as an argument:
77
83
 
78
84
  ```
@@ -93,7 +99,7 @@ To reuse Gladiator as a Glimmer Custom Shell inside another Glimmer application,
93
99
  following to the application's `Gemfile`:
94
100
 
95
101
  ```
96
- gem 'glimmer-cs-gladiator', '~> 0.2.1'
102
+ gem 'glimmer-cs-gladiator', '~> 0.3.1'
97
103
  ```
98
104
 
99
105
  Run:
@@ -102,7 +108,7 @@ Run:
102
108
  jruby -S bundle
103
109
  ```
104
110
 
105
- And, then instantiate the Gladiator [custom shell](https://github.com/AndyObtiva/glimmer#custom-shells) in your [Glimmer](https://github.com/AndyObtiva/glimmer) application via the `gladiator` keyword assuming you already have `include Glimmer` in your class, module, or main object.
111
+ And, then instantiate the Gladiator [custom shell](https://github.com/AndyObtiva/glimmer-dsl-swt#custom-shells) in your [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt) application via the `gladiator` keyword assuming you already have `include Glimmer` in your class, module, or main object.
106
112
 
107
113
  ## Env Var Options
108
114
 
@@ -125,7 +131,10 @@ It currently remembers:
125
131
  - Last opened file
126
132
  - Caret position
127
133
  - Top line position
134
+ - Window size
128
135
  - Opened tabs
136
+ - Split tabs
137
+ - Ignore Paths
129
138
 
130
139
  ## Gotcha
131
140
 
@@ -152,7 +161,12 @@ The signal TERM is in use by the JVM and will not work correctly on this platfor
152
161
 
153
162
  ## Copyright
154
163
 
155
- Copyright (c) 2020 Andy Maleh. See LICENSE.txt for
156
- further details.
164
+ [MIT](https://opensource.org/licenses/MIT)
165
+
166
+ Copyright (c) 2020 Andy Maleh. See [LICENSE.txt](LICENSE.txt) for further details.
167
+
168
+ --
169
+
170
+ [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=40 />](https://github.com/AndyObtiva/glimmer) Built with [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt) (JRuby Desktop Development GUI Library)
157
171
 
158
172
  Gladiator icon made by <a href="https://www.flaticon.com/authors/freepik" title="Freepik">Freepik</a> from <a href="https://www.flaticon.com/" title="Flaticon">www.flaticon.com</a>
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.1
1
+ 0.3.1
@@ -4,3 +4,26 @@ require 'filewatcher'
4
4
  require 'clipboard'
5
5
  require 'puts_debuggerer'
6
6
  require 'views/glimmer/gladiator'
7
+
8
+ # Custom Composite Initializer (avoid default margins)
9
+ Glimmer::SWT::WidgetProxy::DEFAULT_INITIALIZERS['composite'] = lambda do |composite|
10
+ if composite.get_layout.nil?
11
+ layout = GridLayout.new
12
+ composite.layout = layout
13
+ end
14
+ end
15
+
16
+ # Custom LayoutProxy initialize method (avoid default margins)
17
+ module Glimmer
18
+ module SWT
19
+ class LayoutProxy
20
+ def initialize(underscored_layout_name, widget_proxy, args)
21
+ @underscored_layout_name = underscored_layout_name
22
+ @widget_proxy = widget_proxy
23
+ args = SWTProxy.constantify_args(args)
24
+ @swt_layout = self.class.swt_layout_class_for(underscored_layout_name).new(*args)
25
+ @widget_proxy.swt_widget.setLayout(@swt_layout)
26
+ end
27
+ end
28
+ end
29
+ end
@@ -9,32 +9,44 @@ module Glimmer
9
9
 
10
10
  class << self
11
11
  def local_dir
12
- @local_dir ||= new(ENV['LOCAL_DIR'] || '.').tap do |dir|
13
- dir.refresh
14
- @filewatcher = Filewatcher.new(dir.path)
12
+ unless @local_dir
13
+ @local_dir = new(ENV['LOCAL_DIR'] || '.', true)
14
+ # @local_dir.refresh
15
+ @filewatcher = Filewatcher.new(@local_dir.path)
15
16
  @thread = Thread.new(@filewatcher) do |fw|
16
17
  fw.watch do |filename, event|
17
18
  if @last_update.nil? || (Time.now.to_f - @last_update) > REFRESH_DELAY
18
- dir.refresh if !filename.include?('new_file') && !dir.selected_child_path_history.include?(filename) && filename != dir.selected_child_path
19
+ @local_dir.refresh if !filename.include?('new_file') && !@local_dir.selected_child_path_history.include?(filename) && filename != @local_dir.selected_child_path
19
20
  end
20
21
  @last_update = Time.now.to_f
21
22
  end
22
23
  end
23
24
  end
25
+ @local_dir
24
26
  end
25
27
  end
26
28
 
27
- attr_accessor :selected_child, :filter, :children, :filtered_path_options, :filtered_path, :path, :display_path
28
- attr_reader :name, :parent
29
- attr_writer :all_children, :children
29
+ attr_accessor :selected_child, :filter, :children, :filtered_path_options, :filtered_path, :display_path, :ignore_paths
30
+ attr_reader :name, :parent, :path, :is_local_dir
31
+ attr_writer :all_children
30
32
 
31
- def initialize(path)
32
- @display_path = path
33
- @path = ::File.expand_path(@display_path)
33
+ def initialize(path, is_local_dir = false)
34
+ @is_local_dir = is_local_dir
35
+ self.path = ::File.expand_path(path)
34
36
  @name = ::File.basename(::File.expand_path(path))
37
+ @ignore_paths = ['packages', 'tmp', 'vendor']
35
38
  self.filtered_path_options = []
36
39
  end
37
40
 
41
+ def path=(the_path)
42
+ @path = the_path
43
+ generate_display_path
44
+ end
45
+
46
+ def generate_display_path
47
+ is_local_dir ? path : @display_path = @path.sub(Dir.local_dir.path, '').sub(/^\//, '')
48
+ end
49
+
38
50
  def name=(the_name)
39
51
  self.display_path = display_path.sub(/#{Regexp.escape(@name)}$/, the_name)
40
52
  @name = the_name
@@ -48,7 +60,20 @@ module Glimmer
48
60
  end
49
61
 
50
62
  def retrieve_children
51
- ::Dir.glob(::File.join(@display_path, '*')).map {|p| ::File.file?(p) ? Gladiator::File.new(p) : Gladiator::Dir.new(p)}.sort_by {|c| c.path.to_s.downcase }.sort_by {|c| c.class.name }
63
+ @children = ::Dir.glob(::File.join(@path, '*')).reject do |p|
64
+ # TODO make sure to configure ignore_paths in a preferences dialog
65
+ Dir.local_dir.ignore_paths.reduce(false) do |result, ignore_path|
66
+ result || p.include?(ignore_path)
67
+ end
68
+ end.map do |p|
69
+ ::File.file?(p) ? Gladiator::File.new(p) : Gladiator::Dir.new(p)
70
+ end.sort_by do |c|
71
+ c.path.to_s.downcase
72
+ end.sort_by do |c|
73
+ c.class.name
74
+ end.each do |child|
75
+ child.retrieve_children if child.is_a?(Dir)
76
+ end
52
77
  end
53
78
 
54
79
  def selected_child_path_history
@@ -65,11 +90,11 @@ module Glimmer
65
90
 
66
91
  def refresh(async: true, force: false)
67
92
  return if @refresh_paused && !force
68
- new_all_children = retrieve_all_children
69
- new_children = retrieve_children
93
+ retrieve_children
94
+ collect_all_children
70
95
  refresh_operation = lambda do
71
- self.all_children = new_all_children
72
- self.children = new_children
96
+ notify_observers(:children)
97
+ notify_observers(:all_children)
73
98
  end
74
99
  if async
75
100
  async_exec(&refresh_operation)
@@ -84,23 +109,31 @@ module Glimmer
84
109
  else
85
110
  @filter = value
86
111
  end
87
- self.filtered_path_options = filtered.to_a.map(&:display_path)
112
+ @last_filtered = filtered.to_a
113
+ self.filtered_path_options = @last_filtered.map(&:display_path)
114
+ @last_filter = @filter
88
115
  end
89
116
 
90
117
  def filtered
91
118
  return if filter.nil?
92
- all_children_files.select do |child|
93
- child.path.downcase.include?(filter.downcase) ||
94
- child.path.downcase.gsub(/[_\/\.]/, '').include?(filter.downcase)
119
+ children_files = !@last_filter.to_s.empty? && filter.downcase.start_with?(@last_filter.downcase) ? @last_filtered : all_children_files
120
+ children_files.select do |child|
121
+ child_path = child.path.to_s.sub(Dir.local_dir.path, '')
122
+ child_path.downcase.include?(filter.downcase) ||
123
+ child_path.downcase.gsub(/[_\/.-]/, '').include?(filter.downcase.gsub(/[_\/.-]/, ''))
95
124
  end.sort_by {|c| c.path.to_s.downcase}
96
125
  end
97
126
 
98
127
  def all_children
99
- @all_children ||= retrieve_all_children
128
+ @all_children ||= collect_all_children
100
129
  end
101
130
 
102
- def retrieve_all_children
103
- ::Dir.glob(::File.join(@display_path, '**', '*')).map {|p| ::File.file?(p) ? Gladiator::File.new(p) : Gladiator::Dir.new(p)}
131
+ def collect_all_children
132
+ @all_children = children.reduce([]) do |output, child|
133
+ addition = [child]
134
+ addition += child.collect_all_children if child.is_a?(Dir)
135
+ output + addition
136
+ end
104
137
  end
105
138
 
106
139
  def all_children_files
@@ -108,9 +141,11 @@ module Glimmer
108
141
  end
109
142
 
110
143
  def selected_child_path=(selected_path)
144
+ full_selected_path = selected_path.include?(Dir.local_dir.path) ? selected_path : ::File.join(Dir.local_dir.path, selected_path)
111
145
  return if selected_path.nil? ||
112
- ::Dir.exist?(selected_path) ||
113
- (selected_child && ::File.expand_path(selected_child.path) == ::File.expand_path(selected_path))
146
+ ::Dir.exist?(full_selected_path) ||
147
+ (selected_child && selected_child.path == full_selected_path)
148
+ selected_path = full_selected_path
114
149
  if ::File.file?(selected_path)
115
150
  @selected_child&.write_dirty_content
116
151
  new_child = Gladiator::File.new(selected_path)
@@ -5,15 +5,14 @@ module Glimmer
5
5
  class File
6
6
  include Glimmer
7
7
 
8
- attr_accessor :dirty_content, :line_numbers_content, :selection, :selection_count, :line_number, :find_text, :replace_text, :top_index, :path, :display_path, :case_sensitive
9
- attr_reader :name
8
+ attr_accessor :dirty_content, :line_numbers_content, :selection, :selection_count, :line_number, :find_text, :replace_text, :top_index, :display_path, :case_sensitive
9
+ attr_reader :name, :path
10
10
 
11
11
  def initialize(path)
12
12
  raise "Not a file path: #{path}" unless ::File.file?(path)
13
13
  @command_history = []
14
- @display_path = path
15
14
  @name = ::File.basename(path)
16
- @path = ::File.expand_path(path)
15
+ self.path = ::File.expand_path(path)
17
16
  @top_index = 0
18
17
  @selection_count = 0
19
18
  @selection = Point.new(0, 0 + @selection_count)
@@ -42,6 +41,15 @@ module Glimmer
42
41
  end
43
42
  end
44
43
 
44
+ def path=(the_path)
45
+ @path = the_path
46
+ generate_display_path
47
+ end
48
+
49
+ def generate_display_path
50
+ @display_path = @path.sub(Dir.local_dir.path, '').sub(/^\//, '')
51
+ end
52
+
45
53
  # to use for widget data-binding
46
54
  def content=(value)
47
55
  Command.do(self) # record a native (OS-widget) operation
@@ -66,11 +74,12 @@ module Glimmer
66
74
  end
67
75
 
68
76
  def name=(the_name)
69
- self.display_path = display_path.sub(/#{Regexp.escape(@name)}$/, the_name)
77
+ new_path = path.sub(/#{Regexp.escape(@name)}$/, the_name)
70
78
  @name = the_name
71
- new_path = ::File.expand_path(display_path)
72
- FileUtils.mv(path, new_path)
73
- self.path = new_path
79
+ if ::File.exists?(path)
80
+ FileUtils.mv(path, new_path)
81
+ self.path = new_path
82
+ end
74
83
  end
75
84
 
76
85
  def dirty_content=(the_content)
@@ -339,7 +348,8 @@ module Glimmer
339
348
  new_dirty_content = dirty_content
340
349
  new_dirty_content[caret_position, find_text.size] = replace_text.to_s
341
350
  self.dirty_content = new_dirty_content
342
- find_next
351
+ find_next
352
+ find_next if replace_text.to_s.include?(find_text) && !replace_text.to_s.start_with?(find_text)
343
353
  end
344
354
 
345
355
  def page_up
@@ -20,7 +20,7 @@ module Glimmer
20
20
  class << self
21
21
  attr_accessor :drag_and_drop
22
22
  attr_accessor :drag
23
- end
23
+ end
24
24
 
25
25
  ## Add options like the following to configure CustomShell by outside consumers
26
26
  #
@@ -34,7 +34,7 @@ module Glimmer
34
34
  before_body {
35
35
  Display.setAppName('Gladiator')
36
36
  @display = display {
37
- on_event_keydown { |key_event|
37
+ on_swt_keydown { |key_event|
38
38
  if key_event.stateMask == swt(COMMAND_KEY) && extract_char(key_event) == 'f'
39
39
  if @text_editor&.text_widget&.getSelectionText && @text_editor&.text_widget&.getSelectionText&.size.to_i > 0
40
40
  @find_text.swt_widget.setText @text_editor.text_widget.getSelectionText
@@ -150,7 +150,8 @@ module Glimmer
150
150
  local_dir = ENV['LOCAL_DIR'] || '.'
151
151
  @config_file_path = ::File.join(local_dir, '.gladiator')
152
152
  @config = {}
153
- Dir.local_dir.all_children # pre-caches children
153
+ load_config_ignore_paths
154
+ # Dir.local_dir.all_children # pre-caches children
154
155
  }
155
156
 
156
157
  ## Uncomment after_body block to setup observers for widgets in body
@@ -193,7 +194,7 @@ module Glimmer
193
194
  Dir.local_dir.selected_child = @tab_item.swt_tab_item.getData('file')
194
195
  }
195
196
  }
196
- on_event_show {
197
+ on_swt_show {
197
198
  @tab_item = the_tab_item
198
199
  @text_editor = the_text_editor
199
200
  @tab_folder = @tab_item.swt_widget.getParent.getData('proxy')
@@ -236,8 +237,13 @@ module Glimmer
236
237
  text "Gladiator - #{::File.expand_path(Dir.local_dir.path)}"
237
238
  minimum_size 520, 250
238
239
  size 1440, 900
239
- grid_layout 2, false
240
- on_event_close {
240
+ grid_layout(2, false)
241
+ on_swt_show {
242
+ swt_widget.setSize(@config[:shell_width], @config[:shell_height]) if @config[:shell_width] && @config[:shell_height]
243
+ swt_widget.setLocation(@config[:shell_x], @config[:shell_y]) if @config[:shell_x] && @config[:shell_y]
244
+ @loaded_config = true
245
+ }
246
+ on_swt_close {
241
247
  Dir.local_dir.selected_child&.write_dirty_content
242
248
  }
243
249
  on_widget_disposed {
@@ -348,7 +354,7 @@ module Glimmer
348
354
  }
349
355
  }
350
356
  }
351
- on_event_menudetect { |event|
357
+ on_swt_menudetect { |event|
352
358
  path = extract_tree_item_path(@tree.swt_widget.getSelection.first)
353
359
  @open_menu_item.swt_widget.setEnabled(!::Dir.exist?(path)) if path
354
360
  }
@@ -432,7 +438,7 @@ module Glimmer
432
438
  text 'Find:'
433
439
  }
434
440
  @find_text = text {
435
- layout_data(:fill, :fill, true, false) {
441
+ layout_data(:fill, :center, true, false) {
436
442
  minimum_width 400
437
443
  }
438
444
  text bind(Dir.local_dir, 'selected_child.find_text')
@@ -511,22 +517,39 @@ module Glimmer
511
517
  }
512
518
  }
513
519
 
520
+ def load_config_ignore_paths
521
+ # TODO eliminate duplication with load_config
522
+ if ::File.exists?(@config_file_path)
523
+ config_yaml = ::File.read(@config_file_path)
524
+ return if config_yaml.to_s.strip.empty?
525
+ @config = YAML.load(config_yaml)
526
+ Dir.local_dir.ignore_paths = @config[:ignore_paths] if @config[:ignore_paths]
527
+ Dir.local_dir.ignore_paths ||= ['packages', 'tmp']
528
+ else
529
+ @loaded_config = true
530
+ end
531
+ end
532
+
514
533
  def load_config
515
534
  if ::File.exists?(@config_file_path)
516
535
  config_yaml = ::File.read(@config_file_path)
517
536
  return if config_yaml.to_s.strip.empty?
518
537
  @config = YAML.load(config_yaml)
519
- @config[:open_file_paths].to_a.each do |file_path|
538
+ Dir.local_dir.ignore_paths = @config[:ignore_paths] if @config[:ignore_paths]
539
+ Dir.local_dir.ignore_paths ||= ['packages', 'tmp']
540
+ open_file_paths1 = @config[:open_file_paths1] || @config[:open_file_paths]
541
+ open_file_paths2 = @config[:open_file_paths2]
542
+ open_file_paths1.to_a.each do |file_path|
543
+ Dir.local_dir.selected_child_path = file_path
544
+ end
545
+ Gladiator.drag = true
546
+ open_file_paths2.to_a.each do |file_path|
520
547
  Dir.local_dir.selected_child_path = file_path
521
548
  end
549
+ Gladiator.drag = false
522
550
  Dir.local_dir.selected_child_path = @config[:selected_child_path] if @config[:selected_child_path]
523
551
  Dir.local_dir.selected_child&.caret_position = Dir.local_dir.selected_child&.caret_position_for_caret_position_start_of_line(@config[:caret_position].to_i) if @config[:caret_position]
524
552
  Dir.local_dir.selected_child&.top_index = @config[:top_index].to_i if @config[:top_index]
525
- body_root.on_event_show {
526
- swt_widget.setSize(@config[:shell_width], @config[:shell_height]) if @config[:shell_width] && @config[:shell_height]
527
- swt_widget.setLocation(@config[:shell_x], @config[:shell_y]) if @config[:shell_x] && @config[:shell_y]
528
- @loaded_config = true
529
- }
530
553
  else
531
554
  @loaded_config = true
532
555
  end
@@ -536,6 +559,10 @@ module Glimmer
536
559
  return unless @loaded_config
537
560
  child = Dir.local_dir.selected_child
538
561
  return if child.nil?
562
+ tab_folder1 = @tab_folder1 || @tab_folder
563
+ tab_folder2 = @tab_folder2
564
+ open_file_paths1 = tab_folder1&.swt_widget&.items&.to_a.map {|i| i.get_data('file_path')}
565
+ open_file_paths2 = tab_folder2&.swt_widget&.items&.to_a.map {|i| i.get_data('file_path')}
539
566
  @config = {
540
567
  selected_child_path: child.path,
541
568
  caret_position: child.caret_position,
@@ -544,7 +571,9 @@ module Glimmer
544
571
  shell_height: swt_widget&.getBounds&.height,
545
572
  shell_x: swt_widget&.getBounds&.x,
546
573
  shell_y: swt_widget&.getBounds&.y,
547
- open_file_paths: Dir.local_dir.selected_child_path_history,
574
+ open_file_paths1: open_file_paths1,
575
+ open_file_paths2: open_file_paths2,
576
+ ignore_paths: Dir.local_dir.ignore_paths
548
577
  }
549
578
  config_yaml = YAML.dump(@config)
550
579
  ::File.write(@config_file_path, config_yaml) unless config_yaml.to_s.empty?
@@ -644,6 +673,7 @@ module Glimmer
644
673
  end
645
674
  new_file_path = ::File.expand_path(::File.join(directory_path, 'new_file'))
646
675
  FileUtils.touch(new_file_path)
676
+ # TODO look into refreshing only the parent directory to avoid slowdown
647
677
  Dir.local_dir.refresh(async: false, force: true)
648
678
  new_tree_item = @tree.depth_first_search {|ti| ti.getData.path == new_file_path}.first
649
679
  @tree.swt_widget.showItem(new_tree_item)
metadata CHANGED
@@ -1,35 +1,35 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glimmer-cs-gladiator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Maleh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-11 00:00:00.000000000 Z
11
+ date: 2020-10-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
15
15
  requirements:
16
16
  - - ">="
17
17
  - !ruby/object:Gem::Version
18
- version: 0.1.3
18
+ version: 4.17.2.0
19
19
  - - "<"
20
20
  - !ruby/object:Gem::Version
21
- version: 2.0.0
21
+ version: 5.0.0.0
22
22
  name: glimmer-dsl-swt
23
- type: :runtime
24
23
  prerelease: false
24
+ type: :runtime
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: 0.1.3
29
+ version: 4.17.2.0
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: 2.0.0
32
+ version: 5.0.0.0
33
33
  - !ruby/object:Gem::Dependency
34
34
  requirement: !ruby/object:Gem::Requirement
35
35
  requirements:
@@ -37,8 +37,8 @@ dependencies:
37
37
  - !ruby/object:Gem::Version
38
38
  version: 1.1.1
39
39
  name: filewatcher
40
- type: :runtime
41
40
  prerelease: false
41
+ type: :runtime
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
44
  - - "~>"
@@ -51,8 +51,8 @@ dependencies:
51
51
  - !ruby/object:Gem::Version
52
52
  version: 1.3.4
53
53
  name: clipboard
54
- type: :runtime
55
54
  prerelease: false
55
+ type: :runtime
56
56
  version_requirements: !ruby/object:Gem::Requirement
57
57
  requirements:
58
58
  - - "~>"
@@ -65,8 +65,8 @@ dependencies:
65
65
  - !ruby/object:Gem::Version
66
66
  version: 3.5.0
67
67
  name: rspec
68
- type: :development
69
68
  prerelease: false
69
+ type: :development
70
70
  version_requirements: !ruby/object:Gem::Requirement
71
71
  requirements:
72
72
  - - "~>"
@@ -79,8 +79,8 @@ dependencies:
79
79
  - !ruby/object:Gem::Version
80
80
  version: 2.3.9
81
81
  name: jeweler
82
- type: :development
83
82
  prerelease: false
83
+ type: :development
84
84
  version_requirements: !ruby/object:Gem::Requirement
85
85
  requirements:
86
86
  - - '='
@@ -93,8 +93,8 @@ dependencies:
93
93
  - !ruby/object:Gem::Version
94
94
  version: '0'
95
95
  name: simplecov
96
- type: :development
97
96
  prerelease: false
97
+ type: :development
98
98
  version_requirements: !ruby/object:Gem::Requirement
99
99
  requirements:
100
100
  - - ">="
@@ -144,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
144
144
  - !ruby/object:Gem::Version
145
145
  version: '0'
146
146
  requirements: []
147
- rubygems_version: 3.0.6
147
+ rubygems_version: 3.1.4
148
148
  signing_key:
149
149
  specification_version: 4
150
150
  summary: Gladiator (Glimmer Editor) - Glimmer Custom Shell