redcar-dev 0.12.17dev → 0.12.18dev

Sign up to get free protection for your applications and to get access to all the features.
Files changed (155) hide show
  1. data/CHANGES +4 -2
  2. data/README.md +5 -41
  3. data/Rakefile +3 -35
  4. data/lib/redcar.rb +19 -17
  5. data/lib/redcar/runner.rb +1 -7
  6. data/lib/redcar_quick_start.rb +5 -5
  7. data/plugins/application/features/main_menu.feature +1 -1
  8. data/plugins/application/features/step_definitions/command_steps.rb +8 -7
  9. data/plugins/application/features/step_definitions/filter_list_dialog_steps.rb +25 -10
  10. data/plugins/application/features/step_definitions/key_steps.rb +6 -4
  11. data/plugins/application/features/step_definitions/menu_steps.rb +27 -26
  12. data/plugins/application/features/step_definitions/speedbar_steps.rb +28 -16
  13. data/plugins/application/features/step_definitions/tree_steps.rb +88 -64
  14. data/plugins/application/features/step_definitions/window_steps.rb +14 -10
  15. data/plugins/application/features/support/env.rb +85 -83
  16. data/plugins/application/spec/application/application_spec.rb +1 -1
  17. data/plugins/application/spec/application/clipboard_spec.rb +1 -1
  18. data/plugins/application/spec/application/command/executor_spec.rb +1 -1
  19. data/plugins/application/spec/application/command/history_spec.rb +1 -1
  20. data/plugins/application/spec/application/command_spec.rb +1 -1
  21. data/plugins/application/spec/application/keymap/builder_spec.rb +1 -1
  22. data/plugins/application/spec/application/menu/builder_spec.rb +1 -1
  23. data/plugins/application/spec/application/menu/menu_item_spec.rb +1 -1
  24. data/plugins/application/spec/application/menu_spec.rb +1 -1
  25. data/plugins/application/spec/application/navigation_history_spec.rb +2 -0
  26. data/plugins/application/spec/application/notebook_spec.rb +1 -1
  27. data/plugins/application/spec/application/sensitive_spec.rb +1 -1
  28. data/plugins/application/spec/application/speedbar_spec.rb +1 -1
  29. data/plugins/application/spec/application/treebook_spec.rb +1 -1
  30. data/plugins/application/spec/application/window_spec.rb +1 -1
  31. data/plugins/application/spec/spec_helper.rb +4 -6
  32. data/plugins/application_swt/lib/application_swt/dialogs/filter_list_dialog_controller.rb +1 -1
  33. data/plugins/application_swt/lib/application_swt/gradient.rb +15 -5
  34. data/plugins/application_swt/lib/application_swt/window.rb +1 -1
  35. data/plugins/application_swt/spec/application_swt/gradient_spec.rb +13 -14
  36. data/plugins/application_swt/spec/application_swt/menu/binding_translator_spec.rb +1 -1
  37. data/plugins/application_swt/spec/application_swt/menu_spec.rb +1 -1
  38. data/plugins/application_swt/spec/spec_helper.rb +1 -19
  39. data/plugins/auto_completer/features/auto_complete.feature +7 -7
  40. data/plugins/auto_completer/features/step_definitions/auto_complete_steps.rb +3 -1
  41. data/plugins/auto_completer/features/step_definitions/dependency_steps.rb +0 -0
  42. data/plugins/auto_indenter/features/java_style_indentation.feature +5 -3
  43. data/plugins/auto_indenter/features/ruby_style_indentation.feature +13 -13
  44. data/plugins/auto_indenter/features/step_definitions/indentation_steps.rb +3 -1
  45. data/plugins/auto_indenter/spec/auto_indenter/analyzer_spec.rb +1 -1
  46. data/plugins/auto_indenter/spec/spec_helper.rb +1 -5
  47. data/plugins/auto_pairer/features/auto_pairer.feature +1 -1
  48. data/plugins/comment/features/line_comment.feature +31 -26
  49. data/plugins/comment/features/selection_comment.feature +1 -1
  50. data/plugins/comment/features/step_definitions/comment_steps.rb +6 -2
  51. data/plugins/comment/vendor/comment_lib.json +2 -0
  52. data/plugins/core/lib/core.rb +26 -0
  53. data/plugins/core/spec/core/base_storage_spec.rb +1 -1
  54. data/plugins/core/spec/core/gui_spec.rb +1 -1
  55. data/plugins/core/spec/core/observable_spec.rb +2 -1
  56. data/plugins/core/spec/core/persistent_cache_spec.rb +1 -1
  57. data/plugins/core/spec/core/shared_storage_spec.rb +1 -1
  58. data/plugins/core/spec/core/storage_spec.rb +1 -1
  59. data/plugins/core/spec/core/task_queue_spec.rb +1 -3
  60. data/plugins/core/spec/spec_helper.rb +1 -4
  61. data/plugins/declarations/spec/declarations/file_spec.rb +1 -1
  62. data/plugins/declarations/spec/spec_helper.rb +1 -5
  63. data/plugins/document_search/features/find.feature +39 -39
  64. data/plugins/document_search/features/step_definitions/find_steps.rb +6 -2
  65. data/plugins/edit_view/features/align_assignment.feature +6 -82
  66. data/plugins/edit_view/features/case_change.feature +22 -22
  67. data/plugins/edit_view/features/cursor_navigation.feature +2 -2
  68. data/plugins/edit_view/features/cut_and_paste.feature +9 -9
  69. data/plugins/edit_view/features/indentation_commands.feature +8 -8
  70. data/plugins/edit_view/features/line_delimiter.feature +7 -7
  71. data/plugins/edit_view/features/multiple_windows.feature +48 -48
  72. data/plugins/edit_view/features/step_definitions/dependency_steps.rb +0 -0
  73. data/plugins/edit_view/features/step_definitions/editing_steps.rb +237 -127
  74. data/plugins/edit_view/features/step_definitions/grammar_steps.rb +5 -1
  75. data/plugins/edit_view/features/step_definitions/notebook_steps.rb +38 -24
  76. data/plugins/edit_view/features/step_definitions/tab_steps.rb +83 -45
  77. data/plugins/edit_view/features/step_definitions/window_steps.rb +75 -54
  78. data/plugins/edit_view/features/support/env.rb +4 -23
  79. data/plugins/edit_view/lib/edit_view/commands/align_assignment_command.rb +29 -30
  80. data/plugins/edit_view/lib/edit_view/document.rb +23 -0
  81. data/plugins/edit_view/spec/edit_view/commands/align_assignment_command_spec.rb +83 -0
  82. data/plugins/edit_view/spec/edit_view/document/indentation_spec.rb +1 -1
  83. data/plugins/edit_view/spec/edit_view/document_spec.rb +1 -1
  84. data/plugins/edit_view/spec/spec_helper.rb +1 -4
  85. data/plugins/edit_view_swt/spec/edit_view_swt/word_movement_spec.rb +1 -1
  86. data/plugins/edit_view_swt/spec/spec_helper.rb +1 -4
  87. data/plugins/html_view/features/fixtures/sample.html +1 -1
  88. data/plugins/html_view/features/step_definitions/html_view_steps.rb +40 -39
  89. data/plugins/java/features/syntax_check_java.feature +18 -16
  90. data/plugins/line_tools/features/step_definitions/line_tools_steps.rb +18 -6
  91. data/plugins/macros/features/block_selection_in_macros.feature +47 -47
  92. data/plugins/macros/features/step_definitions/macro_steps.rb +9 -3
  93. data/plugins/macros/features/step_definitions/prediction_steps.rb +6 -2
  94. data/plugins/macros/plugin.rb +2 -1
  95. data/plugins/macros/spec/macros/predictive/sequence_finder_spec.rb +1 -1
  96. data/plugins/macros/spec/spec_helper.rb +1 -6
  97. data/plugins/outline_view/features/outline_view.feature +5 -5
  98. data/plugins/outline_view/features/step_definitions/outline_steps.rb +29 -17
  99. data/plugins/plugin_manager_ui/lib/plugin_manager_ui.rb +1 -1
  100. data/plugins/project/features/close_directory_tree.feature +0 -12
  101. data/plugins/project/features/open_directory_tree.feature +1 -2
  102. data/plugins/project/features/step_definitions/directory_steps.rb +13 -5
  103. data/plugins/project/features/step_definitions/file_steps.rb +23 -9
  104. data/plugins/project/features/step_definitions/find_file_steps.rb +6 -2
  105. data/plugins/project/features/step_definitions/project_tree_steps.rb +6 -2
  106. data/plugins/project/features/watch_for_modified_files.feature +1 -1
  107. data/plugins/project/spec/project/adapters/remote_protocols/ftp_spec.rb +1 -1
  108. data/plugins/project/spec/project/adapters/remote_protocols/sftp_spec.rb +1 -1
  109. data/plugins/project/spec/project/adapters/remote_spec.rb +1 -1
  110. data/plugins/project/spec/project/dir_mirror_spec.rb +1 -1
  111. data/plugins/project/spec/project/file_list_spec.rb +1 -1
  112. data/plugins/project/spec/project/file_mirror_spec.rb +2 -1
  113. data/plugins/project/spec/spec_helper.rb +1 -4
  114. data/plugins/project_search/spec/project_search/binary_data_detector_spec.rb +1 -1
  115. data/plugins/project_search/spec/project_search/word_search_spec.rb +1 -1
  116. data/plugins/project_search/spec/spec_helper.rb +1 -4
  117. data/plugins/{application → redcar}/features/navigation_history.feature +8 -8
  118. data/plugins/redcar/features/step_definitions/font_steps.rb +9 -5
  119. data/plugins/redcar/redcar.rb +0 -26
  120. data/plugins/repl/features/step_definitions/repl_steps.rb +15 -5
  121. data/plugins/repl/plugin.rb +1 -1
  122. data/plugins/repl/spec/repl/repl_mirror_spec.rb +1 -1
  123. data/plugins/repl/spec/spec_helper.rb +1 -4
  124. data/plugins/ruby/spec/ruby/repl_mirror_spec.rb +1 -1
  125. data/plugins/ruby/spec/spec_helper.rb +1 -5
  126. data/plugins/runnables/features/parameter_input.feature +43 -43
  127. data/plugins/runnables/features/step_definitions/runnable_steps.rb +9 -3
  128. data/plugins/runnables/plugin.rb +2 -2
  129. data/plugins/runnables/spec/runnables/output_processor_spec.rb +1 -1
  130. data/plugins/runnables/spec/spec_helper.rb +1 -5
  131. data/plugins/scm_svn/features/add_and_commit.feature +1 -0
  132. data/plugins/scm_svn/features/checkout.feature +1 -0
  133. data/plugins/scm_svn/features/edit_and_index.feature +1 -0
  134. data/plugins/scm_svn/features/ignore_files.feature +1 -0
  135. data/plugins/scm_svn/features/merge.feature +1 -0
  136. data/plugins/scm_svn/features/resolve_conflict.feature +1 -0
  137. data/plugins/scm_svn/features/revert_and_delete.feature +1 -0
  138. data/plugins/scm_svn/features/step_definitions/branch_and_merge_steps.rb +14 -9
  139. data/plugins/scm_svn/features/support/env.rb +4 -4
  140. data/plugins/scm_svn/features/switch_branches.feature +1 -0
  141. data/plugins/scm_svn/features/update.feature +1 -0
  142. data/plugins/strip_trailing_spaces/features/strip_trailing_spaces.feature +4 -4
  143. data/plugins/test_runner/plugin.rb +3 -1
  144. data/plugins/test_runner/spec/run_test_command_spec.rb +58 -50
  145. data/plugins/test_runner/spec/spec_helper.rb +1 -5
  146. data/plugins/textmate/features/step_definitions/tree_steps.rb +2 -0
  147. data/plugins/todo_list/features/todo_list.feature +1 -1
  148. data/plugins/todo_list/spec/spec_helper.rb +1 -4
  149. data/plugins/todo_list/spec/todo_list/file_parser_spec.rb +1 -1
  150. data/plugins/tree_view_swt/lib/tree_view_swt.rb +2 -1
  151. data/plugins/web_bookmarks/features/step_definitions/web_steps.rb +1 -1
  152. metadata +48 -48
  153. data/lib/redcar/installer.rb +0 -178
  154. data/plugins/key_bindings/spec/spec_helper.rb +0 -5
  155. data/plugins/scm/spec/spec_helper.rb +0 -5
