redcar 0.11.0dev → 0.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (139) hide show
  1. data/CHANGES +14 -1
  2. data/README.md +28 -8
  3. data/Rakefile +23 -18
  4. data/bin/redcar +9 -4
  5. data/lib/redcar.rb +42 -4
  6. data/lib/redcar/installer.rb +7 -2
  7. data/lib/redcar/logger.rb +64 -0
  8. data/lib/redcar/runner.rb +17 -8
  9. data/lib/redcar/usage.rb +2 -0
  10. data/plugins/application/features/step_definitions/tree_steps.rb +4 -4
  11. data/plugins/application/features/support/env.rb +6 -6
  12. data/plugins/application/lib/application.rb +31 -3
  13. data/plugins/application/lib/application/command.rb +6 -0
  14. data/plugins/application/lib/application/command/executor.rb +0 -1
  15. data/plugins/application/lib/application/commands/application_commands.rb +21 -0
  16. data/plugins/application/lib/application/commands/notebook_commands.rb +73 -0
  17. data/plugins/application/lib/application/commands/tab_commands.rb +105 -0
  18. data/plugins/application/lib/application/commands/treebook_commands.rb +117 -0
  19. data/plugins/application/lib/application/commands/window_commands.rb +68 -0
  20. data/plugins/{tree/lib → application/lib/application}/tree.rb +0 -4
  21. data/plugins/{tree/lib → application/lib/application}/tree/command.rb +0 -0
  22. data/plugins/{tree/lib → application/lib/application}/tree/controller.rb +0 -0
  23. data/plugins/{tree/lib → application/lib/application}/tree/mirror.rb +0 -0
  24. data/plugins/application/spec/application/keymap/builder_spec.rb +1 -1
  25. data/plugins/application/spec/application/menu/builder_spec.rb +2 -2
  26. data/plugins/application_swt/lib/application_swt.rb +4 -2
  27. data/plugins/application_swt/lib/swt/vtab_label.rb +6 -3
  28. data/plugins/auto_indenter/lib/auto_indenter/document_controller.rb +6 -3
  29. data/plugins/clojure/lib/clojure.rb +2 -2
  30. data/plugins/core/lib/core.rb +0 -4
  31. data/plugins/core/lib/core/gui.rb +2 -4
  32. data/plugins/core/lib/core/plugin/storage.rb +68 -21
  33. data/plugins/core/spec/core/base_storage_spec.rb +81 -0
  34. data/plugins/core/spec/core/shared_storage_spec.rb +49 -0
  35. data/plugins/core/spec/core/storage_spec.rb +13 -63
  36. data/plugins/declarations/lib/declarations.rb +3 -1
  37. data/plugins/document_search/features/replace.feature +29 -20
  38. data/plugins/document_search/lib/document_search/find_speedbar.rb +4 -1
  39. data/plugins/edit_view/features/indentation_commands.feature +6 -5
  40. data/plugins/edit_view/features/step_definitions/notebook_steps.rb +4 -4
  41. data/plugins/edit_view/features/step_definitions/tab_steps.rb +7 -7
  42. data/plugins/edit_view/features/step_definitions/window_steps.rb +2 -2
  43. data/plugins/edit_view/lib/edit_view.rb +15 -1
  44. data/plugins/edit_view/lib/edit_view/modified_tabs_checker.rb +7 -7
  45. data/plugins/edit_view_swt/lib/edit_view_swt.rb +7 -6
  46. data/plugins/execute_current_tab/lib/execute_current_tab.rb +1 -1
  47. data/plugins/groovy/lib/groovy.rb +3 -3
  48. data/plugins/groovy/lib/groovy/commands.rb +1 -1
  49. data/plugins/help/lib/help/view_controller.rb +5 -0
  50. data/plugins/help/views/index.html.erb +10 -1
  51. data/plugins/html_view/features/step_definitions/html_view_steps.rb +1 -1
  52. data/plugins/html_view/features/support/env.rb +0 -15
  53. data/plugins/html_view/lib/html_view.rb +3 -4
  54. data/plugins/html_view/lib/html_view/commands.rb +1 -1
  55. data/plugins/key_bindings/lib/key_bindings.rb +34 -0
  56. data/plugins/key_bindings/plugin.rb +8 -0
  57. data/plugins/{tree → key_bindings}/spec/spec_helper.rb +0 -0
  58. data/plugins/line_tools/features/lower_text.feature +3 -4
  59. data/plugins/line_tools/lib/line_tools.rb +6 -5
  60. data/plugins/mirah/lib/mirah.rb +2 -2
  61. data/plugins/pair_highlighter/lib/pair_highlighter/document_controller.rb +5 -3
  62. data/plugins/project/features/open_directory_tree.feature +1 -1
  63. data/plugins/project/features/step_definitions/file_steps.rb +5 -5
  64. data/plugins/project/features/step_definitions/find_file_steps.rb +2 -3
  65. data/plugins/project/features/support/env.rb +4 -0
  66. data/plugins/project/lib/project.rb +15 -9
  67. data/plugins/project/lib/project/commands.rb +46 -16
  68. data/plugins/project/lib/project/dir_controller.rb +1 -1
  69. data/plugins/project/lib/project/dir_mirror.rb +3 -2
  70. data/plugins/project/lib/project/drb_service.rb +3 -1
  71. data/plugins/project/lib/project/file_list.rb +99 -21
  72. data/plugins/project/lib/project/find_file_dialog.rb +8 -24
  73. data/plugins/project/lib/project/manager.rb +68 -12
  74. data/plugins/project/lib/project/project_tree_controller.rb +1 -1
  75. data/plugins/project/plugin.rb +1 -2
  76. data/plugins/project_search/features/word_search.feature +1 -1
  77. data/plugins/project_search/lib/project_search.rb +16 -6
  78. data/plugins/project_search/lib/project_search/commands.rb +15 -28
  79. data/plugins/project_search/lib/project_search/hit.rb +4 -0
  80. data/plugins/project_search/lib/project_search/lucene_index.rb +14 -4
  81. data/plugins/project_search/lib/project_search/views/_file.html.erb +11 -11
  82. data/plugins/project_search/lib/project_search/word_search.rb +22 -4
  83. data/plugins/project_search/spec/project_search/word_search_spec.rb +2 -2
  84. data/plugins/redcar/redcar.rb +140 -588
  85. data/plugins/repl/features/step_definitions/repl_steps.rb +3 -3
  86. data/plugins/repl/features/support/fake_repl.rb +1 -1
  87. data/plugins/ruby/lib/ruby.rb +4 -4
  88. data/plugins/runnables/features/fixtures/alternate.ruby +1 -0
  89. data/plugins/runnables/features/fixtures/line_app.rb +1 -0
  90. data/plugins/runnables/features/fixtures/name_app.rb +1 -0
  91. data/plugins/runnables/features/fixtures/params_app.rb +1 -0
  92. data/plugins/runnables/features/fixtures/runnable_app.rb +1 -0
  93. data/plugins/runnables/lib/runnables.rb +21 -0
  94. data/plugins/runnables/lib/runnables/command_output_controller.rb +14 -9
  95. data/plugins/runnables/lib/runnables/output_processor.rb +4 -4
  96. data/plugins/runnables/lib/runnables/running_process_checker.rb +6 -6
  97. data/plugins/runnables/plugin.rb +1 -2
  98. data/plugins/scm/lib/scm.rb +18 -18
  99. data/plugins/scm/lib/scm/commit_mirror.rb +2 -2
  100. data/plugins/scm/lib/scm/scm_changes_controller.rb +1 -1
  101. data/plugins/scm_hg/lib/scm_hg.rb +1 -1
  102. data/plugins/snippets/lib/snippets/document_controller.rb +46 -40
  103. data/plugins/swt/lib/swt.rb +2 -0
  104. data/plugins/test_runner/lib/test_runner.rb +1 -0
  105. data/plugins/test_runner/lib/test_runner/jasmine_test_runner.rb +15 -0
  106. data/plugins/test_runner/lib/test_runner/runnable_test_runner.rb +21 -5
  107. data/plugins/textmate/lib/textmate.rb +5 -1
  108. data/plugins/textmate/lib/textmate/preference.rb +4 -0
  109. data/plugins/textmate/lib/textmate/snippet.rb +0 -2
  110. data/plugins/textmate/lib/textmate/tree_mirror.rb +6 -5
  111. data/plugins/textmate/plugin.rb +1 -1
  112. data/plugins/textmate/vendor/redcar-bundles/Bundles/C.tmbundle/Syntaxes/C.plist +2 -2
  113. data/plugins/textmate/vendor/redcar-bundles/Bundles/Clojure.tmbundle/info.plist +2 -0
  114. data/plugins/textmate/vendor/redcar-bundles/Bundles/Cucumber.tmbundle/Syntaxes/Cucumber_Plain_Text_Feature.tmLanguage +0 -4
  115. data/plugins/textmate/vendor/redcar-bundles/Bundles/Cucumber.tmbundle/info.plist +2 -0
  116. data/plugins/textmate/vendor/redcar-bundles/Bundles/Mirah.tmbundle/info.plist +3 -1
  117. data/plugins/textmate/vendor/redcar-bundles/Bundles/Palm-WebOS-Development.tmbundle/info.plist +2 -0
  118. data/plugins/textmate/vendor/redcar-bundles/Bundles/RedcarRepl.tmbundle/info.plist +2 -0
  119. data/plugins/textmate/vendor/redcar-bundles/Bundles/SQL.tmbundle/info.plist +2 -0
  120. data/plugins/textmate/vendor/redcar-bundles/Bundles/Scala.tmbundle/info.plist +2 -0
  121. data/plugins/textmate/vendor/redcar-bundles/Bundles/Smalltalk.tmbundle/Preferences/GNU_Smalltalk.tmPreferences +1 -1
  122. data/plugins/textmate/vendor/redcar-bundles/Bundles/Smalltalk.tmbundle/Preferences/MIST_Smalltalk_Format.tmPreferences +1 -1
  123. data/plugins/textmate/vendor/redcar-bundles/Bundles/Smalltalk.tmbundle/info.plist +2 -0
  124. data/plugins/textmate/vendor/redcar-bundles/Bundles/Vala.tmbundle/info.plist +4 -2
  125. data/plugins/textmate/vendor/redcar-bundles/Bundles/Webrat.tmbundle/info.plist +2 -0
  126. data/plugins/textmate/vendor/redcar-bundles/Bundles/YAML.tmbundle/Syntaxes/YAML.plist +1 -0
  127. data/plugins/textmate/vendor/redcar-bundles/Bundles/groovy.tmbundle/info.plist +2 -0
  128. data/plugins/textmate/vendor/redcar-bundles/Themes/Twilight.tmTheme +0 -2
  129. data/plugins/todo_list/lib/todo_list.rb +3 -3
  130. data/plugins/todo_list/lib/todo_list/todo_controller.rb +1 -1
  131. data/plugins/web_bookmarks/features/step_definitions/web_steps.rb +1 -1
  132. data/plugins/web_bookmarks/lib/web_bookmarks.rb +11 -4
  133. data/plugins/web_bookmarks/lib/web_bookmarks/commands.rb +1 -1
  134. data/plugins/web_bookmarks/plugin.rb +1 -2
  135. metadata +29 -20
  136. data/plugins/core/lib/core/logger.rb +0 -28
  137. data/plugins/file_parser/lib/file_parser.rb +0 -125
  138. data/plugins/file_parser/plugin.rb +0 -7
  139. data/plugins/tree/plugin.rb +0 -9
