redcar 0.3.7.1 → 0.3.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (246) hide show
  1. data/CHANGES +16 -0
  2. data/README.md +5 -0
  3. data/ROADMAP.md +7 -9
  4. data/Rakefile +55 -22
  5. data/lib/redcar.rb +12 -6
  6. data/lib/redcar/installer.rb +119 -44
  7. data/plugins/application/features/step_definitions/speedbar_steps.rb +62 -0
  8. data/plugins/application/features/step_definitions/tree_steps.rb +3 -3
  9. data/plugins/application/features/support/env.rb +2 -1
  10. data/plugins/application/lib/application/notebook.rb +53 -7
  11. data/plugins/application/lib/application/speedbar.rb +12 -0
  12. data/plugins/application/lib/application/tab.rb +16 -5
  13. data/plugins/application/lib/application/treebook.rb +21 -1
  14. data/plugins/application_swt/lib/application_swt.rb +12 -2
  15. data/plugins/application_swt/lib/application_swt/html_tab.rb +4 -0
  16. data/plugins/application_swt/lib/application_swt/notebook.rb +5 -3
  17. data/plugins/application_swt/lib/application_swt/speedbar.rb +15 -27
  18. data/plugins/application_swt/lib/application_swt/swt_wrapper.rb +1 -0
  19. data/plugins/application_swt/lib/application_swt/tab.rb +1 -0
  20. data/plugins/application_swt/lib/application_swt/treebook.rb +36 -8
  21. data/plugins/application_swt/lib/application_swt/window.rb +24 -18
  22. data/plugins/auto_completer/lib/auto_completer.rb +5 -20
  23. data/plugins/core/lib/core.rb +7 -4
  24. data/plugins/core/lib/core/observable_struct.rb +2 -2
  25. data/plugins/declarations/lib/declarations.rb +3 -17
  26. data/plugins/document_search/features/search.feature +163 -0
  27. data/plugins/document_search/features/support/env.rb +4 -0
  28. data/plugins/document_search/lib/document_search.rb +121 -0
  29. data/plugins/document_search/plugin.rb +8 -0
  30. data/plugins/edit_view/features/line_delimiter.feature +7 -0
  31. data/plugins/edit_view/features/step_definitions/editing_steps.rb +49 -1
  32. data/plugins/edit_view/features/step_definitions/tab_steps.rb +10 -11
  33. data/plugins/edit_view/features/switch_tabs.feature +61 -10
  34. data/plugins/edit_view/lib/edit_view.rb +4 -0
  35. data/plugins/edit_view/lib/edit_view/document.rb +56 -0
  36. data/plugins/edit_view/lib/edit_view/document/command.rb +1 -1
  37. data/plugins/edit_view/lib/edit_view/edit_tab.rb +0 -8
  38. data/plugins/edit_view_swt/lib/edit_view_swt.rb +4 -0
  39. data/plugins/html_view/lib/html_controller.rb +19 -1
  40. data/plugins/html_view/lib/html_view.rb +28 -1
  41. data/plugins/html_view/lib/html_view/html_tab.rb +10 -1
  42. data/plugins/plugin_manager_ui/lib/plugin_manager_ui.rb +3 -1
  43. data/plugins/project/features/open_directory_tree.feature +3 -3
  44. data/plugins/project/lib/project.rb +4 -6
  45. data/plugins/project/lib/project/commands.rb +17 -0
  46. data/plugins/project/lib/project/dir_controller.rb +2 -1
  47. data/plugins/project/lib/project/dir_mirror.rb +8 -0
  48. data/plugins/project/lib/project/manager.rb +2 -0
  49. data/plugins/project/plugin.rb +2 -1
  50. data/plugins/project/vendor/net-sftp/Manifest +55 -0
  51. data/plugins/project/vendor/net-sftp/Rakefile +30 -0
  52. data/plugins/project/vendor/net-sftp/lib/net/sftp.rb +70 -0
  53. data/plugins/project/vendor/net-sftp/lib/net/sftp/constants.rb +187 -0
  54. data/plugins/project/vendor/net-sftp/lib/net/sftp/errors.rb +39 -0
  55. data/plugins/project/vendor/net-sftp/lib/net/sftp/operations/dir.rb +93 -0
  56. data/plugins/project/vendor/net-sftp/lib/net/sftp/operations/download.rb +364 -0
  57. data/plugins/project/vendor/net-sftp/lib/net/sftp/operations/file.rb +176 -0
  58. data/plugins/project/vendor/net-sftp/lib/net/sftp/operations/file_factory.rb +60 -0
  59. data/plugins/project/vendor/net-sftp/lib/net/sftp/operations/upload.rb +387 -0
  60. data/plugins/project/vendor/net-sftp/lib/net/sftp/packet.rb +21 -0
  61. data/plugins/project/vendor/net-sftp/lib/net/sftp/protocol.rb +32 -0
  62. data/plugins/project/vendor/net-sftp/lib/net/sftp/protocol/01/attributes.rb +315 -0
  63. data/plugins/project/vendor/net-sftp/lib/net/sftp/protocol/01/base.rb +268 -0
  64. data/plugins/project/vendor/net-sftp/lib/net/sftp/protocol/01/name.rb +43 -0
  65. data/plugins/project/vendor/net-sftp/lib/net/sftp/protocol/02/base.rb +31 -0
  66. data/plugins/project/vendor/net-sftp/lib/net/sftp/protocol/03/base.rb +35 -0
  67. data/plugins/project/vendor/net-sftp/lib/net/sftp/protocol/04/attributes.rb +152 -0
  68. data/plugins/project/vendor/net-sftp/lib/net/sftp/protocol/04/base.rb +94 -0
  69. data/plugins/project/vendor/net-sftp/lib/net/sftp/protocol/04/name.rb +67 -0
  70. data/plugins/project/vendor/net-sftp/lib/net/sftp/protocol/05/base.rb +66 -0
  71. data/plugins/project/vendor/net-sftp/lib/net/sftp/protocol/06/attributes.rb +107 -0
  72. data/plugins/project/vendor/net-sftp/lib/net/sftp/protocol/06/base.rb +63 -0
  73. data/plugins/project/vendor/net-sftp/lib/net/sftp/protocol/base.rb +50 -0
  74. data/plugins/project/vendor/net-sftp/lib/net/sftp/request.rb +91 -0
  75. data/plugins/project/vendor/net-sftp/lib/net/sftp/response.rb +76 -0
  76. data/plugins/project/vendor/net-sftp/lib/net/sftp/session.rb +951 -0
  77. data/plugins/project/vendor/net-sftp/lib/net/sftp/version.rb +18 -0
  78. data/plugins/project/vendor/net-sftp/setup.rb +1331 -0
  79. data/plugins/project/vendor/net-sftp/test/common.rb +171 -0
  80. data/plugins/project/vendor/net-sftp/test/protocol/01/test_attributes.rb +97 -0
  81. data/plugins/project/vendor/net-sftp/test/protocol/01/test_base.rb +210 -0
  82. data/plugins/project/vendor/net-sftp/test/protocol/01/test_name.rb +27 -0
  83. data/plugins/project/vendor/net-sftp/test/protocol/02/test_base.rb +26 -0
  84. data/plugins/project/vendor/net-sftp/test/protocol/03/test_base.rb +27 -0
  85. data/plugins/project/vendor/net-sftp/test/protocol/04/test_attributes.rb +148 -0
  86. data/plugins/project/vendor/net-sftp/test/protocol/04/test_base.rb +74 -0
  87. data/plugins/project/vendor/net-sftp/test/protocol/04/test_name.rb +53 -0
  88. data/plugins/project/vendor/net-sftp/test/protocol/05/test_base.rb +62 -0
  89. data/plugins/project/vendor/net-sftp/test/protocol/06/test_attributes.rb +124 -0
  90. data/plugins/project/vendor/net-sftp/test/protocol/06/test_base.rb +51 -0
  91. data/plugins/project/vendor/net-sftp/test/protocol/test_base.rb +42 -0
  92. data/plugins/project/vendor/net-sftp/test/test_all.rb +7 -0
  93. data/plugins/project/vendor/net-sftp/test/test_dir.rb +47 -0
  94. data/plugins/project/vendor/net-sftp/test/test_download.rb +252 -0
  95. data/plugins/project/vendor/net-sftp/test/test_file.rb +159 -0
  96. data/plugins/project/vendor/net-sftp/test/test_file_factory.rb +48 -0
  97. data/plugins/project/vendor/net-sftp/test/test_packet.rb +9 -0
  98. data/plugins/project/vendor/net-sftp/test/test_protocol.rb +17 -0
  99. data/plugins/project/vendor/net-sftp/test/test_request.rb +71 -0
  100. data/plugins/project/vendor/net-sftp/test/test_response.rb +53 -0
  101. data/plugins/project/vendor/net-sftp/test/test_session.rb +741 -0
  102. data/plugins/project/vendor/net-sftp/test/test_upload.rb +219 -0
  103. data/plugins/project/vendor/net-ssh/Manifest +110 -0
  104. data/plugins/project/vendor/net-ssh/Rakefile +85 -0
  105. data/plugins/project/vendor/net-ssh/Rudyfile +96 -0
  106. data/plugins/project/vendor/net-ssh/lib/net/ssh.rb +215 -0
  107. data/plugins/project/vendor/net-ssh/lib/net/ssh/authentication/agent.rb +179 -0
  108. data/plugins/project/vendor/net-ssh/lib/net/ssh/authentication/constants.rb +18 -0
  109. data/plugins/project/vendor/net-ssh/lib/net/ssh/authentication/key_manager.rb +193 -0
  110. data/plugins/project/vendor/net-ssh/lib/net/ssh/authentication/methods/abstract.rb +60 -0
  111. data/plugins/project/vendor/net-ssh/lib/net/ssh/authentication/methods/hostbased.rb +71 -0
  112. data/plugins/project/vendor/net-ssh/lib/net/ssh/authentication/methods/keyboard_interactive.rb +66 -0
  113. data/plugins/project/vendor/net-ssh/lib/net/ssh/authentication/methods/password.rb +39 -0
  114. data/plugins/project/vendor/net-ssh/lib/net/ssh/authentication/methods/publickey.rb +92 -0
  115. data/plugins/project/vendor/net-ssh/lib/net/ssh/authentication/pageant.rb +183 -0
  116. data/plugins/project/vendor/net-ssh/lib/net/ssh/authentication/session.rb +134 -0
  117. data/plugins/project/vendor/net-ssh/lib/net/ssh/buffer.rb +340 -0
  118. data/plugins/project/vendor/net-ssh/lib/net/ssh/buffered_io.rb +198 -0
  119. data/plugins/project/vendor/net-ssh/lib/net/ssh/config.rb +202 -0
  120. data/plugins/project/vendor/net-ssh/lib/net/ssh/connection/channel.rb +630 -0
  121. data/plugins/project/vendor/net-ssh/lib/net/ssh/connection/constants.rb +33 -0
  122. data/plugins/project/vendor/net-ssh/lib/net/ssh/connection/session.rb +597 -0
  123. data/plugins/project/vendor/net-ssh/lib/net/ssh/connection/term.rb +178 -0
  124. data/plugins/project/vendor/net-ssh/lib/net/ssh/errors.rb +85 -0
  125. data/plugins/project/vendor/net-ssh/lib/net/ssh/key_factory.rb +102 -0
  126. data/plugins/project/vendor/net-ssh/lib/net/ssh/known_hosts.rb +129 -0
  127. data/plugins/project/vendor/net-ssh/lib/net/ssh/loggable.rb +61 -0
  128. data/plugins/project/vendor/net-ssh/lib/net/ssh/packet.rb +102 -0
  129. data/plugins/project/vendor/net-ssh/lib/net/ssh/prompt.rb +93 -0
  130. data/plugins/project/vendor/net-ssh/lib/net/ssh/proxy/command.rb +75 -0
  131. data/plugins/project/vendor/net-ssh/lib/net/ssh/proxy/errors.rb +14 -0
  132. data/plugins/project/vendor/net-ssh/lib/net/ssh/proxy/http.rb +94 -0
  133. data/plugins/project/vendor/net-ssh/lib/net/ssh/proxy/socks4.rb +70 -0
  134. data/plugins/project/vendor/net-ssh/lib/net/ssh/proxy/socks5.rb +142 -0
  135. data/plugins/project/vendor/net-ssh/lib/net/ssh/ruby_compat.rb +43 -0
  136. data/plugins/project/vendor/net-ssh/lib/net/ssh/service/forward.rb +288 -0
  137. data/plugins/project/vendor/net-ssh/lib/net/ssh/test.rb +89 -0
  138. data/plugins/project/vendor/net-ssh/lib/net/ssh/test/channel.rb +129 -0
  139. data/plugins/project/vendor/net-ssh/lib/net/ssh/test/extensions.rb +152 -0
  140. data/plugins/project/vendor/net-ssh/lib/net/ssh/test/kex.rb +44 -0
  141. data/plugins/project/vendor/net-ssh/lib/net/ssh/test/local_packet.rb +51 -0
  142. data/plugins/project/vendor/net-ssh/lib/net/ssh/test/packet.rb +81 -0
  143. data/plugins/project/vendor/net-ssh/lib/net/ssh/test/remote_packet.rb +38 -0
  144. data/plugins/project/vendor/net-ssh/lib/net/ssh/test/script.rb +157 -0
  145. data/plugins/project/vendor/net-ssh/lib/net/ssh/test/socket.rb +64 -0
  146. data/plugins/project/vendor/net-ssh/lib/net/ssh/transport/algorithms.rb +384 -0
  147. data/plugins/project/vendor/net-ssh/lib/net/ssh/transport/cipher_factory.rb +97 -0
  148. data/plugins/project/vendor/net-ssh/lib/net/ssh/transport/constants.rb +30 -0
  149. data/plugins/project/vendor/net-ssh/lib/net/ssh/transport/hmac.rb +31 -0
  150. data/plugins/project/vendor/net-ssh/lib/net/ssh/transport/hmac/abstract.rb +79 -0
  151. data/plugins/project/vendor/net-ssh/lib/net/ssh/transport/hmac/md5.rb +12 -0
  152. data/plugins/project/vendor/net-ssh/lib/net/ssh/transport/hmac/md5_96.rb +11 -0
  153. data/plugins/project/vendor/net-ssh/lib/net/ssh/transport/hmac/none.rb +15 -0
  154. data/plugins/project/vendor/net-ssh/lib/net/ssh/transport/hmac/sha1.rb +13 -0
  155. data/plugins/project/vendor/net-ssh/lib/net/ssh/transport/hmac/sha1_96.rb +11 -0
  156. data/plugins/project/vendor/net-ssh/lib/net/ssh/transport/identity_cipher.rb +55 -0
  157. data/plugins/project/vendor/net-ssh/lib/net/ssh/transport/kex.rb +13 -0
  158. data/plugins/project/vendor/net-ssh/lib/net/ssh/transport/kex/diffie_hellman_group1_sha1.rb +208 -0
  159. data/plugins/project/vendor/net-ssh/lib/net/ssh/transport/kex/diffie_hellman_group_exchange_sha1.rb +77 -0
  160. data/plugins/project/vendor/net-ssh/lib/net/ssh/transport/openssl.rb +128 -0
  161. data/plugins/project/vendor/net-ssh/lib/net/ssh/transport/packet_stream.rb +235 -0
  162. data/plugins/project/vendor/net-ssh/lib/net/ssh/transport/server_version.rb +71 -0
  163. data/plugins/project/vendor/net-ssh/lib/net/ssh/transport/session.rb +276 -0
  164. data/plugins/project/vendor/net-ssh/lib/net/ssh/transport/state.rb +206 -0
  165. data/plugins/project/vendor/net-ssh/lib/net/ssh/verifiers/lenient.rb +30 -0
  166. data/plugins/project/vendor/net-ssh/lib/net/ssh/verifiers/null.rb +12 -0
  167. data/plugins/project/vendor/net-ssh/lib/net/ssh/verifiers/strict.rb +53 -0
  168. data/plugins/project/vendor/net-ssh/lib/net/ssh/version.rb +62 -0
  169. data/plugins/project/vendor/net-ssh/net-ssh.gemspec +138 -0
  170. data/plugins/project/vendor/net-ssh/setup.rb +1585 -0
  171. data/plugins/project/vendor/net-ssh/support/arcfour_check.rb +20 -0
  172. data/plugins/project/vendor/net-ssh/support/ssh_tunnel_bug.rb +65 -0
  173. data/plugins/project/vendor/net-ssh/test/README.txt +42 -0
  174. data/plugins/project/vendor/net-ssh/test/authentication/methods/common.rb +28 -0
  175. data/plugins/project/vendor/net-ssh/test/authentication/methods/test_abstract.rb +51 -0
  176. data/plugins/project/vendor/net-ssh/test/authentication/methods/test_hostbased.rb +114 -0
  177. data/plugins/project/vendor/net-ssh/test/authentication/methods/test_keyboard_interactive.rb +98 -0
  178. data/plugins/project/vendor/net-ssh/test/authentication/methods/test_password.rb +50 -0
  179. data/plugins/project/vendor/net-ssh/test/authentication/methods/test_publickey.rb +127 -0
  180. data/plugins/project/vendor/net-ssh/test/authentication/test_agent.rb +205 -0
  181. data/plugins/project/vendor/net-ssh/test/authentication/test_key_manager.rb +105 -0
  182. data/plugins/project/vendor/net-ssh/test/authentication/test_session.rb +93 -0
  183. data/plugins/project/vendor/net-ssh/test/common.rb +107 -0
  184. data/plugins/project/vendor/net-ssh/test/configs/eqsign +3 -0
  185. data/plugins/project/vendor/net-ssh/test/configs/exact_match +8 -0
  186. data/plugins/project/vendor/net-ssh/test/configs/host_plus +10 -0
  187. data/plugins/project/vendor/net-ssh/test/configs/multihost +4 -0
  188. data/plugins/project/vendor/net-ssh/test/configs/nohost +19 -0
  189. data/plugins/project/vendor/net-ssh/test/configs/numeric_host +4 -0
  190. data/plugins/project/vendor/net-ssh/test/configs/wild_cards +14 -0
  191. data/plugins/project/vendor/net-ssh/test/connection/test_channel.rb +467 -0
  192. data/plugins/project/vendor/net-ssh/test/connection/test_session.rb +488 -0
  193. data/plugins/project/vendor/net-ssh/test/manual/test_forward.rb +185 -0
  194. data/plugins/project/vendor/net-ssh/test/test_all.rb +9 -0
  195. data/plugins/project/vendor/net-ssh/test/test_buffer.rb +336 -0
  196. data/plugins/project/vendor/net-ssh/test/test_buffered_io.rb +63 -0
  197. data/plugins/project/vendor/net-ssh/test/test_config.rb +117 -0
  198. data/plugins/project/vendor/net-ssh/test/test_key_factory.rb +67 -0
  199. data/plugins/project/vendor/net-ssh/test/transport/hmac/test_md5.rb +39 -0
  200. data/plugins/project/vendor/net-ssh/test/transport/hmac/test_md5_96.rb +25 -0
  201. data/plugins/project/vendor/net-ssh/test/transport/hmac/test_none.rb +34 -0
  202. data/plugins/project/vendor/net-ssh/test/transport/hmac/test_sha1.rb +34 -0
  203. data/plugins/project/vendor/net-ssh/test/transport/hmac/test_sha1_96.rb +25 -0
  204. data/plugins/project/vendor/net-ssh/test/transport/kex/test_diffie_hellman_group1_sha1.rb +146 -0
  205. data/plugins/project/vendor/net-ssh/test/transport/kex/test_diffie_hellman_group_exchange_sha1.rb +92 -0
  206. data/plugins/project/vendor/net-ssh/test/transport/test_algorithms.rb +302 -0
  207. data/plugins/project/vendor/net-ssh/test/transport/test_cipher_factory.rb +213 -0
  208. data/plugins/project/vendor/net-ssh/test/transport/test_hmac.rb +34 -0
  209. data/plugins/project/vendor/net-ssh/test/transport/test_identity_cipher.rb +40 -0
  210. data/plugins/project/vendor/net-ssh/test/transport/test_packet_stream.rb +441 -0
  211. data/plugins/project/vendor/net-ssh/test/transport/test_server_version.rb +78 -0
  212. data/plugins/project/vendor/net-ssh/test/transport/test_session.rb +315 -0
  213. data/plugins/project/vendor/net-ssh/test/transport/test_state.rb +173 -0
  214. data/plugins/redcar/plugin.rb +3 -1
  215. data/plugins/redcar/redcar.rb +108 -121
  216. data/plugins/redcar_debug/lib/redcar_debug.rb +2 -0
  217. data/plugins/runnables/lib/runnables.rb +80 -23
  218. data/plugins/runnables/lib/runnables/command_output_controller.rb +102 -0
  219. data/plugins/runnables/lib/runnables/running_process_checker.rb +34 -0
  220. data/plugins/runnables/{plugin_no_load.rb → plugin.rb} +2 -1
  221. data/plugins/runnables/vendor/session-2.4.0/HISTORY +73 -0
  222. data/plugins/runnables/vendor/session-2.4.0/README +89 -0
  223. data/plugins/runnables/vendor/session-2.4.0/TODO +3 -0
  224. data/plugins/runnables/vendor/session-2.4.0/VERSION +1 -0
  225. data/plugins/runnables/vendor/session-2.4.0/gemspec.rb +22 -0
  226. data/plugins/runnables/vendor/session-2.4.0/install.rb +143 -0
  227. data/plugins/runnables/vendor/session-2.4.0/lib/session.rb +757 -0
  228. data/plugins/runnables/vendor/session-2.4.0/sample/bash.rb +60 -0
  229. data/plugins/runnables/vendor/session-2.4.0/sample/driver.rb +47 -0
  230. data/plugins/runnables/vendor/session-2.4.0/sample/session_idl.rb +25 -0
  231. data/plugins/runnables/vendor/session-2.4.0/sample/session_sh.rb +29 -0
  232. data/plugins/runnables/vendor/session-2.4.0/sample/sh0.rb +23 -0
  233. data/plugins/runnables/vendor/session-2.4.0/sample/stdin.rb +17 -0
  234. data/plugins/runnables/vendor/session-2.4.0/sample/threadtest.rb +42 -0
  235. data/plugins/runnables/vendor/session-2.4.0/session-2.4.0.gem +0 -0
  236. data/plugins/runnables/vendor/session-2.4.0/test/session.rb +227 -0
  237. data/plugins/runnables/views/command_output.html.erb +32 -0
  238. data/plugins/task_manager/lib/task_manager.rb +2 -0
  239. data/plugins/textmate/lib/textmate/plist.rb +1 -1
  240. data/plugins/textmate/lib/textmate/snippet.rb +1 -0
  241. data/plugins/tree/lib/tree/mirror.rb +8 -1
  242. data/plugins/tree_view_swt/lib/tree_view_swt.rb +29 -2
  243. metadata +191 -6
  244. data/plugins/declarations/TODO +0 -3
  245. data/plugins/redcar/spec/redcar/redcar_spec.rb +0 -70
  246. data/plugins/redcar/spec/spec_helper.rb +0 -4
