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
@@ -103,8 +103,7 @@ module Redcar
103
103
  def create_treebook_controller
104
104
  treebook = @window.treebook
105
105
  controller = ApplicationSWT::Treebook.new(
106
- @tree_composite,
107
- @tree_layout,
106
+ self,
108
107
  treebook)
109
108
  treebook.controller = controller
110
109
  end
@@ -204,10 +203,10 @@ module Redcar
204
203
  @shell.dispose
205
204
  @menu_controller.close
206
205
  end
207
-
208
- private
209
206
 
210
- attr_reader :right_composite
207
+ attr_reader :right_composite, :left_composite, :tree_composite, :tree_layout, :tree_sash
208
+
209
+ private
211
210
 
212
211
  def create_shell
213
212
  @shell = Swt::Widgets::Shell.new(ApplicationSWT.display)
@@ -225,21 +224,17 @@ module Redcar
225
224
  def create_sashes(window_model)
226
225
  orientation = horizontal_vertical(window_model.notebook_orientation)
227
226
 
228
- @tree_composite = Swt::Widgets::Composite.new(@shell, Swt::SWT::NONE)
229
- @tree_layout = Swt::Custom::StackLayout.new
230
- @tree_composite.setLayout(@tree_layout)
231
-
227
+ @left_composite = Swt::Widgets::Composite.new(@shell, Swt::SWT::NONE)
228
+ @left_composite.layout = Swt::Layout::GridLayout.new(1, false).tap do |l|
229
+ l.verticalSpacing = 0
230
+ l.marginHeight = 0
231
+ l.horizontalSpacing = 0
232
+ l.marginWidth = 0
233
+ end
234
+
232
235
  @sash = Swt::Widgets::Sash.new(@shell, Swt::SWT::VERTICAL)
236
+
233
237
  @right_composite = Swt::Widgets::Composite.new(@shell, Swt::SWT::NONE)
234
-
235
-
236
- @tree_composite.layout_data = Swt::Layout::FormData.new.tap do |l|
237
- l.left = Swt::Layout::FormAttachment.new(0, 5)
238
- l.right = Swt::Layout::FormAttachment.new(@sash, 0)
239
- l.top = Swt::Layout::FormAttachment.new(0, 5)
240
- l.bottom = Swt::Layout::FormAttachment.new(100, -5)
241
- end
242
-
243
238
  @right_composite.layout = Swt::Layout::GridLayout.new(1, false).tap do |l|
244
239
  l.verticalSpacing = 0
245
240
  l.marginHeight = 0
@@ -268,6 +263,13 @@ module Redcar
268
263
  end
269
264
  end
270
265
 
266
+ @left_composite.layout_data = Swt::Layout::FormData.new.tap do |l|
267
+ l.left = Swt::Layout::FormAttachment.new(0, 5)
268
+ l.right = Swt::Layout::FormAttachment.new(@sash, 0)
269
+ l.top = Swt::Layout::FormAttachment.new(0, 5)
270
+ l.bottom = Swt::Layout::FormAttachment.new(100, -5)
271
+ end
272
+
271
273
  @right_composite.layout_data = Swt::Layout::FormData.new.tap do |d|
272
274
  d.left = Swt::Layout::FormAttachment.new(@sash, 0)
273
275
  d.right = Swt::Layout::FormAttachment.new(100, -5)
@@ -275,6 +277,10 @@ module Redcar
275
277
  d.bottom = Swt::Layout::FormAttachment.new(100, -5)
276
278
  end
277
279
 
280
+ @tree_sash = Swt::Custom::SashForm.new(@left_composite, orientation)
281
+ grid_data = Swt::Layout::GridData.new(Swt::Layout::GridData::FILL_BOTH)
282
+ @tree_sash.layout_data = grid_data
283
+
278
284
  @notebook_sash = Swt::Custom::SashForm.new(@right_composite, orientation)
279
285
  grid_data = Swt::Layout::GridData.new(Swt::Layout::GridData::FILL_BOTH)
280
286
  @notebook_sash.layout_data = grid_data
@@ -5,7 +5,7 @@ require 'auto_completer/word_iterator'
5
5
  require 'auto_completer/word_list'
6
6
 
7
7
  module Redcar