@@ -28,6 +28,8 @@ module Redcar
28
28
  puts " --home-dir=PATH Use the specified directory as Redcar home directory"
29
29
  puts " -w Open the specified files and wait until they are closed"
30
30
  puts " -l[NUMBER] Open a specified file at line NUMBER. Multiple comma-seperated args for multiple files are allowed."
31
+ puts " --show-log Print Redcar's log to stdout"
32
+ puts " --log-level=LEVEL Set the log level to LEVEL (default is info, options are debug, info, warn, error)"
31
33
  #puts "To associate with right click in windows explorer:"
32
34
  #puts
33
35
  #puts " C:> redcar --associate_with_any_right_click"
@@ -7,19 +7,19 @@ When /^I expand the tree row "([^\"]*)"$/ do |row|
7
7
  end
8
8
 
9
9
  When /^I toggle tree visibility$/ do
10
- Redcar::Top::ToggleTreesCommand.new.run
10
+ Redcar::Application::ToggleTreesCommand.new.run
11
11
  end
12
12
 
13
13
  When "I close the tree" do
14
- Redcar::Top::CloseTreeCommand.new.run
14
+ Redcar::Application::CloseTreeCommand.new.run
15
15
  end
16
16
 
17
17
  When /^I switch (up|down) a tree$/ do |type|
