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
@@ -0,0 +1,5 @@
1
+ class TrailingSpace
2
+
3
+ def trailing_space
4
+ end
5
+ end
@@ -1,23 +1,22 @@
1
1
  module Redcar
2
2
  class OutlineViewSWT < Redcar::ApplicationSWT::FilterListDialogController
3
3
  include Redcar::Controller
4
-
5
- ICON_PATH = File.expand_path(File.dirname(__FILE__) + "/icons")
6
-
4
+
7
5
  ICONS = {
8
- :method => File.join(ICON_PATH, "method.png"),
9
- :class => File.join(ICON_PATH, "class.png"),
10
- :attribute => File.join(ICON_PATH, "attribute.png"),
11
- :alias => File.join(ICON_PATH, "alias.png"),
12
- :assignment => File.join(ICON_PATH, "assignment.png"),
13
- :interface => File.join(ICON_PATH, "interface.png"),
6
+ :method => ApplicationSWT::Icon.swt_image(:node_insert),
7
+ :class => ApplicationSWT::Icon.swt_image(:open_source_flipped),
8
+ :attribute => ApplicationSWT::Icon.swt_image(:status),
9
+ :alias => ApplicationSWT::Icon.swt_image(:arrow_branch),
10
+ :assignment => ApplicationSWT::Icon.swt_image(:arrow),
11
+ :interface => ApplicationSWT::Icon.swt_image(:information),
12
+ :closure => ApplicationSWT::Icon.swt_image(:node_magnifier),
14
13
  :none => nil
15
14
  }
16
-
15
+
17
16
  class OutlineViewDialogSWT < Redcar::ApplicationSWT::FilterListDialogController::FilterListDialog
18
17
  attr_reader :list, :text
19
18
  attr_accessor :controller
20
-
19
+
21
20
  def createDialogArea(parent)
22
21
  composite = Swt::Widgets::Composite.new(parent, Swt::SWT::NONE)
23
22
  layout = Swt::Layout::RowLayout.new(Swt::SWT::VERTICAL)
@@ -34,7 +33,7 @@ module Redcar
34
33
  @list.set_selection(0)
35
34
  end
36
35
  end
37
-
36
+
38
37
  def initialize(model)
39
38
  @model = model
40
39
  @dialog = OutlineViewDialogSWT.new(Redcar.app.focussed_window.controller.shell)
@@ -46,7 +45,7 @@ module Redcar
46
45
  attach_model_listeners
47
46
  @associations = {}
48
47
  end
49
-
48
+
50
49
  def update_list_sync
51
50
  if @dialog
52
51
  s = Time.now
@@ -56,13 +55,13 @@ module Redcar
56
55
  text_focus
57
56
  end
58
57
  end
59
-
58
+
60
59
  def selected
61
60
  @model.selected(@associations[@dialog.list.get_selection.first])
62
61
  end
63
-
62
+
64
63
  private
65
-
64
+
66
65
  def populate_table(hash = {})
67
66
  @dialog.list.removeAll; @associations.clear
68
67
  hash.each do |match, props|
@@ -70,9 +69,8 @@ module Redcar
70
69
  item = Swt::Widgets::TableItem.new(@dialog.list, Swt::SWT::NONE)
71
70
  @associations[item] = match
72
71
  item.text = props[:name]
73
- icon = ICONS[props[:kind].to_sym] if props[:kind]
74
- if icon
75
- image = Swt::Graphics::Image.new(ApplicationSWT.display, icon)
72
+ image = ICONS[props[:kind].to_sym] if props[:kind]
73
+ if image
76
74
  item.image = image
77
75
  end
78
76
  end
@@ -75,14 +75,11 @@ module Redcar
75
75
  end
76
76
 
77
77
  def find_pair(step, offset, search_char, current_char)
78
- if offset == 0
79
- return nil
80
- end
81
78
  state = 1;
82
79
  quotes = false
83
80
  doublequotes = false
84
81
 
85
- while offset > 0 and offset < document.length - 1
82
+ while offset >= 0 and offset < document.length
86
83
  offset = offset + step;