8
- class AutoCompleter
8
+ class AutoCompleter
9
9
  WORD_CHARACTERS = /\w|_/ # /(\s|\t|\.|\r|\(|\)|,|;)/
10
10
 
11
11
  def self.document_controller_types
@@ -82,31 +82,16 @@ module Redcar
82
82
  word_list
83
83
  end
84
84
 
85
- # returns the prefix that is being touched by the cursor and an array
86
- # containing [left, right] document offsets of the prefix.
85
+ # returns the prefix that is being touched by the cursor and a range
86
+ # containing offsets of the prefix.
87
87
  def touched_prefix
88
88
  line = doc.get_line(doc.cursor_line)
89
- left, right = word_range(line)
89
+ cur_offset = doc.cursor_offset
90
+ left, right = doc.word_range_at_offset(cur_offset).first, cur_offset
90
91
  prefix = doc.get_range(left, right - left)
91
92
  return nil if prefix.length == 0
92
93
  return prefix, left, right
93
94
  end
94
-
95
- # returns the range that holds the current word (depending on WORD_CHARACTERS)
96
- def word_range(line)
97
- left = doc.cursor_line_offset - 1
98
- right = doc.cursor_line_offset
99
- left_range = 0
100
- right_range = 0
101
- offset = doc.cursor_offset
102
-
103
- until left == -1 || WORD_CHARACTERS !~ (line[left].chr)
104
- left -= 1
105
- left_range -= 1
106
- end
107
-
108
- return [offset+left_range, offset+right_range]
109
- end
110
95
  end
111
96
 
112
97
  class MenuAutoCompleterCommand < AutoCompleteCommand
@@ -1,5 +1,4 @@
1
1
 
2
- require 'java'
3
2
  require 'fileutils'
4
3
 
5
4
  require "core/logger"
@@ -15,9 +14,13 @@ require "core/persistent_cache"
15
14
  require "core/plugin"
16
15
  require "core/plugin/storage"
17
16
 
18
- require "core/task"
19
- require "core/task_queue"
20
- require "core/resource"
17
+ begin
18
+ require 'java'
19
+ require "core/task"
20
+ require "core/task_queue"
21
+ require "core/resource"
22
+ rescue LoadError => e
23
+ end
21
24
 
22
25
  module Redcar
23
26
  def self.tmp_dir
@@ -21,10 +21,10 @@ class ObservableStruct
21
21
  end
22
22
  accessors.each do |accessor|