@@ -1,4 +1,8 @@
1
+
1
2
  When /^I switch the language to (.*)$/ do |language|
2
- Redcar.app.focussed_window.focussed_notebook.focussed_tab.edit_view.grammar = language
3
+ puts "this should use menus rather than setting it directly"
4
+ Swt.sync_exec do
5
+ Redcar.app.focussed_window.focussed_notebook.focussed_tab.edit_view.grammar = language
6
+ end
3
7
  end
4
8
 
@@ -1,13 +1,13 @@
1
1
 
2
2
  module NotebookSwtHelper
3
- def notebook_sash
3
+ def notebook_sash(shell=active_shell)
4
4
  Redcar.app.show_toolbar = false
5
5
  Redcar.app.refresh_toolbar!
6
- active_shell.children.to_a.last.children.to_a[0]
6
+ shell.children.to_a[2].children.to_a[0]
7
7
  end
8
8
 
9
- def ctab_folders
10
- notebook_sash.children.to_a.select do |c|
9
+ def ctab_folders(shell=active_shell)
10
+ notebook_sash(shell).children.to_a.select do |c|
11
11
  c.class == Java::OrgEclipseSwtCustom::CTabFolder
12
12
  end
13
13
  end
@@ -16,44 +16,58 @@ end
16
16
  World(NotebookSwtHelper)
