redcar 0.8.1 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (210) hide show
  1. data/CHANGES +41 -1
  2. data/README.md +1 -1
  3. data/Rakefile +5 -6
  4. data/lib/plugin_manager/lib/plugin_manager.rb +1 -2
  5. data/lib/redcar.rb +19 -14
  6. data/lib/redcar/installer.rb +21 -17
  7. data/lib/redcar/runner.rb +10 -7
  8. data/lib/redcar/usage.rb +1 -0
  9. data/lib/redcar_quick_start.rb +8 -12
  10. data/lib/regex_replace.rb +3 -3
  11. data/plugins/application/features/step_definitions/menu_steps.rb +10 -0
  12. data/plugins/application/features/step_definitions/speedbar_steps.rb +8 -2
  13. data/plugins/application/features/step_definitions/tree_steps.rb +48 -6
  14. data/plugins/application/features/step_definitions/window_steps.rb +9 -4
  15. data/plugins/application/features/support/env.rb +20 -1
  16. data/plugins/application/features/support/fake_event.rb +14 -0
  17. data/plugins/application/lib/application.rb +29 -12
  18. data/plugins/application/lib/application/dialogs/filter_list_dialog.rb +19 -0
  19. data/plugins/application/lib/application/speedbar.rb +23 -17
  20. data/plugins/application/lib/application/tab.rb +20 -15
  21. data/plugins/application/lib/application/treebook.rb +10 -7
  22. data/plugins/application/lib/application/window.rb +1 -1
  23. data/plugins/application/plugin.rb +1 -1
  24. data/plugins/application_swt/lib/application_swt/dialog_adapter.rb +4 -4
  25. data/plugins/application_swt/lib/application_swt/dialogs/filter_list_dialog_controller.rb +15 -4
  26. data/plugins/application_swt/lib/application_swt/icon.rb +3 -5
  27. data/plugins/application_swt/lib/application_swt/notebook/tab_drag_and_drop_listener.rb +4 -4
  28. data/plugins/application_swt/lib/application_swt/notebook/tab_transfer.rb +5 -5
  29. data/plugins/application_swt/lib/application_swt/speedbar.rb +34 -120
  30. data/plugins/application_swt/lib/application_swt/speedbar/button_item.rb +20 -0
  31. data/plugins/application_swt/lib/application_swt/speedbar/combo_item.rb +38 -0
  32. data/plugins/application_swt/lib/application_swt/speedbar/label_item.rb +15 -0
  33. data/plugins/application_swt/lib/application_swt/speedbar/slider_item.rb +32 -0
  34. data/plugins/application_swt/lib/application_swt/speedbar/text_box_item.rb +36 -0
  35. data/plugins/application_swt/lib/application_swt/speedbar/toggle_item.rb +29 -0
  36. data/plugins/application_swt/lib/application_swt/tab.rb +1 -3
  37. data/plugins/application_swt/lib/application_swt/toolbar.rb +19 -20
  38. data/plugins/application_swt/lib/application_swt/treebook.rb +24 -9
  39. data/plugins/application_swt/lib/application_swt/window.rb +110 -98
  40. data/plugins/application_swt/lib/swt/vtab_folder.rb +77 -32
  41. data/plugins/application_swt/lib/swt/vtab_item.rb +9 -0
  42. data/plugins/application_swt/lib/swt/vtab_label.rb +63 -23
  43. data/plugins/application_swt/plugin.rb +1 -1
  44. data/plugins/clipboard-viewer/lib/clipboard_viewer/clipboard_bar.rb +2 -2
  45. data/plugins/comment/features/line_comment.feature +116 -4
  46. data/plugins/comment/lib/comment.rb +18 -16
  47. data/plugins/connection_manager/lib/connection_manager/commands.rb +1 -1
  48. data/plugins/connection_manager/lib/connection_manager/private_key_store.rb +5 -3
  49. data/plugins/declarations/lib/declarations.rb +1 -1
  50. data/plugins/declarations/lib/declarations/parser.rb +68 -20
  51. data/plugins/document_search/features/replace.feature +18 -0
  52. data/plugins/document_search/lib/document_search.rb +37 -54
  53. data/plugins/document_search/lib/document_search/replace_all_command.rb +27 -0
  54. data/plugins/document_search/lib/document_search/replace_command.rb +38 -0
  55. data/plugins/document_search/lib/document_search/replace_next_command.rb +27 -0
  56. data/plugins/document_search/lib/document_search/search_and_replace.rb +17 -24
  57. data/plugins/edit_view/features/step_definitions/editing_steps.rb +4 -4
  58. data/plugins/edit_view/features/step_definitions/tab_steps.rb +9 -0
  59. data/plugins/edit_view/features/step_definitions/window_steps.rb +0 -12
  60. data/plugins/edit_view/lib/edit_view/document.rb +2 -0
  61. data/plugins/edit_view/lib/edit_view/document/command.rb +8 -8
  62. data/plugins/edit_view/lib/edit_view/edit_tab.rb +21 -7
  63. data/plugins/edit_view/lib/edit_view/select_font_dialog.rb +6 -0
  64. data/plugins/edit_view/lib/edit_view/select_theme_dialog.rb +6 -0
  65. data/plugins/edit_view_swt/lib/edit_view_swt.rb +92 -43
  66. data/plugins/edit_view_swt/lib/edit_view_swt/document.rb +17 -4
  67. data/plugins/find-in-project/lib/find_in_project.rb +1 -4
  68. data/plugins/find-in-project/lib/find_in_project/commands.rb +0 -14
  69. data/plugins/find-in-project/lib/find_in_project/controllers.rb +12 -0
  70. data/plugins/find-in-project/lib/find_in_project/views/index.html.erb +5 -0
  71. data/plugins/groovy/features/fixtures/test.groovy +0 -0
  72. data/plugins/groovy/features/step_definitions/groovy_steps.rb +27 -0
  73. data/plugins/groovy/features/support/env.rb +27 -0
  74. data/plugins/groovy/features/syntax_check_groovy.feature +72 -0
  75. data/plugins/groovy/lib/syntax_check/groovy.rb +76 -0
  76. data/plugins/groovy/plugin.rb +7 -0
  77. data/plugins/help/lib/help.rb +28 -4
  78. data/plugins/help/lib/help/help_tab.rb +11 -0
  79. data/plugins/help/lib/help/view_controller.rb +25 -0
  80. data/plugins/help/plugin.rb +2 -1
  81. data/plugins/{view_shortcuts → help}/views/default.css +0 -0
  82. data/plugins/{view_shortcuts → help}/views/index.html.erb +1 -1
  83. data/plugins/{view_shortcuts → help}/views/redcar_small_icon.png +0 -0
  84. data/plugins/html_view/features/browser_bar.feature +47 -0
  85. data/plugins/html_view/features/fixtures/other.html +1 -0
  86. data/plugins/html_view/features/fixtures/sample.html +1 -0
  87. data/plugins/html_view/features/step_definitions/html_view_steps.rb +45 -5
  88. data/plugins/html_view/features/support/env.rb +26 -0
  89. data/plugins/html_view/features/web_preview.feature +21 -0
  90. data/plugins/html_view/lib/html_controller.rb +5 -5
  91. data/plugins/html_view/lib/html_view.rb +62 -10
  92. data/plugins/{web_bookmarks/lib/web_bookmarks → html_view/lib/html_view}/browser_bar.rb +32 -20
  93. data/plugins/html_view/lib/html_view/commands.rb +64 -0
  94. data/plugins/{web_bookmarks/lib/web_bookmarks/view_controller.rb → html_view/lib/html_view/default_controller.rb} +7 -6
  95. data/plugins/html_view/lib/html_view/html_tab.rb +17 -6
  96. data/plugins/html_view/plugin.rb +3 -3
  97. data/plugins/{web_bookmarks → html_view}/views/index.html.erb +0 -0
  98. data/plugins/javascript/features/fixtures/test.js +0 -0
  99. data/plugins/javascript/features/support/env.rb +4 -0
  100. data/plugins/javascript/features/syntax_check_javascript.feature +27 -0
  101. data/plugins/javascript/lib/syntax_check/javascript.rb +52 -0
  102. data/plugins/javascript/plugin.rb +7 -0
  103. data/plugins/javascript/vendor/jslint.js +539 -0
  104. data/plugins/macros/lib/macros/commands.rb +3 -3
  105. data/plugins/open_default_app/lib/open_default_app.rb +29 -3
  106. data/plugins/open_default_app/plugin.rb +1 -1
  107. data/plugins/outline_view/features/outline_view.feature +79 -0
  108. data/plugins/outline_view/features/step_definitions/outline_steps.rb +45 -0
  109. data/plugins/outline_view/lib/outline_view.rb +1 -1
  110. data/plugins/outline_view/spec/fixtures/some_project/javascript.js +10 -0
  111. data/plugins/outline_view/spec/fixtures/some_project/nothing_to_see.rb +0 -0
  112. data/plugins/outline_view/spec/fixtures/some_project/one_lonely_class.rb +2 -0
  113. data/plugins/outline_view/spec/fixtures/some_project/similar_names.rb +18 -0
  114. data/plugins/outline_view/spec/fixtures/some_project/something_fancy.rb +736 -0
  115. data/plugins/outline_view/spec/fixtures/some_project/trailing_space.rb +5 -0
  116. data/plugins/outline_view_swt/lib/outline_view_swt.rb +17 -19
  117. data/plugins/pair_highlighter/lib/pair_highlighter/document_controller.rb +1 -4
  118. data/plugins/plugin_manager_ui/lib/plugin_manager_ui.rb +12 -3
  119. data/plugins/project/features/close_directory_tree.feature +27 -0
  120. data/plugins/project/features/highlight_focussed_tab.feature +45 -1
  121. data/plugins/project/features/open_and_save_files.feature +33 -0
  122. data/plugins/project/features/open_directory_tree.feature +37 -11
  123. data/plugins/project/features/step_definitions/directory_steps.rb +1 -1
  124. data/plugins/project/features/step_definitions/drb_steps.rb +40 -0
  125. data/plugins/project/features/support/env.rb +17 -0
  126. data/plugins/project/lib/project.rb +12 -2
  127. data/plugins/project/lib/project/commands.rb +101 -99
  128. data/plugins/project/lib/project/drb_service.rb +55 -65
  129. data/plugins/project/lib/project/manager.rb +29 -4
  130. data/plugins/project/lib/project/project_tree_controller.rb +24 -0
  131. data/plugins/project/lib/project/support/trash.rb +1 -0
  132. data/plugins/redcar/redcar.rb +100 -37
  133. data/plugins/redcar_debug/lib/redcar_debug.rb +3 -3
  134. data/plugins/repl/features/step_definitions/repl_steps.rb +3 -0
  135. data/plugins/repl/lib/repl.rb +4 -11
  136. data/plugins/repl/lib/repl/repl_tab.rb +26 -0
  137. data/plugins/ruby/features/fixtures/test.rb +0 -0
  138. data/plugins/ruby/features/support/env.rb +4 -0
  139. data/plugins/ruby/features/syntax_check_ruby.feature +25 -0
  140. data/plugins/runnables/features/command_tree.feature +28 -0
  141. data/plugins/runnables/lib/runnables.rb +1 -0
  142. data/plugins/runnables/lib/runnables/commands.rb +4 -4
  143. data/plugins/runnables/lib/runnables/output_processor.rb +5 -5
  144. data/plugins/runnables/lib/runnables/tree_mirror/tree_controller.rb +2 -7
  145. data/plugins/runnables/lib/runnables/tree_mirror/tree_mirror.rb +13 -8
  146. data/plugins/scm_git/lib/scm_git/change.rb +5 -5
  147. data/plugins/strip_trailing_spaces/features/fixtures/test.txt +3 -0
  148. data/plugins/strip_trailing_spaces/features/strip_trailing_spaces.feature +34 -0
  149. data/plugins/strip_trailing_spaces/lib/strip_trailing_spaces.rb +3 -38
  150. data/plugins/swt/lib/swt.rb +5 -13
  151. data/plugins/swt/lib/swt/full_swt.rb +15 -13
  152. data/plugins/syntax_check/features/step_definitions/syntax_check_steps.rb +7 -0
  153. data/plugins/syntax_check/lib/syntax_check.rb +21 -3
  154. data/plugins/syntax_check/lib/syntax_check/error.rb +4 -3
  155. data/plugins/task_manager/lib/task_manager.rb +1 -1
  156. data/plugins/textmate/vendor/redcar-bundles/Bundles/Ant.tmbundle/Preferences/Autocompletions.tmPreferences +345 -0
  157. data/plugins/textmate/vendor/redcar-bundles/Bundles/Ant.tmbundle/Preferences/Symbol List Target.tmPreferences +22 -0
  158. data/plugins/textmate/vendor/redcar-bundles/Bundles/Ant.tmbundle/Snippets/Doc Banner.tmSnippet +20 -0
  159. data/plugins/textmate/vendor/redcar-bundles/Bundles/Ant.tmbundle/Syntaxes/Ant.tmLanguage +247 -0
  160. data/plugins/textmate/vendor/redcar-bundles/Bundles/Ant.tmbundle/info.plist +55 -0
  161. data/plugins/textmate/vendor/redcar-bundles/Bundles/RedcarRepl.tmbundle/Syntaxes/GroovyRepl.plist +40 -0
  162. data/plugins/textmate/vendor/redcar-bundles/Bundles/RedcarRepl.tmbundle/info.plist +1 -1
  163. data/plugins/textmate/vendor/redcar-bundles/Bundles/Ruby Haml.tmbundle/Syntaxes/Ruby_Haml.tmLanguage +0 -1
  164. data/plugins/textmate/vendor/redcar-bundles/Bundles/Ruby Sass.tmbundle/Syntaxes/Ruby Sass.tmLanguage +626 -0
  165. data/plugins/textmate/vendor/redcar-bundles/Bundles/Ruby Sass.tmbundle/info.plist +16 -0
  166. data/plugins/todo_list/features/support/env.rb +8 -0
  167. data/plugins/todo_list/features/todo_list.feature +26 -0
  168. data/plugins/todo_list/lib/todo_list.rb +1 -0
  169. data/plugins/todo_list/lib/todo_list/file_parser.rb +23 -19
  170. data/plugins/todo_list/lib/todo_list/todo_controller.rb +60 -100
  171. data/plugins/todo_list/spec/fixtures/project/FIXME.file +3 -0
  172. data/plugins/todo_list/spec/fixtures/project/NOTE.ignored.file +1 -0
  173. data/plugins/todo_list/spec/fixtures/project/OPTIMIZE_colon.file +1 -0
  174. data/plugins/todo_list/spec/fixtures/project/XXX.ignored +1 -0
  175. data/plugins/todo_list/spec/fixtures/project/ignored_directory/TODO.file +2 -0
  176. data/plugins/todo_list/spec/fixtures/settings.rb +11 -0
  177. data/plugins/todo_list/spec/spec_helper.rb +6 -0
  178. data/plugins/todo_list/spec/todo_list/file_parser_spec.rb +35 -0
  179. data/plugins/tree/lib/tree.rb +1 -0
  180. data/plugins/tree/lib/tree/command.rb +5 -0
  181. data/plugins/web_bookmarks/features/bookmark.feature +37 -0
  182. data/plugins/web_bookmarks/features/fixtures/other.html +1 -0
  183. data/plugins/web_bookmarks/features/fixtures/sample.html +1 -0
  184. data/plugins/web_bookmarks/features/step_definitions/web_steps.rb +4 -0
  185. data/plugins/web_bookmarks/features/support/env.rb +26 -0
  186. data/plugins/web_bookmarks/lib/web_bookmarks.rb +0 -10
  187. data/plugins/web_bookmarks/lib/web_bookmarks/bookmark.rb +10 -1
  188. data/plugins/web_bookmarks/lib/web_bookmarks/commands.rb +1 -47
  189. data/plugins/web_bookmarks/lib/web_bookmarks/tree.rb +21 -14
  190. data/{plugins/application → share}/icons/close.png +0 -0
  191. data/{plugins/application → share}/icons/darwin-file.png +0 -0
  192. data/{plugins/application → share}/icons/darwin-folder.png +0 -0
  193. data/share/icons/open-source-flipped.png +0 -0
  194. data/{plugins/application/icons/redcar_icon_beta_dev.png → share/icons/redcar-icon-beta-dev.png} +0 -0
  195. data/{plugins/application/icons/redcar_icon_beta.png → share/icons/redcar-icon-beta.png} +0 -0
  196. data/{plugins/application → share}/icons/redcar-splash.png +0 -0
  197. metadata +90 -30
  198. data/lib/redcar/jvm_options_probe.rb +0 -33
  199. data/plugins/document_search/lib/document_search/replace.rb +0 -113
  200. data/plugins/document_search/lib/document_search/search.rb +0 -45
  201. data/plugins/outline_view_swt/lib/icons/alias.png +0 -0
  202. data/plugins/outline_view_swt/lib/icons/assignment.png +0 -0
  203. data/plugins/outline_view_swt/lib/icons/attribute.png +0 -0
  204. data/plugins/outline_view_swt/lib/icons/class.png +0 -0
  205. data/plugins/outline_view_swt/lib/icons/interface.png +0 -0
  206. data/plugins/outline_view_swt/lib/icons/method.png +0 -0
  207. data/plugins/strip_trailing_spaces/CHANGELOG +0 -12
  208. data/plugins/strip_trailing_spaces/README.md +0 -32
  209. data/plugins/view_shortcuts/lib/view_shortcuts.rb +0 -52
  210. data/plugins/view_shortcuts/plugin.rb +0 -11