@@ -0,0 +1,62 @@
1
+
2
+ Then /^the (.*) speedbar should be open$/ do |class_name|
3
+ Redcar.app.focussed_window.speedbar.class.to_s.should == class_name
4
+ end
5
+
6
+ def get_speedbar_text_field(field_name)
7
+ speedbar = Redcar.app.focussed_window.speedbar
8
+ item = speedbar.__get_item_by_label(field_name) ||
9
+ speedbar.__get_item_by_label(field_name + ":") ||
10
+ speedbar.__get_item(field_name)
11
+ expected_klass = Redcar::Speedbar::TextBoxItem
12
+ unless item.is_a?(expected_klass)
13
+ raise "expected #{item} to be a #{expected_klass}"
14
+ end
15
+ item
16
+ end
17
+
18
+ When /^I type "([^"]*)" into the "([^"]*)" field in the speedbar$/ do |text, field_name|
19
+ get_speedbar_text_field(field_name).edit_view.document.text = text
20
+ end
21
+
22
+ When /^I press "([^"]*)" in the speedbar$/ do |button_name|
23
+ speedbar = Redcar.app.focussed_window.speedbar
24
+ speedbar.controller.execute_listener_in_model(speedbar.__get_item_by_text_or_name(button_name))
25
+ end
26
+
27
+ When /^I check "([^"]*)" in the speedbar$/ do |checkbox_name|
28
+ speedbar = Redcar.app.focussed_window.speedbar
29
+ item = speedbar.__get_item_by_text_or_name(checkbox_name)
30
+ item.set_value(true)
31
+ speedbar.controller.execute_listener_in_model(item, true)
32
+ end
33
+
34
+ When /^I uncheck "([^"]*)" in the speedbar$/ do |checkbox_name|
35
+ speedbar = Redcar.app.focussed_window.speedbar
36
+ item = speedbar.__get_item_by_text_or_name(checkbox_name)
37
+ item.set_value(false)
38
+ speedbar.controller.execute_listener_in_model(item, false)
39
+ end
40
+
41
+ When /^I close the speedbar$/ do
42
+ Redcar.app.focussed_window.close_speedbar
43
+ end
44
+
45
+ Then /^the "([^"]*)" field in the speedbar should have text "([^"]*)"$/ do |field_name, text|
46
+ get_speedbar_text_field(field_name).edit_view.document.to_s.should == text
47
+ end
48
+
49
+ Then /^"([^"]*)" should be checked in the speedbar$/ do |checkbox_name|
50
+ speedbar = Redcar.app.focussed_window.speedbar
51
+ item = speedbar.__get_item_by_text_or_name(checkbox_name)
52
+ item.value.should be_true
53
+ end
54
+
55
+ Then /^"([^"]*)" should not be checked in the speedbar$/ do |checkbox_name|
56
+ speedbar = Redcar.app.focussed_window.speedbar
57
+ item = speedbar.__get_item_by_text_or_name(checkbox_name)
58
+ item.value.should be_false
59
+ end
60
+
61
+
62
+
@@ -17,8 +17,8 @@ Then /^I should (not )?see "([^\"]*)" in the tree$/ do |bool, rows|
17
17
  end