17
17
 
18
18
  When /^I make a new notebook$/ do
19
- Redcar::Application::OpenNewNotebookCommand.new.run
19
+ Swt.sync_exec do
20
+ Redcar::Application::OpenNewNotebookCommand.new.run
21
+ end
20
22
  end
21
23
 
22
24
  When /^I move the tab to the other notebook$/ do
23
- Redcar::Application::MoveTabToOtherNotebookCommand.new.run
25
+ Swt.sync_exec do
26
+ Redcar::Application::MoveTabToOtherNotebookCommand.new.run
27
+ end
24
28
  end
25
29
 
26
30
  When /^I close the current notebook$/ do
27
- Redcar::Application::CloseNotebookCommand.new.run
31
+ Swt.sync_exec do
32
+ Redcar::Application::CloseNotebookCommand.new.run
33
+ end
28
34
  end
29
35
 
30
36
  When /^I switch notebooks$/ do
31
- Redcar::Application::SwitchNotebookCommand.new.run
37
+ Swt.sync_exec do
38
+ Redcar::Application::SwitchNotebookCommand.new.run
39
+ end
32
40
  end
33
41
 
34
42
  Then /^there should be (one|two) notebooks?$/ do |count_str|
35
- count = count_str == "one" ? 1 : 2
36
- # in the model
37
- Redcar.app.windows.first.notebooks.length.should == count
38
-
39
- # in the GUI
40
- ctab_folders.length.should == count
43
+ Swt.sync_exec do
44
+ count = count_str == "one" ? 1 : 2
45
+ # in the model
46
+ Redcar.app.windows.first.notebooks.length.should == count
47
+
48
+ # in the GUI
49
+ ctab_folders.length.should == count
50
+ end
41
51
  end