@@ -3,10 +3,15 @@ Then /^the window should have title "([^\"]*)"$/ do |expected_title|
3
3
  active_shell.get_text.should == expected_title
4
4
  end
5
5
 
6
- When /^I manually widen the treebook (only a few pixels|to show the sash)$/ do |w|
7
- if w =~ /^only/
8
- focussed_window.controller.send(:set_sash_widths, Redcar::ApplicationSWT::Window::SASH_WIDTH-1)
6
+ When /^I set the treebook width to (the default|only a few pixels|the minimum width|\d+ pixels)$/ do |w|
7
+ if w == "only a few pixels"
8
+ width = 10
9
+ elsif w == "the minimum width"
10
+ width = Redcar::ApplicationSWT::Window::MINIMUM_TREEBOOK_WIDTH
11
+ elsif w == "the default"
12
+ width = default_treebook_width
9
13
  else
10
- focussed_window.controller.send(:set_sash_widths, Redcar::ApplicationSWT::Window::SASH_WIDTH)
14
+ width = w.split(" ")[0].to_i
11
15
  end
16
+ focussed_window.controller.send(:set_sash_widths, width)
12
17
  end
@@ -1,3 +1,5 @@
1
+ require File.expand_path("../fake_event", __FILE__)
2
+
1
3
  class TestingError < StandardError