18
18
  case type
19
19
  when "down"
20
- Redcar::Top::SwitchTreeDownCommand.new.run
20
+ Redcar::Application::SwitchTreeDownCommand.new.run
21
21
  when "up"
22
- Redcar::Top::SwitchTreeUpCommand.new.run
22
+ Redcar::Application::SwitchTreeUpCommand.new.run
23
23
  end
24
24
  end
25
25
 
@@ -200,14 +200,16 @@ def close_everything
200
200
  dialogs.each {|d| d.controller.model.close }
201
201
  end
202
202
  Redcar.app.windows.each do |win|
203
+ if p = Redcar::Project::Manager.in_window(win)
204
+ Swt.sync_exec do
205
+ p.close
206
+ end
207
+ end
203
208
  win.treebook.trees.each do |tree|
204
209
  Swt.sync_exec do
205
210
  win.treebook.remove_tree(tree)
206
211
  end
207
212
  end
208
- if Redcar::Project::Manager.in_window(win)
209
- Redcar::Project.window_projects.delete(win)
210
- end
211
213
  win.notebooks.each do |notebook|
212
214
  while tab = notebook.tabs.first
213
215
  Swt.sync_exec do
@@ -215,7 +217,7 @@ def close_everything
215
217
  end
216
218
  end
217
219
  end