42
52
 
43
53
 
44
54
  Then /^notebook (\d) should have (\d) tabs?$/ do |index, tab_count|
45
- index = index.to_i - 1
46
- # in the model
47
- Redcar.app.windows.first.notebooks[index].tabs.length.should == tab_count.to_i
48
-
49
- # in the GUI
50
- ctab_folders[index].children.to_a.length.should == tab_count.to_i
55
+ Swt.sync_exec do
56
+ index = index.to_i - 1
57
+ # in the model
58
+ Redcar.app.windows.first.notebooks[index].tabs.length.should == tab_count.to_i
59
+
60
+ # in the GUI
61
+ ctab_folders[index].children.to_a.length.should == tab_count.to_i
62
+ end
51
63
  end
52
64
 
53
65
  Then /^the tab in notebook (\d) should contain "([^\"]*)"$/ do |index, str|
54
- index = index.to_i - 1
55
- # in the model
56
- tab = Redcar.app.windows.first.notebooks[index].focussed_tab
57
- tab.edit_view.document.to_s.include?(str).should be_true
66
+ Swt.sync_exec do
67
+ index = index.to_i - 1
68
+ # in the model
69
+ tab = Redcar.app.windows.first.notebooks[index].focussed_tab
70
+ tab.edit_view.document.to_s.include?(str).should be_true
71
+ end
58
72
  end