18
18
  end
19
19
 
20
- Then /^the directory tree width should be the default$/ do
20
+ Then /^the tree width should be the default$/ do
21
21
  width = Redcar.app.focussed_window.treebook.trees.last.controller.viewer.control.bounds.width
22
- default = Redcar::ApplicationSWT::Window::TREEBOOK_WIDTH + Redcar::ApplicationSWT::Window::SASH_WIDTH
23
- raise "The directory tree width was #{width}, expected #{default}" unless width == default
22
+ default = Redcar::ApplicationSWT::Window::TREEBOOK_WIDTH + Redcar::ApplicationSWT::Window::SASH_WIDTH - 5
23
+ raise "The tree width was #{width}, expected #{default}" unless width == default
24
24
  end
@@ -25,7 +25,7 @@ module SwtHelper
25
25
  end
26
26
 
27
27
  def tree_book
28
- active_shell.children.to_a.first.children.to_a.first
28
+ active_shell.children.to_a.first.children.to_a.first.children.to_a.first.children.to_a.first
29
29
  end
30
30
 
31
31
  def top_tree
@@ -114,6 +114,7 @@ def close_everything
114
114
  end
115
115
  end
116
116
  Redcar::ApplicationSWT.sync_exec do
117
+ Redcar.app.focussed_window.close_speedbar if Redcar.app.focussed_window.speedbar
117
118
  Redcar.app.windows.first.title = Redcar::Window::DEFAULT_TITLE