218
- if win.notebooks.length == 2
220
+ while win.notebooks.length > 1
219
221
  Swt.sync_exec do
220
222
  win.close_notebook
221
223
  end
@@ -253,5 +255,3 @@ end
253
255
  at_exit {
254
256
  FileUtils.rm_rf(Redcar::Plugin::Storage.storage_dir)
255
257
  }
256
-
257
-
@@ -5,9 +5,9 @@ require 'application/command/executor'
5
5
  require 'application/command/history'
6
6
  require 'application/sensitive'
7
7
  require 'application/sensitivity'
8
-
9
8
  require 'application/clipboard'
10
9
  require 'application/command'
10
+
11
11
  require 'application/dialog'
12
12
  require 'application/dialogs/filter_list_dialog'
13
13
  require 'application/dialogs/modeless_list_dialog'
@@ -28,9 +28,19 @@ require 'application/notebook'
28
28
  require 'application/speedbar'
29
29
  require 'application/tab'
30
30
  require 'application/tab/command'
31
+ require 'application/tree'
32
+ require 'application/tree/command'
33
+ require 'application/tree/controller'
34
+ require 'application/tree/mirror'
31
35
  require 'application/treebook'
32
36
  require 'application/window'
33
37
 
38
+ require 'application/commands/application_commands'
39
+ require 'application/commands/tab_commands'
40
+ require 'application/commands/notebook_commands'
41
+ require 'application/commands/window_commands'
42
+ require 'application/commands/treebook_commands'
43
+
34
44
  module Redcar