87
84
  @newchar = styledText.getTextRange(offset, 1)
88
85
  if @newchar == search_char and !quotes and !doublequotes
@@ -12,7 +12,8 @@ module Redcar
12
12
  sub_menu "Plugins", :priority => 40 do
13
13
  group(:priority => :first) {
14
14
  item "Plugin Manager", PluginManagerUi::OpenCommand
15
- item "Reload Plugins", PluginManagerUi::ReloadLastReloadedCommand
15
+ item "Reload Plugins", PluginManagerUi::ReloadPluginsCommand
16
+ item "Reload Last Reloaded", PluginManagerUi::ReloadLastReloadedCommand
16
17
  separator
17
18
  }
18
19
  end
@@ -42,7 +43,14 @@ module Redcar
42
43
  end
43
44
  end
44
45
  end
45
-
46
+
47
+ class ReloadPluginsCommand < Redcar::Command
48
+ def execute
49
+ Redcar.add_plugin_sources(Redcar.plugin_manager)
50
+ Redcar.plugin_manager.load_maximal
51
+ end
52
+ end
53
+
46
54
  class OpenCommand < Redcar::Command
47
55
  class Controller
48
56
  include Redcar::HtmlController
@@ -58,6 +66,7 @@ module Redcar
58
66
 
59
67
  def reload_plugin(name)
60
68
  plugin = Redcar.plugin_manager.loaded_plugins.detect {|pl| pl.name == name }
69
+ plugin ||= Redcar.plugin_manager.unloaded_plugins.detect {|pl| pl.name == name }
61
70
  plugin.load
62
71
  Redcar.app.refresh_menu!
63
72
  PluginManagerUi.last_reloaded = plugin
@@ -96,7 +105,7 @@ module Redcar
96
105
 
97
106
  def execute
98
107
  controller = Controller.new
99
- tab = win.new_tab(HtmlTab)
108
+ tab = win.new_tab(ConfigTab)
100
109
  tab.html_view.controller = controller
101
110
  tab.focus
102
111
  end
@@ -0,0 +1,27 @@
1
+ Feature: Close directory tree
2
+
3
+ Scenario: Close and re-open directory stays in the same window
4
+ Given I will choose "." from the "open_directory" dialog
5
+ When I open a directory
6
+ Then there should be 1 windows
7
+ When I close the directory
8
+ When I open a directory
9
+ Then there should be 1 windows
10
+
11
+ Scenario: Close directory via close icon
12
+ Given I will choose "." from the "open_directory" dialog
13
+ When I open a directory
14
+ And I click the close button
15
+ Then the tree width should be the minimum size
16
+ And the window should have title "Redcar"
17
+ When I open a directory
18
+ Then there should be 1 windows
19
+
20
+ Scenario: Close directory via "Close Tree" menu item
21
+ Given I will choose "." from the "open_directory" dialog
22
+ When I open a directory
23
+ And I close the tree
24
+ Then the tree width should be the minimum size
25
+ And the window should have title "Redcar"
26
+ When I open a directory
27
+ Then there should be 1 windows
@@ -5,4 +5,48 @@ Feature: Highlight the File of the focussed tab in tree
5
5
  And I open a directory
6
6
  And I have opened "plugins/project/features/highlight_focussed_tab.feature"
7
7
  Then there should be one edit tab