118
119
  end
119
120
  end
@@ -68,21 +68,67 @@ module Redcar
68
68
  end
69
69
 
70
70
  # Focus the next tab to the right from the currently focussed tab.
71
- # Does not wrap.
71
+ # Wraps.
72
72
  def switch_up
73
- current_ix = @tabs.index(@focussed_tab)
74
- unless current_ix == @tabs.length - 1 or current_ix == nil
75
- @tabs[current_ix+1].focus
73
+ focussed do |current_ix|
74
+ current_ix = wrap_index(current_ix + 1)
75
+ @tabs[current_ix].focus
76
76
  end
77
77
  end
78
78
 
79
79
  # Focus the next tab to the left from the currently focussed tab.
80
- # Does not wrap.
80
+ # Wraps.
81
81
  def switch_down
82
+ focussed do |current_ix|
83
+ current_ix = wrap_index(current_ix - 1)
84
+ @tabs[current_ix].focus
85
+ end
86
+ end
87
+
88
+ # Moves the currently focussed tab to the right.
89
+ # Wraps.
90
+ def move_up
91
+ focussed do |current_ix|
92
+ new_ix = wrap_index(current_ix + 1)
93
+ swap_tab_with(@tabs[current_ix], new_ix)
94
+ end
95
+ end
96
+
97
+ # Moves the currently focussed tab to the left.
98
+ # Wraps.
99
+ def move_down
100
+ focussed do |current_ix|
101
+ new_ix = wrap_index(current_ix - 1)
102
+ swap_tab_with(@tabs[current_ix], new_ix)
103
+ end
104
+ end
105
+
106
+ # Yields the current index of the foccussed tab, if it exists.
107
+ def focussed(&block)
82
108
  current_ix = @tabs.index(@focussed_tab)