2
4
  end
3
5
 
@@ -20,10 +22,22 @@ module SwtHelper
20
22
  def focussed_window
21
23
  Redcar.app.focussed_window
22
24
  end
25
+
26
+ def focussed_treebook_width
27
+ Redcar.app.focussed_window.controller.treebook_width
28
+ end
23
29
 
24
30
  def focussed_tree
25
31
  focussed_window.treebook.focussed_tree
26
32
  end
33
+
34
+ def default_treebook_width
35
+ Redcar.app.focussed_window.controller.default_treebook_width
36
+ end
37
+
38
+ def tree_with_title(title)
39
+ focussed_window.treebook.trees.detect {|t| t.tree_mirror.title == title }
40
+ end
27
41
 
28
42
  def dialog(type)
29
43
  dialogs.detect {|d| d.is_a?(type) }
@@ -56,6 +70,11 @@ module SwtHelper
56
70
  find_node_with_text(all_children, node_text) unless all_children.empty?
57
71
  end
58
72
 
73
+ def swt_label_for_item(vtabitem)
74
+ vtablabel = vtabitem.instance_variable_get "@label"
75
+ vtablabel.instance_variable_get "@label"
76
+ end
77
+
59
78
  module TreeHelpers
60
79
  def items
61
80
  getItems.to_a