35
45
  # A Redcar process contains one Application instance. The application instance
36
46
  # (the app) contains:
@@ -226,6 +236,17 @@ module Redcar
226
236
  windows.each {|window| window.refresh_toolbar }
227
237
  controller.refresh_toolbar
228
238
  end
239
+
240
+ # For every plugin that implements it, call the method with the given
241
+ # arguments and pass the result to the block.
242
+ #
243
+ # @param [Symbol] method_name
244
+ def call_on_plugins(method_name, *args)
245
+ Redcar.plugin_manager.objects_implementing(method_name).each do |object|
246
+ yield object.send(method_name, *args)
247
+ end
248
+ nil
249
+ end
229
250
 
230
251
  # Generate the main menu by combining menus from all plugins.
231
252
  #
@@ -267,7 +288,7 @@ module Redcar
267
288
  Redcar.plugin_manager.objects_implementing(:keymaps).each do |object|
268
289
  maps = object.keymaps
269
290
  unless maps
270
- puts "#{object.inspect} implements :keymaps but :keymaps returns nil"
291
+ Redcar.log.warn("#{object.inspect} implements :keymaps but :keymaps returns nil")
271
292
  maps = []
272
293
  end
273
294
  keymaps = maps.select do |map|
@@ -275,10 +296,17 @@ module Redcar
275
296
  end
276
297
  keymap = keymaps.inject(keymap) {|k, nk| k.merge(nk) }
277
298
  end
278
- keymap
299
+ apply_user_keybindings(keymap)
279
300
  end
280
301
  end
281
302
 
303
+ def apply_user_keybindings(keymap)
304
+ Redcar.plugin_manager.objects_implementing(:user_keybindings).each do |object|
305
+ keymap.map.merge!(object.user_keybindings)
306
+ end
307
+ keymap
308
+ end
309
+
282
310
  # Loads sensitivities from all plugins.
283
311
  def load_sensitivities
284
312
  Redcar.plugin_manager.objects_implementing(:sensitivities).each do |object|
@@ -80,11 +80,17 @@ module Redcar
80
80
 
81
81
  def run(opts = {})
82
82
  @executor = Executor.new(self, opts)
83
+ s = Time.now
83
84
  result = @executor.execute
84
85
  remove_instance_variable(:@executor)
86
+ Redcar.log.debug("command #{self.inspect} (#{Time.now - s})")
85
87
  result
86
88
  end
87
89
 
90
+ def inspect
91
+ "#<#{self.class.name}>"
92
+ end
93
+
88
94
  private
89
95
 
90
96
  def env
@@ -2,7 +2,6 @@
2
2
  module Redcar
3
3
  class Command
4
4
  class Executor
5
- include Redcar::Core::HasLogger
6
5
 
7
6
  attr_reader :options, :command_instance
8
7
 