83
- unless current_ix == 0 or current_ix == nil
84
- @tabs[current_ix - 1].focus
109
+ unless current_ix.nil?
110
+ yield(current_ix)
111
+ end
112
+ end
113
+
114
+ # Swaps a tab with another one at a certain position.
115
+ # If no position is specified, this will default to 0.
116
+ #
117
+ # @param [Redcar::Tab] the tab to be moved
118
+ # @param [Integer] the position
119
+ def swap_tab_with(move_tab, position = 0)
120
+ swap_tab = @tabs[position]
121
+ unless move_tab == swap_tab || [move_tab, swap_tab].include?(nil)
122
+ move_tab.move_to_position(position)
123
+ end
124
+ end
125
+
126
+ # Wraps an index according to the current number of tabs.
127
+ def wrap_index(index)
128
+ until (0..@tabs.size - 1).include?(index)
129
+ index = index > 0 ? index - @tabs.size : @tabs.size + index
85
130
  end
131
+ index
86
132
  end
87
133
 
88
134
  def inspect
@@ -46,6 +46,18 @@ module Redcar
46
46
  @__items ||= self.class.items.map {|i| i.clone }
47
47
  end
48
48
 
49
+ def __get_item_by_text_or_name(name)
50
+ __items.detect {|i| (i.respond_to?(:text) and i.text == name) or i.name.to_s == name.to_s }
51
+ end
52
+
53
+ def __get_item_by_label(name)
54
+ label = __items.detect {|i| i.is_a?(LabelItem) and (i.text == name or i.name.to_s == name.to_s)}
55
+ if label
56
+ index_of_label = __items.index(label)
57
+ __items[index_of_label + 1]
58
+ end
59
+ end
60
+
49
61
  def self.label(name, text)