59
73
 
@@ -3,51 +3,77 @@ When /^I do nothing$/ do
3
3
  end
4
4
 
5
5
  Given /^there is an edit tab containing "([^\"]*)"$/ do |contents|
6
- tab = Redcar::Top::OpenNewEditTabCommand.new.run
7
- contents = eval(contents.inspect.gsub("\\\\", "\\"))
8
- cursor_offset = (contents =~ /<c>/)
9
- contents = contents.gsub("<c>", "")
10
- tab.edit_view.document.text = contents
11
- if cursor_offset
12
- tab.edit_view.document.cursor_offset = cursor_offset
6
+ Swt.sync_exec do
7
+ tab = Redcar::Top::OpenNewEditTabCommand.new.run
8
+ contents = eval(contents.inspect.gsub("\\\\", "\\"))
9
+ cursor_offset = (contents =~ /<c>/)
10
+ contents = contents.gsub("<c>", "")
11
+ tab.edit_view.document.text = contents
12
+ if cursor_offset
13
+ tab.edit_view.document.cursor_offset = cursor_offset
14
+ end
13
15
  end
14
16
  end
15
17
 
16
18
  When /^I open a new edit tab$/ do
17
- tab = Redcar::Top::OpenNewEditTabCommand.new.run
19
+ Swt.bot.menu("File").menu("New").click
18
20
  end
19
21
 
20
22
  When /^I open a new edit tab titled "(.*)"$/ do |title|
21
- tab = Redcar::Top::OpenNewEditTabCommand.new.run
22
- tab.title = title
23
+ Swt.sync_exec do
24
+ tab = Redcar::Top::OpenNewEditTabCommand.new.run
25
+ tab.title = title
26
+ end
23
27
  end
24
28
 
25
29
  When /^I close the focussed tab$/ do
26
- Redcar::Application::CloseTabCommand.new.run
30
+ Swt.bot.menu("File").menu("Close Tab").click
27
31
  end
28
32
 
29
33
  When /^the edit tab updates its contents$/ do
30
- implicit_edit_view.check_for_updated_document
34
+ Swt.sync_exec do
35
+ implicit_edit_view.check_for_updated_document
36
+ end
31
37
  end
32
38
 
33
39
  When /I switch (up|down) a tab/ do |type|