@@ -141,7 +160,7 @@ end
141
160
 
142
161
  World(SwtHelper)
143
162
 
144
- def close_everything
163
+ def close_everything
145
164
  Redcar.app.task_queue.cancel_all
146
165
  Swt.sync_exec do
147
166
  dialogs.each {|d| d.controller.model.close }
@@ -0,0 +1,14 @@
1
+ require 'ostruct'
2
+
3
+ class FakeEvent
4
+ def initialize(event_type, widget, options = {})
5
+ untyped_event = Swt::Widgets::Event.new.tap do |e|
6
+ e.display = Swt.display
7
+ e.widget = widget
8
+ e.x = options[:x] || 0
9
+ e.y = options[:y] || 0
10
+ e.button = options[:button] if options[:button]
11
+ end
12
+ widget.notify_listeners(event_type, untyped_event)
13
+ end
14
+ end
@@ -57,6 +57,24 @@ module Redcar
57
57
  win.focussed_notebook.focussed_tab
58
58
  end
59
59
  end,
60
+ Sensitivity.new(:open_htmltab, Redcar.app, false, [:focussed_window, :tab_focussed]) do |tab|
61
+ if win = Redcar.app.focussed_window and
62
+ tab = win.focussed_notebook.focussed_tab
63
+ tab.is_a?(HtmlTab)
64
+ end
65
+ end,
66
+ Sensitivity.new(:open_trees, Redcar.app, false, [:focussed_window, :tree_added, :tree_removed]) do |tree|
67
+ if win = Redcar.app.focussed_window
68
+ trees = win.treebook.trees
69
+ trees and trees.length > 0
70
+ end
71
+ end,
72
+ Sensitivity.new(:focussed_committed_mirror, Redcar.app, false,
73
+ [:focussed_window, :notebook_change, :mirror_committed, :tab_focussed]) do
74
+ if win = Redcar.app.focussed_window and tab = win.focussed_notebook.focussed_tab
75
+ begin;tab.edit_view.document.mirror.path;rescue;false;end
76
+ end
77
+ end,
60
78
  Sensitivity.new(:single_notebook, Redcar.app, true, [:focussed_window, :notebook_change]) do