50
62
  append_item LabelItem.new(name, text)
51
63
  define_item_finder(name)
@@ -28,24 +28,35 @@ module Redcar
28
28
  notify_listeners(:focus)
29
29
  end
30
30
  end
31
-
31
+
32
32
  def title
33
33
  @title
34
34
  end
35
-
35
+
36
36
  def title=(title)
37
37
  @title = title
38
38
  notify_listeners(:changed_title, title)
39
39
  end
40
-
40
+
41
41
  def inspect
42
42
  "#<#{self.class.name} \"#{title}\">"
43
43
  end
44
-
44
+
45
45
  # Sets the notebook of the tab. Should not be called from user code.
46
46
  def set_notebook(notebook)
47
47
  @notebook = notebook
48
48
  end
49
+
50
+ # Moves the tab to a new position in the notebook, if said position
51
+ # is currently occupied. Defaults to the first position, if none
52
+ # is passed.
53
+ #
54
+ # Events: moved (position)
55
+ def move_to_position(position = 0)
56
+ if (0..@notebook.tabs.size - 1).include?(position)
57
+ notify_listeners(:moved, position)
58
+ end
59
+ end
49
60
 
50
61
  def edit_tab?
51
62
  is_a?(EditTab)
@@ -60,6 +71,6 @@ module Redcar
60
71
  # document, if applicable.