8
- And "highlight_focussed_tab.feature" should be selected in the project tree
8
+ Then "highlight_focussed_tab.feature" should be selected in the project tree
9
+
10
+ Scenario: Switching between tabs should highlight them in the tree
11
+ Given I will choose "." from the "open_directory" dialog
12
+ And I open a directory
13
+ And I have opened "plugins/project/features/highlight_focussed_tab.feature"
14
+ Then "highlight_focussed_tab.feature" should be selected in the project tree
15
+ And I have opened "plugins/project/features/find_file.feature"
16
+ And I have opened "plugins/project/features/move_and_rename_files.feature"
17
+ Then there should be 3 edit tabs
18
+ And "move_and_rename_files.feature" should be selected in the project tree
19
+ And I switch up a tab
20
+ Then "find_file.feature" should be selected in the project tree
21
+ And I switch up a tab
22
+ Then "highlight_focussed_tab.feature" should be selected in the project tree
23
+
24
+ Scenario: Project revelation should work across several notebooks
25
+ Given I will choose "." from the "open_directory" dialog
26
+ And I open a directory
27
+ And I have opened "plugins/project/features/highlight_focussed_tab.feature"
28
+ And I have opened "plugins/project/features/find_file.feature"
29
+ And I have opened "plugins/project/features/move_and_rename_files.feature"
30
+ And I have opened "plugins/project/features/sub_project.feature"
31
+ And I make a new notebook
32
+ And I move the tab to the other notebook
33
+ And I move the tab to the other notebook
34
+ And I switch notebooks
35
+ Then "sub_project.feature" should be selected in the project tree
36
+ And I switch up a tab
37
+ Then "move_and_rename_files.feature" should be selected in the project tree
38
+ And I switch notebooks
39
+ Then "find_file.feature" should be selected in the project tree
40
+
41
+ Scenario: Project revelation doesn't get triggered on REPLs
42
+ Given I will choose "." from the "open_directory" dialog
43
+ And I open a directory
44
+ And I have opened "plugins/project/features/highlight_focussed_tab.feature"
45
+ Then there should be one edit tab
46
+ Then "highlight_focussed_tab.feature" should be selected in the project tree
47
+ And I open a "ruby" repl
48
+ Then "highlight_focussed_tab.feature" should be selected in the project tree
49
+ And I open a "clojure" repl
50
+ Then "highlight_focussed_tab.feature" should be selected in the project tree
51
+ And I open a "groovy" repl
52
+ Then "highlight_focussed_tab.feature" should be selected in the project tree
@@ -6,6 +6,18 @@ Feature: Open and save files
6
6
  Then there should be one edit tab
7
7
  And I should see "Wintersmith" in the edit tab
8
8
 
9
+ Scenario: Open a file using another Redcar invocation
10
+ Given I open "plugins/project/spec/fixtures/winter.txt" using the redcar command
11
+ Then there should be one edit tab
12
+ And my active tab should be "winter.txt"
13
+ And I should see "Wintersmith" in the edit tab
14
+
15
+ Scenario: Open a new file using a Pipe
16
+ Given I pipe "hi" into redcar
17
+ Then there should be one edit tab
18
+ And my active tab should be "untitled"
19
+ And I should see "hi" in the edit tab
20
+
9
21
  Scenario: Opening an already open file focusses the edit tab
10
22
  Given I will choose "plugins/project/spec/fixtures/winter.txt" from the "open_file" dialog
11
23
  When I open a file
@@ -29,6 +41,27 @@ Feature: Open and save files
29
41
  Then the file "plugins/project/spec/fixtures/winter2.txt" should contain "Wintersmith"
30
42
  And I should see "Wintersmith" in the edit tab
31
43
 
44
+ Scenario: Open a file using another Redcar invocation and waiting for the tab to be closed
45
+ Given I open "plugins/project/spec/fixtures/winter.txt" using the redcar command with "-w"
46
+ And I wait "2" seconds
47
+ Then there should be one edit tab
48
+ And my active tab should be "winter.txt"
49
+ And I should see "Wintersmith" in the edit tab
50
+ And the redcar command should not have returned
51
+ Given I close the focussed tab
52
+ Then the redcar command should have returned
53
+
54
+ Scenario: Open a new file using a Pipe and waiting for the tab to be closed
55
+ Given I pipe "hi" into redcar with "-w"
56
+ And I wait "2" seconds
57
+ Then there should be one edit tab
58
+ And my active tab should be "untitled"
59
+ And I should see "hi" in the edit tab
60
+ And the redcar command should not have returned
61
+ Given I will choose "no" from the "message_box" dialog
62
+ And I close the focussed tab
63
+ Then the redcar command should have returned
64
+
32
65
  Scenario: Open file in nearest ancestor project window
33
66
  Given I will choose "plugins/project/spec" from the "open_directory" dialog
34
67
  When I open a directory
@@ -5,6 +5,10 @@ Feature: Open directory tree
5
5
  When I open a directory