61
79
  if win = Redcar.app.focussed_window
62
80
  win.notebooks.length == 1
@@ -72,7 +90,8 @@ module Redcar
72
90
  if win = Redcar.app.focussed_window and notebook = win.nonfocussed_notebook
73
91
  notebook.tabs.any?
74
92
  end
75
- end
93
+ end,
94
+ Sensitivity.new(:always_disabled, Redcar.app, false,[]) do; false; end
76
95
  ]
77
96
  end
78
97
 
@@ -86,13 +105,6 @@ module Redcar
86
105
  create_history
87
106
  @event_spewer = EventSpewer.new
88
107
  @task_queue = TaskQueue.new
89
-
90
- # Don't show the toolbar by default on Mac OS X
91
- if Redcar.platform == :osx
92
- Application.storage['show_toolbar'] = false
93
- end
94
-
95
- # Otherwise, use previous setting
96
108
  @show_toolbar = !!Application.storage['show_toolbar']
97
109
  end
98
110
 
@@ -149,10 +161,15 @@ module Redcar
149
161
 
150
162
  def self.storage
151
163
  @storage ||= begin
152
- storage = Plugin::Storage.new('application_plugin')
153
- storage.set_default('stay_resident_after_last_window_closed', false)
154
- storage.set_default('show_toolbar', true)
155
- storage
164
+ storage = Plugin::Storage.new('application_plugin')
165
+ storage.set_default('stay_resident_after_last_window_closed', false)
166
+ # Don't show the toolbar by default on Mac OS X
167
+ if Redcar.platform == :osx
168
+ storage.set_default('show_toolbar', false)
169
+ else
170
+ storage.set_default('show_toolbar', true)
171
+ end
172
+ storage
156
173
  end