61
72
  def document_mirror
62
73
  document.mirror if document
63
- end
74
+ end
64
75
  end
65
76
  end
@@ -3,10 +3,11 @@ module Redcar
3
3
  include Redcar::Observable
4
4
  include Redcar::Model
5
5
 
6
- attr_reader :trees
6
+ attr_reader :trees, :focussed_tree
7
7
 
8
8
  def initialize
9
9
  @trees = []
10
+ @focussed_tree = nil
10
11
  end
11
12
 
12
13
  # Add a tree to this treebook
@@ -14,9 +15,18 @@ module Redcar
14
15
  # @param [Redcar::Tree]
15
16
  def add_tree(tree)
16
17
  @trees << tree
18
+ @focussed_tree = tree
17
19
  notify_listeners(:tree_added, tree)
18
20
  end
19
21
 
22
+ # Bring the tree to the front
23
+ #
24
+ # @param [Redcar::Tree]
25
+ def focus_tree(tree)
26
+ @focussed_tree = tree
27
+ notify_listeners(:tree_focussed, tree)
28
+ end
29
+
20
30
  # Remove a tree from this treebook
21
31
  #
22
32
  # @param [Redcar::Tree]
@@ -24,7 +34,17 @@ module Redcar
24
34
  if @trees.include?(tree)
25
35
  @trees.delete(tree)
26
36
  notify_listeners(:tree_removed, tree)
37
+ if tree == focussed_tree
38
+ focus_tree(trees.first) if trees.any?
39
+ end
27
40
  end
28
41
  end
42
+
43
+ private
44
+
45
+ # Tell the Treebook that this tree has been focussed in the GUI.
46
+ def set_focussed_tree(tree)
47
+ @focussed_tree = tree
48
+ end
29
49
  end
30
50
  end
@@ -60,8 +60,18 @@ module Redcar
60
60
 
61
61
  # Runs the given block in the SWT Event thread
62
62
  def self.sync_exec(&block)
63
- runnable = Swt::RRunnable.new(&block)
64
- Redcar::ApplicationSWT.display.syncExec(runnable)
63
+ runnable = Swt::RRunnable.new do
64
+ begin
65
+ block.call
66
+ rescue => e
67
+ puts "error in sync exec"
68
+ puts e.message
69
+ puts e.backtrace
70
+ end
71
+ end
72
+ unless Redcar::ApplicationSWT.display.is_disposed
73
+ Redcar::ApplicationSWT.display.syncExec(runnable)
74
+ end
65
75
  end
66
76
 
67
77
  # Runs the given block in the SWT Event thread after
@@ -36,6 +36,10 @@ module Redcar
36
36
  super
37
37
  end
38
38
 
39
+ def go_to_location(url)
40
+ @browser.set_url(url)
41
+ end
42
+
39
43
  class LocationListener
40
44
  def initialize(html_tab)
41
45
  @html_tab = html_tab
@@ -57,7 +57,9 @@ module Redcar
57
57
  def create_tab_folder(sash)
58
58
  folder_style = Swt::SWT::BORDER + Swt::SWT::CLOSE
59
59
  @tab_folder = Swt::Custom::CTabFolder.new(sash, folder_style)
60
- grid_data = Swt::Layout::GridData.new(Swt::Layout::GridData::FILL_BOTH)
60
+ grid_data = Swt::Layout::GridData.new
61
+ grid_data.grabExcessHorizontalSpace = true
62
+ grid_data.horizontalAlignment = Swt::Layout::GridData::FILL
61
63
  @tab_folder.set_layout_data(grid_data)
62
64
  @tab_folder.pack
63
65
  register_tab_dnd(@tab_folder)
@@ -108,12 +110,12 @@ module Redcar
108
110
 
109
111
  def model_event_tab_moved(from_notebook, to_notebook, tab_model)
110
112
  tab_controller = tab_model.controller
111
- data = tab_model.serialize
113
+ title = tab_model.title
112
114
  tab_controller.set_notebook(to_notebook.controller)
113
115
  tab_controller.create_item_widget
114
116
  tab_controller.move_tab_widget_to_current_notebook
115
117
  tab_controller.focus
116
- tab_model.deserialize(data)
118
+ tab_model.title = title
117
119
  end
118
120
 
119
121
  def recalculate_tab_order
@@ -76,6 +76,16 @@ module Redcar
76
76
  label.add_mouse_listener(MouseListener.new(self))
77
77
  end
78
78
 
79
+ def execute_listener_in_model(item, *args)
80
+ if item.listener
81
+ begin
82
+ @model.instance_exec(*args, &item.listener)
83
+ rescue => err
84
+ error_in_listener(err)
85
+ end
86
+ end
87
+ end
88
+
79
89
  def create_item_widgets
80
90
  @model.__items.each do |item|
81
91
  case item
@@ -102,13 +112,7 @@ module Redcar
102
112
  edit_view.document.add_listener(:changed) do
103
113
  ignore(item.name) do
104
114
  item.value = edit_view.document.to_s
105
- if item.listener
106
- begin
107
- @model.instance_exec(item.value, &item.listener)
108
- rescue => err
109
- error_in_listener(err)
110
- end
111
- end
115
+ execute_listener_in_model(item, item.value)
112
116
  end