23
23
  klass.class_eval %Q{
24
- alias_method :real_#{accessor}=, :#{accessor}=
24
+ alias_method :set_#{accessor}, :#{accessor}=
25
25
  def #{accessor}=(val)
26
26
  notify_listeners(:changed_#{accessor}, val) do
27
- self.real_#{accessor} = val
27
+ self.set_#{accessor}(val)
28
28
  end
29
29
  end
30
30
  }
@@ -83,7 +83,7 @@ module Redcar
83
83
  path = match[:file]
84
84
  Project::Manager.open_file(path)
85
85
  regexp = Regexp.new(Regexp.escape(match[:match]))
86
- Redcar::Top::FindNextRegex.new(regexp, true).run
86
+ DocumentSearch::FindNextRegex.new(regexp, true).run
87
87
  end
88
88
 
89
89
  class GoToTagCommand < EditTabCommand
@@ -92,22 +92,8 @@ module Redcar
92
92
  if doc.selection?
93
93
  handle_tag(doc.selected_text)
94
94
  else
95
- line = doc.get_line(doc.cursor_line)
96
- left = doc.cursor_line_offset - 1
97
- right = doc.cursor_line_offset
98
- left_range = 0
99
- right_range = 0
100
- offset = doc.cursor_offset
101
-
102
- until left == -1 || AutoCompleter::WORD_CHARACTERS !~ (line[left].chr)
103
- left -= 1
104
- left_range -= 1
105
- end
106
- until right == line.length || AutoCompleter::WORD_CHARACTERS !~ (line[right].chr)
107
- right += 1
108
- right_range += 1
109
- end
110
- handle_tag(doc.get_slice(doc.cursor_offset+left_range, doc.cursor_offset+right_range))
95
+ range = doc.current_word_range
96
+ handle_tag(doc.get_slice(range.first, range.last))
111
97
  end
112
98
  end
113
99
 
@@ -0,0 +1,163 @@
1
+
2
+ @speedbar
3
+ Feature: Search in file
4
+
5
+ Background:
6
+ Given I open a new edit tab
7
+
8
+ Scenario: Open search speedbar
9
+ When I replace the contents with "Foo\nBar\nBaz"
10
+ And I move the cursor to 0
11
+ And I run the command DocumentSearch::SearchForwardCommand
12
+ Then the DocumentSearch::SearchSpeedbar speedbar should be open
13
+
14
+ Scenario: Search for a word should select next occurrence
15
+ When I replace the contents with "Foo\nBar\nBaz"
16
+ And I move the cursor to 0
17
+ And I run the command DocumentSearch::SearchForwardCommand
18
+ And I type "Bar" into the "Search" field in the speedbar
19
+ And I press "Search" in the speedbar
20
+ Then the selected text should be "Bar"
21
+
22
+ Scenario: Search twice should move to the next occurrence
23
+ When I replace the contents with "Foo\nBar\nFoo"
24
+ And I move the cursor to 0
25
+ And I run the command DocumentSearch::SearchForwardCommand
26
+ And I type "Foo" into the "Search" field in the speedbar
27
+ And I press "Search" in the speedbar
28
+ And I press "Search" in the speedbar
29
+ Then the selected text should be "Foo"
30
+ And the selection should be on line 2
31
+
32
+ Scenario: Search for a word adjacent to cursor should select word
33
+ When I replace the contents with "Foo\nBar\nBaz"
34
+ And I move the cursor to 0
35
+ And I run the command DocumentSearch::SearchForwardCommand
36
+ And I type "Foo" into the "Search" field in the speedbar
37
+ And I press "Search" in the speedbar
38
+ Then the selected text should be "Foo"
39
+
40
+ Scenario: Search for a word should find occurrence after the cursor
41
+ When I replace the contents with "Foo\nBar\nBaz\nFoo"
42
+ And I move the cursor to 1
43
+ And I run the command DocumentSearch::SearchForwardCommand
44
+ And I type "Foo" into the "Search" field in the speedbar
45
+ And I press "Search" in the speedbar
46
+ Then the selected text should be "Foo"
47
+ And the selection should be on line 3
48
+
49
+ Scenario: Search for a word should wrap to earlier occurrence if none left
50
+ When I replace the contents with "Foo\nBar\nBaz"
51
+ And I move the cursor to 1
52
+ And I run the command DocumentSearch::SearchForwardCommand
53
+ And I type "Foo" into the "Search" field in the speedbar
54
+ And I press "Search" in the speedbar
55
+ Then the selected text should be "Foo"
56
+ And the selection should be on line 0
57
+
58
+ Scenario: Doesn't search for a regex by default
59
+ When I replace the contents with "Foo\nBar\nBaz"
60
+ And I move the cursor to 0
61
+ And I run the command DocumentSearch::SearchForwardCommand
62
+ And I type "Ba." into the "Search" field in the speedbar
63
+ And I press "Search" in the speedbar
64
+ Then there should not be any text selected
65
+
66
+ Scenario: Search for a regex
67
+ When I replace the contents with "Foo\nBar\nBaz"
68
+ And I move the cursor to 0
69
+ And I run the command DocumentSearch::SearchForwardCommand
70
+ And I type "Ba." into the "Search" field in the speedbar
71
+ And I check "Regex" in the speedbar
72
+ And I press "Search" in the speedbar
73
+ Then the selected text should be "Bar"
74
+
75
+ Scenario: Search for a regex matches a second time
76
+ When I replace the contents with "Foo\nBar\nBaz"
77
+ And I move the cursor to 0
78
+ And I run the command DocumentSearch::SearchForwardCommand
79
+ And I type "Ba." into the "Search" field in the speedbar
80
+ And I check "Regex" in the speedbar
81
+ And I press "Search" in the speedbar
82
+ And I press "Search" in the speedbar
83
+ Then the selected text should be "Baz"
84
+
85
+ Scenario: Should not match case by default
86
+ When I replace the contents with "Foo\nBar\nBaz"
87
+ And I move the cursor to 0
88
+ And I run the command DocumentSearch::SearchForwardCommand
89
+ And I type "foo" into the "Search" field in the speedbar
90
+ And I press "Search" in the speedbar
91
+ Then the selected text should be "Foo"
92
+
93
+ Scenario: Should match case if requested
94
+ When I replace the contents with "Foo\nBar\nBaz"
95
+ And I move the cursor to 0
96
+ And I run the command DocumentSearch::SearchForwardCommand
97
+ And I type "foo" into the "Search" field in the speedbar
98
+ And I check "Match case" in the speedbar
99
+ And I press "Search" in the speedbar
100
+ Then there should not be any text selected
101
+
102
+ Scenario: Should scroll to the match
103
+ When I replace the contents with 100 lines of "xxx" then "Foo"
104
+ And I scroll to the top of the document
105
+ And I move the cursor to 0
106
+ And I run the command DocumentSearch::SearchForwardCommand
107
+ And I type "Foo" into the "Search" field in the speedbar
108
+ And I press "Search" in the speedbar
109
+ Then the selected text should be "Foo"
110
+ And line number 100 should be visible
111
+
112
+ Scenario: Should reopen with the same text as the previous search
113
+ And I run the command DocumentSearch::SearchForwardCommand
114
+ And I type "foo" into the "Search" field in the speedbar
115
+ And I press "Search" in the speedbar
116
+ And I close the speedbar
117
+ And I run the command DocumentSearch::SearchForwardCommand
118
+ Then the "Search" field in the speedbar should have text "foo"
119
+
120
+ Scenario: Should reopen with the same value of Regex as the previous search
121
+ And I run the command DocumentSearch::SearchForwardCommand
122
+ And I check "Regex" in the speedbar
123
+ And I press "Search" in the speedbar
124
+ And I close the speedbar
125
+ And I run the command DocumentSearch::SearchForwardCommand
126
+ Then "Regex" should be checked in the speedbar
127
+
128
+ Scenario: Should reopen with the same value of Regex as the previous search 2
129
+ And I run the command DocumentSearch::SearchForwardCommand
130
+ And I check "Regex" in the speedbar
131
+ And I press "Search" in the speedbar
132
+ And I close the speedbar
133
+ And I run the command DocumentSearch::SearchForwardCommand
134
+ And I uncheck "Regex" in the speedbar
135
+ And I press "Search" in the speedbar
136
+ And I close the speedbar
137
+ And I run the command DocumentSearch::SearchForwardCommand
138
+ Then "Regex" should not be checked in the speedbar
139
+
140
+ Scenario: Should reopen with the same value of Match case as the previous search
141
+ And I run the command DocumentSearch::SearchForwardCommand
142
+ And I check "Match case" in the speedbar
143
+ And I press "Search" in the speedbar
144
+ And I close the speedbar
145
+ And I run the command DocumentSearch::SearchForwardCommand
146
+ Then "Match case" should be checked in the speedbar
147
+
148
+ Scenario: Should initialize query with the currently selected text
149
+ When I replace the contents with "Foo\nBar\nFoo"
150
+ And I move the cursor to 0
151
+ And I select from 0 to 3
152
+ And I run the command DocumentSearch::SearchForwardCommand
153
+ Then the "Search" field in the speedbar should have text "Foo"
154
+
155
+ Scenario: Should match the next occurence of the currently selected text
156
+ When I replace the contents with "Foo\nBar\nFoo"
157
+ And I move the cursor to 0
158
+ And I select from 0 to 3
159
+ And I run the command DocumentSearch::SearchForwardCommand
160
+ And I press "Search" in the speedbar
161
+ Then the selected text should be "Foo"
162
+ And line number 2 should be visible
163
+
@@ -0,0 +1,4 @@
1
+
2
+ RequireSupportFiles File.dirname(__FILE__) + "/../../../edit_view/features/"
3
+
4
+
@@ -0,0 +1,121 @@
1
+
2
+ module DocumentSearch
3
+
4
+ class SearchSpeedbar < Redcar::Speedbar
5
+ class << self
6
+ attr_accessor :previous_query
7
+ attr_accessor :previous_is_regex
8
+ attr_accessor :previous_match_case
9
+ attr_accessor :initial_query
10
+ end
11
+
12
+ def initial_query=(text)
13
+ SearchSpeedbar.previous_query = text
14
+ end
15
+
16
+ def after_draw
17
+ self.query.value = SearchSpeedbar.previous_query || ""
18
+ self.is_regex.value = SearchSpeedbar.previous_is_regex
19
+ self.match_case.value = SearchSpeedbar.previous_match_case
20
+ self.query.edit_view.document.select_all
21
+ initial_query = nil
22
+ end
23
+
24
+ label :label, "Search:"
25
+ textbox :query
26
+
27
+ toggle :is_regex, 'Regex', nil, false do |v|
28
+ # v is true or false
29
+ SearchSpeedbar.previous_is_regex = v
30
+ end
31
+
32
+ toggle :match_case, 'Match case', nil, false do |v|
33
+ SearchSpeedbar.previous_match_case = v
34
+ end
35
+
36
+ button :search, "Search", "Return" do
37
+ SearchSpeedbar.previous_query = query.value
38
+ SearchSpeedbar.previous_match_case = match_case.value
39
+ SearchSpeedbar.previous_is_regex = is_regex.value
40
+ success = SearchSpeedbar.repeat_query
41
+ end
42
+
43
+ def self.repeat_query
44
+ current_query = @previous_query
45
+ if !@previous_is_regex
46
+ current_query = Regexp.escape(current_query)
47
+ end
48
+ FindNextRegex.new(Regexp.new(current_query, !@previous_match_case), true).run
49
+ end
50
+ end
51
+
52
+ class SearchForwardCommand < Redcar::EditTabCommand
53
+
54
+ def execute
55
+ @speedbar = SearchSpeedbar.new
56
+ if doc.selection?
57
+ @speedbar.initial_query = doc.selected_text
58
+ end
59
+ win.open_speedbar(@speedbar)
60
+ end
61
+ end
62
+
63
+ class RepeatPreviousSearchForwardCommand < Redcar::EditTabCommand
64
+ def execute
65
+ SearchSpeedbar.repeat_query
66
+ end
67
+ end
68
+
69
+ class FindNextRegex < Redcar::EditTabCommand
70
+ def initialize(re, wrap=nil)
71
+ @re = re
72
+ @wrap = wrap
73
+ end
74
+
75
+ def to_s
76
+ "<#{self.class}: @re:#{@re.inspect} wrap:#{!!@wrap}>"
77
+ end
78
+
79
+ def execute
80
+ # first search the remainder of the current line
81
+ curr_line = doc.get_line(doc.cursor_line)
82
+ cursor_line_offset = doc.cursor_offset - doc.offset_at_line(doc.cursor_line)
83
+ curr_line = curr_line[cursor_line_offset..-1]
84
+ if curr_line =~ @re
85
+ line_start = doc.offset_at_line(doc.cursor_line)
86
+ startoff = line_start + $`.length + cursor_line_offset
87
+ endoff = startoff + $&.length
88
+ doc.set_selection_range(endoff, startoff)
89
+ elsif doc.cursor_line < doc.line_count - 1
90
+ # next search the rest of the lines
91
+ found_line_offset = nil
92
+ found_line_num = nil
93
+ found_length = nil
94
+ line_nums = ((doc.cursor_line() + 1)..(doc.line_count() - 1)).to_a # the rest of the document
95
+ if @wrap
96
+ line_nums += (0..doc.cursor_line()).to_a
97
+ end
98
+ for line_num in line_nums do
99
+ curr_line = doc.get_line(line_num)
100
+ if new_offset = (curr_line.to_s =~ @re)
101
+ found_line_offset = new_offset
102
+ found_line_num = line_num
103
+ found_length = $&.length
104
+ break
105
+ end
106
+ end
107
+ if found_line_num
108
+ line_start = doc.offset_at_line(found_line_num)
109
+ startoff = line_start + found_line_offset
110
+ endoff = startoff + found_length
111
+ doc.scroll_to_line(found_line_num)
112
+ doc.set_selection_range(endoff, startoff)
113
+ true
114
+ else
115
+ false
116
+ end
117
+ end
118
+ end
119
+ end
120
+
121
+ end