157
174
  end
158
175
 
@@ -42,6 +42,14 @@ module Redcar
42
42
  puts "Hooray! You selected #{text} at index #{ix}"
43
43
  end
44
44
 
45
+ # Called by the controller when the user moves through the list.
46
+ #
47
+ # @param [String] the list row text that is now highlighted
48
+ # @param [Integer] the index of the row that is now highlighted
49
+ def moved_to(text, ix)
50
+ # Override with the code you wish you had
51
+ end
52
+
45
53
  # Helper method for fuzzily filtering a list
46
54
  #
47
55
  # @param [Array<A>] list the list to filter
@@ -83,6 +91,17 @@ module Redcar
83
91
  score_match_pairs.map {|a| a.last }
84
92
  end
85
93
 
94
+ # The time interval in seconds in which moved_to events are ignored
95
+ # Override to select different interval
96
+ def step_time
97
+ 1
98
+ end
99
+
100
+ def step?
101
+ @last_step ||= Time.now - step_time
102
+ @last_step + step_time <= Time.now
103
+ end
104
+
86
105
  private
87
106
 
88
107
  def make_regex(text)
@@ -2,14 +2,15 @@
2
2
  module Redcar
3
3
  class Speedbar
4
4
  include Redcar::Model
5
-
5
+
6
6
  LabelItem = ObservableStruct.new(:name, :text)