113
117
  end
114
118
  item.add_listener(:changed_value) do |new_value|
@@ -121,14 +125,8 @@ module Redcar
121
125
  when Redcar::Speedbar::ButtonItem
122
126
  button = Swt::Widgets::Button.new(@composite, 0)
123
127
  button.set_text(item.text)
124
- if item.listener
125
- button.add_selection_listener do
126
- begin
127
- @model.instance_exec(&item.listener)
128
- rescue => err
129
- error_in_listener(err)
130
- end
131
- end
128
+ button.add_selection_listener do
129
+ execute_listener_in_model(item)
132
130
  end
133
131
  item.add_listener(:changed_text) do |new_text|
134
132
  button.set_text(item.text)
@@ -144,11 +142,7 @@ module Redcar
144
142
  combo.add_selection_listener do
145
143
  ignore(item.name) do
146
144
  item.value = combo.text
147
- if item.listener
148
- rescue_speedbar_errors do
149
- @model.instance_exec(item.value, &item.listener)
150
- end
151
- end
145
+ execute_listener_in_model(item, item.value)
152
146
  end
153
147
  end
154
148
  item.add_listener(:changed_items) do |new_items|
@@ -174,13 +168,7 @@ module Redcar
174
168
  button.set_selection(!!item.value)
175
169
  button.add_selection_listener do
176
170
  item.value = button.get_selection
177
- if item.listener
178
- begin
179
- @model.instance_exec(item.value, &item.listener)
180
- rescue => err
181
- error_in_listener(err)
182
- end
183
- end
171
+ execute_listener_in_model(item, item.value)
184
172
  end
185
173
  item.add_listener(:changed_text) do |new_text|
186
174
  rescue_speedbar_errors do
@@ -137,6 +137,7 @@ module JFace
137
137
  end
138
138
 
139
139
  module Viewers
140
+ import org.eclipse.jface.viewers.ColumnViewerToolTipSupport
140
141
  import org.eclipse.jface.viewers.TreeViewer
141
142
  import org.eclipse.jface.viewers.ITreeContentProvider
142
143
  import org.eclipse.jface.viewers.ILabelProvider
@@ -65,6 +65,7 @@ module Redcar
65
65
  def attach_listeners
66
66
  @model.add_listener(:focus, &method(:focus))
67
67
  @model.add_listener(:close, &method(:close))
68
+ @model.add_listener(:moved, &method(:move_tab_widget_to_position))
68
69
  end
69
70
 
70
71
  def focus
@@ -2,29 +2,57 @@ module Redcar
2
2
  class ApplicationSWT
3
3
  class Treebook
4
4
 
5
- def initialize(composite, layout, model)
6
- @composite, @layout, @model = composite, layout, model
5
+ def initialize(window, model)
6
+ @window, @model = window, model
7
7
  add_listeners
8
+ create_tree_view
8
9
  end
9
10
 
10
11
  def add_listeners
11
12
  @model.add_listener(:tree_added, &method(:tree_added))
12
13
  @model.add_listener(:tree_removed, &method(:tree_removed))
14
+ @model.add_listener(:tree_focussed, &method(:tree_focussed))
13
15
  end
14
16
 
15
17
  def tree_added(tree)
16
- create_tree_view(tree)
18
+ tree_view = TreeViewSWT.new(@tree_composite, tree)
19
+ tree.controller = tree_view
20
+ title = tree.tree_mirror.title
21
+ @tree_combo.add(title)
22
+ @tree_combo.select(@tree_combo.get_items.to_a.index(title))
23
+ @tree_layout.topControl = tree_view.control
24
+ @tree_composite.layout
17
25
  end
18
26
 
19
27
  def tree_removed(tree)
20
28
  tree.controller.close
29
+ @tree_combo.remove(tree.tree_mirror.title)
30
+ end
31
+
32
+ def tree_focussed(tree)
33
+ @tree_layout.topControl = tree.controller.control
34
+ @tree_composite.layout
35
+ @tree_combo.select(@tree_combo.get_items.to_a.index(tree.tree_mirror.title))
21
36
  end
22
37
 
23
- def create_tree_view(tree)
24
- tree_view = TreeViewSWT.new(@composite, tree)
25
- tree.controller = tree_view
26
- @layout.topControl = tree_view.control
27
- @composite.layout
38
+ def create_tree_view
39
+ @tree_composite = Swt::Widgets::Composite.new(@window.tree_sash, Swt::SWT::NONE)
40
+ @tree_layout = Swt::Custom::StackLayout.new
41
+ @tree_composite.setLayout(@tree_layout)
42
+
43
+ @tree_combo = Swt::Widgets::Combo.new(@window.left_composite, Swt::SWT::READ_ONLY)
44
+ grid_data = Swt::Layout::GridData.new
45
+ grid_data.grabExcessHorizontalSpace = true
46
+ grid_data.horizontalAlignment = Swt::Layout::GridData::FILL
47
+ grid_data.grabExcessVerticalSpace = false
48
+ @tree_combo.setLayoutData(grid_data)
49
+ @tree_combo.add_selection_listener do
50
+ selected_tree = @model.trees.detect {|t| t.tree_mirror.title == @tree_combo.text}
51
+ @model.focus_tree(selected_tree)
52
+ end
53
+
54
+ @tree_composite.layout
55
+ @window.left_composite.layout
28
56
  end
29
57
 
30
58
  end