34
- case type
35
- when "down"
36
- Redcar::Application::SwitchTabDownCommand.new.run
37
- when "up"
38
- Redcar::Application::SwitchTabUpCommand.new.run
40
+ Swt.sync_exec do
41
+ case type
42
+ when "down"
43
+ Redcar::Application::SwitchTabDownCommand.new.run
44
+ when "up"
45
+ Redcar::Application::SwitchTabUpCommand.new.run
46
+ end
39
47
  end
40
48
  end
41
49
 
42
50
  When /I move (up|down) a tab/ do |type|
43
- case type
44
- when "down"
45
- Redcar::Application::MoveTabDownCommand.new.run
46
- when "up"
47
- Redcar::Application::MoveTabUpCommand.new.run
51
+ Swt.sync_exec do
52
+ case type
53
+ when "down"
54
+ Redcar::Application::MoveTabDownCommand.new.run
55
+ when "up"
56
+ Redcar::Application::MoveTabUpCommand.new.run
57
+ end
58
+ end
59
+ end
60
+
61
+ module SwtbotHelpers
62
+
63
+ def get_tab_folders(shell=active_shell)
64
+ tab_folders = notebook_sash(shell).children.to_a.select do |c|
65
+ c.class == Java::OrgEclipseSwtCustom::CTabFolder
66
+ end
67
+ end
68
+
69
+ def get_tab_folder
70
+ get_tab_folders.length.should == 1
71
+ get_tab_folders.first
48
72
  end
49
73
  end
50
74
 
75
+ World(SwtbotHelpers)
76
+
51
77
  Then /^there should be (one|\d+) (.*) tabs?$/ do |num, tab_type|
52
78
  if num == "one"
53
79
  num = 1
@@ -58,56 +84,68 @@ Then /^there should be (one|\d+) (.*) tabs?$/ do |num, tab_type|
58
84
  # in the model
59
85
  tabs = Redcar.app.focussed_window.notebooks.map {|nb| nb.tabs }.flatten
60
86
  tabs.length.should == num
61
-
87
+
62
88
  # in the GUI
63
- case tab_type
64
- when "edit"
65
- tab_class = Redcar::EditTab
89
+ Swt.sync_exec do
90
+ get_tab_folder.children.to_a.length.should == num
66
91
  end
67
-
68
- tabs = get_tabs
69
- tabs.length.should == num
70
92
  end
71
93
 
72
94
  Then /^the edit tab should have the focus$/ do
73
- implicit_edit_view.controller.mate_text.get_text_widget.is_focus_control?.should be_true
95
+ Swt.sync_exec do
96
+ implicit_edit_view.controller.mate_text.get_text_widget.is_focus_control?.should be_true
97
+ end
74
98
  end
75
99
 
76
100
  Then /^there should be no open tabs$/ do
77
- get_tab_folder.getItems.to_a.length.should == 0
101
+ Swt.sync_exec { get_tab_folder.getItems.to_a.length.should == 0 }
78
102
  end
79
103
 
80
104
  Then /^the tab should be focussed within the notebook$/ do
81
- tab_folder = get_tab_folder
82
- tab_folder.get_selection.should == tab_folder.getItems.to_a.first
105
+ Swt.sync_exec do
106
+ tab_folder = get_tab_folder
107
+ tab_folder.get_selection.should == tab_folder.getItems.to_a.first
108
+ end
83
109
  end
84
110
 
85
111
  Then /^the tab should have the keyboard focus$/ do
86
- tab = get_tab(get_tab_folder)
87
- implicit_edit_view.controller.is_current?.should be_true
112
+ Swt.sync_exec do
113
+ tab = get_tab(get_tab_folder)
114
+ implicit_edit_view.controller.is_current?.should be_true
115
+ end
88
116
  end
89
117
 
90
118
  Then /^I should (not )?see "(.*)" in the edit tab$/ do |bool, content|
91
- content = content.gsub("\\n", "\n")
92
- bool = !bool
93
- matcher = bool ? be_true : be_false
94
- implicit_edit_view.document.to_s.include?(content).should matcher
119
+ Swt.sync_exec do
120
+ content = content.gsub("\\n", "\n")
121
+ bool = !bool
122
+ matcher = bool ? be_true : be_false
123
+ implicit_edit_view.document.to_s.include?(content).should matcher
124
+ end
95
125
  end