7
7
  ToggleItem = ObservableStruct.new(:name, :text, :key, :listener, :value)
8
8
  TextBoxItem = ObservableStruct.new(:name, :listener, :value, :edit_view)
9
9
  ButtonItem = ObservableStruct.new(:name, :text, :key, :listener)
10
10
  ComboItem = ObservableStruct.new(:name, :items, :value, :listener)
11
+ SliderItem = ObservableStruct.new(:name, :value, :minimum, :maximum, :increment, :enabled, :listener)
11
12
  KeyItem = ObservableStruct.new(:key, :listener)
12
-
13
+
13
14
  def self.items
14
15
  @items ||= []
15
16
  end
@@ -18,11 +19,11 @@ module Redcar
18
19
  return if items.detect {|i| i.respond_to?(:name) and i.name == item.name }
19
20
  items << item
20
21
  end
21
-
22
+
22
23
  def self.close_image_path
23
- File.join(Redcar.root, %w(plugins application icons close.png))
24
+ File.join(Redcar::ICONS_DIRECTORY, "/close.png")
24
25
  end
25
-
26
+
26
27
  def self.define_item_finder(name)
27
28
  self.class_eval %Q{
28
29
  def #{name}
@@ -30,9 +31,9 @@ module Redcar
30
31
  end
31
32
  }
32
33
  end
33
-
34
+
34
35
  def __get_item(name)
35
- item = __items.detect do |i|
36
+ item = __items.detect do |i|
36
37
  i.respond_to?(:name) and
37
38
  i.name.to_s == name
38
39
  end
@@ -41,15 +42,15 @@ module Redcar
41
42
  end
42
43
  item
43
44
  end
44
-
45
+
45
46
  def __items
46
47
  @__items ||= self.class.items.map {|i| i.clone }
47
48
  end
48
-
49
+
49
50
  def __get_item_by_text_or_name(name)
50
51
  __items.detect {|i| (i.respond_to?(:text) and i.text == name) or i.name.to_s == name.to_s }
51
52
  end
52
-
53
+
53
54
  def __get_item_by_label(name)
54
55
  label = __items.detect {|i| i.is_a?(LabelItem) and (i.text == name or i.name.to_s == name.to_s)}
55
56
  if label
@@ -57,36 +58,41 @@ module Redcar
57
58
  __items[index_of_label + 1]
58
59
  end
59
60
  end
60
-
61
+
61
62
  def self.label(name, text)
62
63
  append_item LabelItem.new(name, text)
63
64
  define_item_finder(name)
64
65
  end
65
-
66
+
66
67
  def self.toggle(name, text, key, value=false, &block)
67
68
  append_item ToggleItem.new(name, text, key, block, value)
68
69
  define_item_finder(name)
69
70
  end
70
-
71
+
71
72
  def self.textbox(name, value="", &block)
72
73
  append_item TextBoxItem.new(name, block, value)
73
74
  define_item_finder(name)
74
75
  end
75
-
76
+
76
77
  def self.button(name, text, key, &block)
77
78
  append_item ButtonItem.new(name, text, key, block)
78
79
  define_item_finder(name)
79
80
  end
80
-
81
+
81
82
  def self.combo(name, items=[], value=nil, &block)
82
83
  append_item ComboItem.new(name, items, value, block)
83
84
  define_item_finder(name)
84
85
  end
85
-
86
+
87
+ def self.slider(name, value = 50, minimum = 0, maximum = 100, increment = 1, &block)
88
+ append_item SliderItem.new(name, value, minimum, maximum, increment, true, block)
89
+ define_item_finder(name)
90
+ end
91
+
86
92
  def self.key(key, &block)
87
93
  append_item KeyItem.new(key, block)
88
94
  end
89
-
95
+
90
96
  def inspect
91
97
  "#<Speedbar #{__items.inspect}"
92
98
  end
@@ -2,16 +2,21 @@ module Redcar
2
2
  class Tab
3
3
  include Redcar::Model
4
4
  include Redcar::Observable
5
-
6
- DEFAULT_ICON = :file
7
-
5
+
6
+ DEFAULT_ICON = :file
7
+ NO_WRITE_ICON = :exclamation_red
8
+ MISSING_ICON = :exclamation
9
+ CONFIG_ICON = :hammer_screwdriver
10
+ HELP_ICON = :question
11
+ WEB_ICON = :globe
12
+
8
13
  attr_reader :notebook