@@ -0,0 +1,21 @@
1
+ module Redcar
2
+ class Application
3
+ class QuitCommand < Command
4
+ def execute
5
+ Redcar.app.call_on_plugins(:quit_guard) do |guard|
6
+ return unless guard
7
+ end
8
+ Project::Manager.open_projects.each {|pr| pr.close }
9
+ Redcar.app.quit
10
+ end
11
+ end
12
+
13
+ class ToggleToolbar < Command
14
+
15
+ def execute
16
+ Redcar.app.toggle_show_toolbar
17
+ Redcar.app.refresh_toolbar!
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,73 @@
1
+ module Redcar
2
+ class Application
3
+ class OpenNewNotebookCommand < Command
4
+
5
+ def execute
6
+ win.create_notebook
7
+ end
8
+ end
9
+
10
+ class EnlargeNotebookCommand < Command
11
+ sensitize :multiple_notebooks
12
+
13
+ def execute
14
+ if win = Redcar.app.focussed_window
15
+ win.enlarge_notebook(0)
16
+ end
17
+ end
18
+ end
19
+
20
+ class ResetNotebookWidthsCommand < Command
21
+ sensitize :multiple_notebooks
22
+
23
+ def execute
24
+ if win = Redcar.app.focussed_window
25
+ win.reset_notebook_widths
26
+ end
27
+ end
28
+ end
29
+
30
+ class RotateNotebooksCommand < Command
31
+ sensitize :multiple_notebooks
32
+
33
+ def execute
34
+ win.rotate_notebooks
35
+ end
36
+ end
37
+
38
+ class CloseNotebookCommand < Command
39
+ sensitize :multiple_notebooks
40
+
41
+ def execute
42
+ unless win.notebooks.length == 1
43
+ win.close_notebook
44
+ end
45
+ end
46
+ end
47
+
48
+ class SwitchNotebookCommand < Command
49
+ sensitize :multiple_notebooks, :other_notebook_has_tab
50
+
51
+ def execute
52
+ new_notebook = win.nonfocussed_notebook
53
+ if new_notebook.focussed_tab
54
+ new_notebook.focussed_tab.focus
55
+ end
56
+ end
57
+ end
58
+
59
+ class MoveTabToOtherNotebookCommand < Command
60
+ sensitize :multiple_notebooks, :open_tab
61
+
62
+ def execute
63
+ current_notebook = tab.notebook
64
+ i = win.notebooks.index current_notebook
65
+
66
+ target_notebook = win.notebooks[ (i + 1) % win.notebooks.length ]
67
+ target_notebook.grab_tab_from(current_notebook, tab)
68
+ tab.focus
69
+ end
70
+ end
71
+
72
+ end
73
+ end
@@ -0,0 +1,105 @@
1
+ module Redcar
2
+ class Application
3
+
4
+ class SwitchTabDownCommand < TabCommand
5
+
6
+ def execute
7
+ win.focussed_notebook.switch_down
8
+ end
9
+ end
10
+
11
+ class SwitchTabUpCommand < TabCommand
12
+
13
+ def execute
14
+ win.focussed_notebook.switch_up
15
+ end
16
+ end
17
+
18
+ class MoveTabUpCommand < TabCommand
19
+
20
+ def execute
21
+ win.focussed_notebook.move_up
22
+ end
23
+ end
24
+
25
+ class MoveTabDownCommand < TabCommand
26
+
27
+ def execute
28
+ win.focussed_notebook.move_down
29
+ end
30
+ end
31
+
32
+ class CloseTabCommand < TabCommand
33
+ def initialize(tab=nil)
34
+ @tab = tab
35
+ end
36
+
37
+ def tab
38
+ @tab || super
39
+ end
40
+
41
+ def execute
42
+ Redcar.app.call_on_plugins(:close_tab_guard, tab) do |guard|
43
+ return unless guard
44
+ end
45
+ close_tab
46
+ @tab = nil
47
+ end
48
+
49
+ private
50
+
51
+ def close_tab
52
+ win = tab.notebook.window
53
+ tab.close
54
+ # this will break a lot of features:
55
+ #if win.all_tabs.empty? and not Project::Manager.in_window(win)
56
+ # win.close
57
+ #end
58
+ end
59
+ end
60
+
61
+ class CloseAll < Redcar::Command
62
+ def execute
63
+ window = Redcar.app.focussed_window
64
+ tabs = window.all_tabs
65
+ tabs.each do |t|
66
+ CloseTabCommand.new(t).run
67
+ end
68
+ end
69
+ end
70
+
71
+ class CloseOthers < Redcar::Command
72
+ def execute
73
+ window = Redcar.app.focussed_window
74
+ current_tab = Redcar.app.focussed_notebook_tab
75
+ tabs = window.all_tabs
76
+ tabs.each do |t|
77
+ unless t == current_tab
78
+ CloseTabCommand.new(t).run
79
+ end
80
+ end
81
+ end
82
+ end
83
+
84
+ # define commands from SelectTab1Command to SelectTab9Command
85
+ (1..9).each do |tab_num|
86
+ const_set("SelectTab#{tab_num}Command", Class.new(Redcar::TabCommand)).class_eval do
87
+ define_method :execute do
88
+ notebook = Redcar.app.focussed_window_notebook
89
+ notebook.tabs[tab_num-1].focus if notebook.tabs[tab_num-1]
90
+ end
91
+ end
92
+ end
93
+ end
94
+ end
95
+
96
+
97
+
98
+
99
+
100
+
101
+
102
+
103
+
104
+
105
+
@@ -0,0 +1,117 @@
1
+ module Redcar
2
+ class Application
3
+
4
+ class CloseTreeCommand < TreeCommand
5
+ def execute
6
+ win = Redcar.app.focussed_window
7
+ if win and treebook = win.treebook
8
+ if tree = treebook.focussed_tree
9
+ treebook.remove_tree(tree)
10
+ end
11
+ end
12
+ end
13
+ end
14
+
15
+ class ToggleTreesCommand < TreeCommand
16
+ def execute
17
+ win = Redcar.app.focussed_window
18
+ if win and treebook = win.treebook
19
+ if win.trees_visible?
20
+ win.set_trees_visible(false)
21
+ else
22
+ win.set_trees_visible(true)
23
+ end
24
+ end
25
+ end
26
+ end
27
+
28
+ class SwitchTreeDownCommand < TreeCommand
29
+
30
+ def execute
31
+ win = Redcar.app.focussed_window
32
+ win.treebook.switch_down
33
+ end
34
+ end
35
+
36
+ class SwitchTreeUpCommand < TreeCommand
37
+
38
+ def execute
39
+ win = Redcar.app.focussed_window
40
+ win.treebook.switch_up
41
+ end
42
+ end
43
+
44
+ class TreebookWidthCommand < Command
45
+ sensitize :open_trees
46
+
47
+ def increment
48
+ raise "Please implement me!"
49
+ end
50
+
51
+ def execute
52
+ if win = Redcar.app.focussed_window
53
+ if increment > 0
54
+ win.adjust_treebook_width(true)
55
+ else
56
+ win.adjust_treebook_width(false)
57
+ end
58
+ end
59
+ end
60
+ end
61
+
62
+ class IncreaseTreebookWidthCommand < TreebookWidthCommand
63
+ def increment
64
+ 1
65
+ end
66
+ end
67
+
68
+ class DecreaseTreebookWidthCommand < TreebookWidthCommand
69
+ def decrement
70
+ -1
71
+ end
72
+ end
73
+
74
+ class OpenTreeFinderCommand < TreeCommand
75
+ def execute
76
+ if win = Redcar.app.focussed_window
77
+ if trees = win.treebook.trees and trees.any?
78
+ titles = []
79
+ trees.each {|t| titles << t.tree_mirror.title}
80
+ dialog = TreeFuzzyFilter.new(win,titles)
81
+ dialog.open
82
+ end
83
+ end
84
+ end
85
+
86
+ class TreeFuzzyFilter < FilterListDialog
87
+
88
+ def initialize(win,titles)
89
+ super()
90
+ @win = win
91
+ @titles = titles
92
+ end
93
+
94
+ def selected(text,ix)
95
+ if tree = @win.treebook.trees.detect do |tree|
96
+ tree.tree_mirror.title == text
97
+ end
98
+ if @win.treebook.focussed_tree == tree
99
+ @win.set_trees_visible(true) if not @win.trees_visible?
100
+ else
101
+ @win.treebook.focus_tree(tree)
102
+ end
103
+ tree.focus
104
+ close
105
+ end
106
+ end
107
+
108
+ def update_list(filter)
109
+ @titles.select do |t|
110
+ t.downcase.include?(filter.downcase)
111
+ end
112
+ end
113
+ end
114
+ end
115
+
116
+ end
117
+ end