96
126
 
97
127
  Then /^my active tab should be "([^"]*)"$/ do |name|
98
- focussed_tab.title.should == name
128
+ Swt.sync_exec do
129
+ focussed_tab.title.should == name
130
+ end
99
131
  end
100
132
 
101
133
  Then /^my active tab should have an "([^"]*)" icon$/ do |arg1|
102
- focussed_tab.icon.should == :"#{arg1}"
134
+ Swt.sync_exec do
135
+ focussed_tab.icon.should == :"#{arg1}"
136
+ end
103
137
  end
104
138
 
105
139
  Then /^the tab should (not )?have annotations$/ do |negated|
106
- annotations = implicit_edit_view.annotations
107
- negated ? (annotations.should be_empty) : (annotations.should_not be_empty)
140
+ Swt.sync_exec do
141
+ annotations = implicit_edit_view.annotations
142
+ negated ? (annotations.should be_empty) : (annotations.should_not be_empty)
143
+ end
108
144
  end
109
145
 
110
146
  Then /^the tab should (not )?have an annotation on line (\d+)$/ do |negated, num|
111
- annotations = implicit_edit_view.annotations(:line => num.to_i)
112
- negated ? (annotations.should be_empty) : (annotations.should_not be_empty)
147
+ Swt.sync_exec do
148
+ annotations = implicit_edit_view.annotations(:line => num.to_i)
149
+ negated ? (annotations.should be_empty) : (annotations.should_not be_empty)
150
+ end
113
151
  end
@@ -1,59 +1,73 @@
1
1
  Then /^there should be (no|one|\d+) windows?$/ do |num|
2
- case num
3
- when "no"
4
- num = 0
5
- when "one"
6
- num = 1
7
- else
8
- num = num.to_i
2
+ Swt.sync_exec do
3
+ case num
4
+ when "no"
5
+ num = 0
6
+ when "one"
7
+ num = 1
8
+ else
9
+ num = num.to_i
10
+ end
11
+
12
+ # in the model
13
+ Redcar.app.windows.length.should == num
14
+
15
+ # in the gui
16
+ display = Swt::Widgets::Display.get_current
17
+ shells = display.get_shells.to_a
18
+
19
+ # on OSX there is always an invisible window
20
+ diff = Redcar.platform == :osx ? 1 : 0
21
+
22
+ shells.length.should == num + diff
9
23
  end
10
-
11
- # in the model
12
- Redcar.app.windows.length.should == num
13
-
14
- # in the gui
15
- display = Swt::Widgets::Display.get_current
16
- shells = display.get_shells.to_a
17
-
18
- # on OSX there is always an invisible window
19
- diff = Redcar.platform == :osx ? 1 : 0
20
-
21
- shells.length.should == num + diff
22
24
  end
23
25
 
24
26
  When /I open a new window(?: with title "(.*)")?/ do |title|
25
- Redcar::Application::OpenNewWindowCommand.new(title).run
27
+ Swt.sync_exec do
28
+ Redcar::Application::OpenNewWindowCommand.new(title).run
29
+ end
26
30
  end
27
31
 
28
32
  When /^I maximize the window size$/ do
29
- Redcar.app.focussed_window.controller.shell.maximized = true
33
+ Swt.sync_exec do
34
+ Redcar.app.focussed_window.controller.shell.maximized = true
35
+ end
30
36
  end
31
37
 
32
38
  When /^I restore the window size$/ do
33
- Redcar.app.focussed_window.controller.shell.maximized = false
39
+ Swt.sync_exec do
40
+ Redcar.app.focussed_window.controller.shell.maximized = false
41
+ end
34
42
  end
35
43
 
36
44
  When /I close the window(?: "(.*)")?( with a command| through the gui)?/ do |title, how|