6
6
  Then I should see "bin,lib,plugins" in the tree
7
7
 
8
+ Scenario: Open a directory using another Redcar invocation
9
+ Given I open "plugins/project/spec/fixtures/myproject" using the redcar command
10
+ Then the window should have title "myproject"
11
+
8
12
  Scenario: Open directory then another directory
9
13
  Given I will choose "." from the "open_directory" dialog
10
14
  When I open a directory
@@ -12,6 +16,13 @@ Feature: Open directory tree
12
16
  When I open a directory
13
17
  Then I should see "core,application,tree" in the tree
14
18
 
19
+ Scenario: Open a directory and then the same using another Redcar invocation
20
+ Given I will choose "plugins/project/spec/fixtures/myproject" from the "open_directory" dialog
21
+ When I open a directory
22
+ And I open "plugins/project/spec/fixtures/myproject" using the redcar command
23
+ Then there should be 1 windows
24
+ And the window should have title "myproject"
25
+
15
26
  Scenario: Title of window reflects open project
16
27
  Given I will choose "plugins/project/spec/fixtures/myproject" from the "open_directory" dialog
17
28
  When I open a directory
@@ -33,29 +44,44 @@ Feature: Open directory tree
33
44
  When I restore the window size
34
45
  Then the tree width should be the default
35
46
 
36
- Scenario: Toggle Tree Visibility hides the treebook if the sash is visible, else it opens it
47
+ Scenario: Toggle Tree Visibility hides the treebook if the tab title is visible, else it opens it
37
48
  Given I will choose "plugins/project/spec/fixtures/myproject" from the "open_directory" dialog
38
49
  When I open a directory
39
- Then the tree width should be the default
40
- When I toggle tree visibility
41
- Then the tree width should be 0
42
- When I manually widen the treebook to show the sash
50
+ And I set the treebook width to the default
43
51
  And I toggle tree visibility
44
- Then the tree width should be 0
45
- When I manually widen the treebook only a few pixels
52
+ Then the tree width should be the minimum size
53
+ When I set the treebook width to only a few pixels
46
54
  And I toggle tree visibility
47
55
  Then the tree width should be the default
48
56
 
49
57
  Scenario: Treebook becomes visible if hidden and another tree is opened
50
58
  Given I will choose "plugins/project/spec/fixtures/myproject" from the "open_directory" dialog
51
59
  When I open a directory
52
- Then the tree width should be the default
53
- When I toggle tree visibility
54
- Then the tree width should be 0
60
+ And I set the treebook width to the default
61
+ And I toggle tree visibility
62
+ Then the tree width should be the minimum size
55
63
  When I open the runnables tree
56
64
  Then the tree width should be the default
57
65
  And I toggle tree visibility
58
- Then the tree width should be 0
66
+ Then the tree width should be the minimum size
67
+
68
+ Scenario: Treebooks should keep open to their previous open width
69
+ Given I will choose "plugins/project/spec/fixtures/myproject" from the "open_directory" dialog
70
+ When I open a directory
71
+ When I set the treebook width to the default
72
+ And I set the treebook width to 50 pixels
73
+ And I toggle tree visibility
74
+ Then the tree width should be the minimum size
75
+ When I toggle tree visibility
76
+ Then the tree width should be 50 pixels
77
+ When I set the treebook width to 250 pixels
78
+ And I toggle tree visibility
79
+ And I toggle tree visibility
80
+ Then the tree width should be 250 pixels
81
+ When I toggle tree visibility
82
+ And I set the treebook width to 35 pixels
83
+ And I toggle tree visibility
84
+ Then the tree width should be the minimum size
59
85
 
60
86
  # RSpec matchers have trouble with the multibyte string
61
87
  # Scenario: Multibyte files and directories
@@ -4,7 +4,7 @@ When /I open a directory/ do
4
4
  end
5
5
 
6
6
  When /I close the directory/ do
7
- Redcar::Project::DirectoryCloseCommand.new.run
7
+ Redcar::Project::Manager.focussed_project.close
8
8
  end
9
9
 