9
-
14
+
10
15
  def initialize(notebook)
11
16
  @notebook = notebook
12
17
  @title = "unknown"
13
18
  end
14
-
19
+
15
20
  # Close the tab (remove it from the Notebook).
16
21
  #
17
22
  # Events: close
@@ -20,8 +25,8 @@ module Redcar
20
25
  notify_listeners(:close)
21
26
  end
22
27
  end
23
-
24
- # Focus the tab within the notebook, and gives the keyboard focus to the
28
+
29
+ # Focus the tab within the notebook, and gives the keyboard focus to the
25
30
  # contents of the tab, if appropriate.
26
31
  #
27
32
  # Events: focus
@@ -39,11 +44,11 @@ module Redcar
39
44
  @title = title
40
45
  notify_listeners(:changed_title, title)
41
46
  end
42
-
47
+
43
48
  def icon
44
49
  @icon || DEFAULT_ICON
45
50
  end
46
-
51
+
47
52
  def icon=(value)
48
53
  @icon = value
49
54
  notify_listeners(:changed_icon, icon)
@@ -58,30 +63,30 @@ module Redcar
58
63
  @notebook = notebook
59
64
  end
60
65
 
61
- # Moves the tab to a new position in the notebook, if said position
66
+ # Moves the tab to a new position in the notebook, if said position
62
67
  # is currently occupied. Defaults to the first position, if none
63
68
  # is passed.
64
- #
69
+ #
65
70
  # Events: moved (position)
66
71
  def move_to_position(position = 0)
67
72
  if (0..@notebook.tabs.size - 1).include?(position)
68
73
  notify_listeners(:moved, position)
69
74
  end
70
75
  end
71
-
76
+
72
77
  def edit_tab?
73
78
  is_a?(EditTab)
74
79
  end
75
-
80
+
76
81
  # Helper method to get the edit_view's document, if applicable.
77
82
  def document
78
83
  edit_view.document if edit_tab?
79
84
  end
80
-
85
+
81
86
  # Helper method to get this tab's Mirror object for the current
82
87
  # document, if applicable.
83
88
  def document_mirror
84
89
  document.mirror if document
85
- end
90
+ end
86
91
  end
87
92
  end
@@ -2,14 +2,14 @@ module Redcar
2
2
  class Treebook
3
3
  include Redcar::Observable
4
4
  include Redcar::Model
5
-
5
+
6
6
  attr_reader :trees, :focussed_tree
7
-
7
+
8
8
  def initialize
9
9
  @trees = []
10
10
  @focussed_tree = nil
11
11
  end
12
-
12
+
13
13
  # Add a tree to this treebook
14
14
  #
15
15
  # @param [Redcar::Tree]
@@ -17,16 +17,18 @@ module Redcar
17
17
  @trees << tree
18
18
  @focussed_tree = tree
19
19
  notify_listeners(:tree_added, tree)
20
+ Redcar.app.repeat_event(:tree_added) if Redcar.app
20
21
  end
21
-
22
+
22
23
  # Bring the tree to the front
23
24
  #
24
25
  # @param [Redcar::Tree]
25
26
  def focus_tree(tree)
27
+ return if @focussed_tree == tree
26
28
  @focussed_tree = tree
27
29
  notify_listeners(:tree_focussed, tree)
28
30
  end
29
-
31
+
30
32
  # Remove a tree from this treebook
31
33
  #
32
34
  # @param [Redcar::Tree]
@@ -37,11 +39,12 @@ module Redcar
37
39
  if tree == focussed_tree
38
40
  focus_tree(trees.first) if trees.any?
39
41
  end
42
+ Redcar.app.repeat_event(:tree_removed) if Redcar.app
40
43
  end
41
44
  end
42
-
45
+
43
46
  private
44
-
47
+
45
48
  # Tell the Treebook that this tree has been focussed in the GUI.
46
49
  def set_focussed_tree(tree)
47
50
  @focussed_tree = tree
@@ -35,7 +35,7 @@ module Redcar
35
35
  end
36
36
 
37
37
  def trees_visible?
38
- controller.treebook_visible?
38
+ not controller.treebook_hidden?
39
39
  end
40
40
 
41
41
  def title