37
- if title
38
- win = Redcar.app.windows.detect{|win| win.title == title }
39
- else
40
- win = Redcar.app.focussed_window
41
- end
42
- if how =~ /command/
43
- Redcar::Application::CloseWindowCommand.new(win).run
44
- else
45
- FakeEvent.new(Swt::SWT::Close, win.controller.shell)
45
+ Swt.sync_exec do
46
+ if title
47
+ win = Redcar.app.windows.detect{|win| win.title == title }
48
+ else
49
+ win = Redcar.app.focussed_window
50
+ end
51
+ if how =~ /command/
52
+ Redcar::Application::CloseWindowCommand.new(win).run
53
+ else
54
+ FakeEvent.new(Swt::SWT::Close, win.controller.shell)
55
+ end
46
56
  end
47
57
  end
48
58
 
49
59
  When /^I focus the window "([^\"]*)" with a command$/ do |title|
50
- win = Redcar.app.windows.detect{|win| win.title == title }
51
- win.focus
60
+ Swt.sync_exec do
61
+ win = Redcar.app.windows.detect{|win| win.title == title }
62
+ win.focus
63
+ end
52
64
  end
53
65
 
54
66
  When /^I focus the window "([^\"]*)" through the gui$/ do |title|
55
- win = Redcar.app.windows.detect{|win| win.title == title }
56
- FakeEvent.new(Swt::SWT::Activate, win.controller.shell)
67
+ Swt.sync_exec do
68
+ win = Redcar.app.windows.detect{|win| win.title == title }
69
+ FakeEvent.new(Swt::SWT::Activate, win.controller.shell)
70
+ end
57
71
  end
58
72
 
59
73
  When /^I focus the working directory window through the gui$/ do
@@ -61,26 +75,33 @@ When /^I focus the working directory window through the gui$/ do
61
75
  end
62
76
 
63
77
  Then /^the window should be titled "([^\"]*)"$/ do |title|
64
- windows = Redcar.app.windows
65
- windows.length.should == 1
66
-
67
- # in the model
68
- windows.first.title.should == title
69
- # in the gui
70
- windows.first.controller.shell.text.should == title
78
+ Swt.sync_exec do
79
+ windows = Redcar.app.windows
80
+ windows.length.should == 1
81
+
82
+ # in the model
83
+ windows.first.title.should == title
84
+ # in the gui
85
+ windows.first.controller.shell.text.should == title
86
+ end
71
87
  end
72
88
 
73
89
  Then /the window "(.*)" should have (\d+) tabs?/ do |win_title, tab_num|
74
- tab_num = tab_num.to_i
75
-
76
- # in the model
77
- Redcar.app.windows.detect{|win| win.title == win_title }.notebooks.map{|nb| nb.tabs}.flatten.length.should == tab_num
78
-
79
- # in the GUI
80
- display = Swt::Widgets::Display.get_current
81
- shells = display.get_shells.to_a
82
- shell = shells.detect {|s| s.text == win_title }
83
- items = get_tab_folders(shell).map{|f| f.getItems.to_a}.flatten
90
+ Swt.sync_exec do
91
+ tab_num = tab_num.to_i
84
92
 
85
- items.map {|i| model_tab_for_item(i)}.length.should == tab_num
86
- end
93
+ # in the model
94
+ Redcar.app.windows.detect{|win| win.title == win_title }.notebooks.map{|nb| nb.tabs}.flatten.length.should == tab_num
95
+
96
+ # in the GUI
97
+ display = Swt::Widgets::Display.get_current
98
+ shells = display.get_shells.to_a
99
+ shell = shells.detect {|s| s.text == win_title }
100
+ items = get_tab_folders(shell).map{|f| f.getItems.to_a}.flatten
101
+
102
+ items.map {|i| model_tab_for_item(i)}.length.should == tab_num
103
+ end
104
+ end
105
+
106
+
107
+