10
10
  When /^I refresh the directory tree$/ do
@@ -0,0 +1,40 @@
1
+ require 'timeout'
2
+ require 'drb'
3
+
4
+ def drb
5
+ DRbObject.new(nil, "druby://127.0.0.1:#{Redcar::DRB_PORT}")
6
+ end
7
+
8
+ def tempfile(text)
9
+ f = Tempfile.open("drb_testing")
10
+ f << text
11
+ f.close
12
+ f.path
13
+ end
14
+
15
+ Given /^I open "([^"]*)" using the redcar command$/ do |path|
16
+ drb_answer = drb.open_item_drb(File.expand_path(path))
17
+ drb_answer.should == "ok"
18
+ end
19
+
20
+ Given /^I open "([^"]*)" using the redcar command with "-w"$/ do |path|
21
+ DrbShelloutHelper.drb_system_thread = Thread.new(path) do
22
+ drb_answer = drb.open_item_drb(File.expand_path(path), false, true)
23
+ end
24
+ end
25
+
26
+ Given /^I pipe "([^"]*)" into redcar with "-w"$/ do |text|
27
+ DrbShelloutHelper.drb_system_thread = Thread.new(text) do
28
+ drb_answer = drb.open_item_drb(tempfile(text), true, true)
29
+ end
30
+ end
31
+
32
+ Given /^I pipe "([^"]*)" into redcar$/ do |text|
33
+ drb_answer = drb.open_item_drb(tempfile(text), true)
34
+ drb_answer.should == "ok"
35
+ end
36
+
37
+ Then /^the redcar command should (not )?have returned$/ do |returned|
38
+ (!!DrbShelloutHelper.drb_system_thread.status).should be !!returned # status is false for returned thread
39
+ end
40
+
@@ -1,4 +1,20 @@
1
1
 
2
+ module DrbShelloutHelper
3
+ def self.drb_system_thread
4
+ $drb_system_thread
5
+ end
6
+
7
+ def self.drb_system_thread= value
8
+ $drb_system_thread = value
9
+ end
10
+
11
+ def self.kill_thread
12
+ if !($drb_system_thread.nil?) and $drb_system_thread.status
13
+ $drb_system_thread.kill
14
+ end
15
+ end
16
+ end
17
+
2
18
  def fixtures_path
3
19
  File.expand_path(File.dirname(__FILE__) + "/../../spec/fixtures")
4
20
  end
@@ -36,4 +52,5 @@ end
36
52
  After do
37
53
  reset_project_fixtures
38
54
  delete_subproject_fixtures
55
+ DrbShelloutHelper.kill_thread
39
56
  end
@@ -22,6 +22,7 @@ require "project/support/trash"
22
22
  require "project/commands"
23
23
  require "project/dir_mirror"
24
24
  require "project/dir_controller"
25
+ require "project/project_tree_controller"
25
26
  require "project/drb_service"
26
27
  require "project/file_list"
27
28
  require "project/file_mirror"
@@ -96,9 +97,14 @@ module Redcar
96
97
  end
97
98
 
98
99
  def attach_listeners
100
+ attach_notebook_listeners
101
+ window.treebook.add_listener(:tree_removed, &method(:tree_removed))
102
+ end
103
+
104
+ def attach_notebook_listeners
99
105
  window.add_listener(:notebook_focussed, &method(:notebook_focussed))
100
- window.add_listener(:notebook_closed, &method(:notebook_closed))
101
- window.add_listener(:notebook_added, &method(:notebook_added))
106
+ window.add_listener(:notebook_removed, &method(:notebook_closed))
107
+ window.add_listener(:new_notebook, &method(:notebook_added))
102
108
  if notebooks = window.notebooks
103
109
  notebooks.each do |nb|
104
110
  notebook_added(nb)
@@ -120,6 +126,10 @@ module Redcar
120
126
  @listeners.delete(notebook)
121
127
  end
122
128
 
129
+ def tree_removed(tree)
130
+ close if tree == @tree
131
+ end
132
+
123
133
  # Refresh the DirMirror Tree for the given Window, if
124
134
  # there is one.
125
135
  def refresh