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.
- data/CHANGES +4 -2
- data/README.md +5 -41
- data/Rakefile +3 -35
- data/lib/redcar.rb +19 -17
- data/lib/redcar/runner.rb +1 -7
- data/lib/redcar_quick_start.rb +5 -5
- data/plugins/application/features/main_menu.feature +1 -1
- data/plugins/application/features/step_definitions/command_steps.rb +8 -7
- data/plugins/application/features/step_definitions/filter_list_dialog_steps.rb +25 -10
- data/plugins/application/features/step_definitions/key_steps.rb +6 -4
- data/plugins/application/features/step_definitions/menu_steps.rb +27 -26
- data/plugins/application/features/step_definitions/speedbar_steps.rb +28 -16
- data/plugins/application/features/step_definitions/tree_steps.rb +88 -64
- data/plugins/application/features/step_definitions/window_steps.rb +14 -10
- data/plugins/application/features/support/env.rb +85 -83
- data/plugins/application/spec/application/application_spec.rb +1 -1
- data/plugins/application/spec/application/clipboard_spec.rb +1 -1
- data/plugins/application/spec/application/command/executor_spec.rb +1 -1
- data/plugins/application/spec/application/command/history_spec.rb +1 -1
- data/plugins/application/spec/application/command_spec.rb +1 -1
- data/plugins/application/spec/application/keymap/builder_spec.rb +1 -1
- data/plugins/application/spec/application/menu/builder_spec.rb +1 -1
- data/plugins/application/spec/application/menu/menu_item_spec.rb +1 -1
- data/plugins/application/spec/application/menu_spec.rb +1 -1
- data/plugins/application/spec/application/navigation_history_spec.rb +2 -0
- data/plugins/application/spec/application/notebook_spec.rb +1 -1
- data/plugins/application/spec/application/sensitive_spec.rb +1 -1
- data/plugins/application/spec/application/speedbar_spec.rb +1 -1
- data/plugins/application/spec/application/treebook_spec.rb +1 -1
- data/plugins/application/spec/application/window_spec.rb +1 -1
- data/plugins/application/spec/spec_helper.rb +4 -6
- data/plugins/application_swt/lib/application_swt/dialogs/filter_list_dialog_controller.rb +1 -1
- data/plugins/application_swt/lib/application_swt/gradient.rb +15 -5
- data/plugins/application_swt/lib/application_swt/window.rb +1 -1
- data/plugins/application_swt/spec/application_swt/gradient_spec.rb +13 -14
- data/plugins/application_swt/spec/application_swt/menu/binding_translator_spec.rb +1 -1
- data/plugins/application_swt/spec/application_swt/menu_spec.rb +1 -1
- data/plugins/application_swt/spec/spec_helper.rb +1 -19
- data/plugins/auto_completer/features/auto_complete.feature +7 -7
- data/plugins/auto_completer/features/step_definitions/auto_complete_steps.rb +3 -1
- data/plugins/auto_completer/features/step_definitions/dependency_steps.rb +0 -0
- data/plugins/auto_indenter/features/java_style_indentation.feature +5 -3
- data/plugins/auto_indenter/features/ruby_style_indentation.feature +13 -13
- data/plugins/auto_indenter/features/step_definitions/indentation_steps.rb +3 -1
- data/plugins/auto_indenter/spec/auto_indenter/analyzer_spec.rb +1 -1
- data/plugins/auto_indenter/spec/spec_helper.rb +1 -5
- data/plugins/auto_pairer/features/auto_pairer.feature +1 -1
- data/plugins/comment/features/line_comment.feature +31 -26
- data/plugins/comment/features/selection_comment.feature +1 -1
- data/plugins/comment/features/step_definitions/comment_steps.rb +6 -2
- data/plugins/comment/vendor/comment_lib.json +2 -0
- data/plugins/core/lib/core.rb +26 -0
- data/plugins/core/spec/core/base_storage_spec.rb +1 -1
- data/plugins/core/spec/core/gui_spec.rb +1 -1
- data/plugins/core/spec/core/observable_spec.rb +2 -1
- data/plugins/core/spec/core/persistent_cache_spec.rb +1 -1
- data/plugins/core/spec/core/shared_storage_spec.rb +1 -1
- data/plugins/core/spec/core/storage_spec.rb +1 -1
- data/plugins/core/spec/core/task_queue_spec.rb +1 -3
- data/plugins/core/spec/spec_helper.rb +1 -4
- data/plugins/declarations/spec/declarations/file_spec.rb +1 -1
- data/plugins/declarations/spec/spec_helper.rb +1 -5
- data/plugins/document_search/features/find.feature +39 -39
- data/plugins/document_search/features/step_definitions/find_steps.rb +6 -2
- data/plugins/edit_view/features/align_assignment.feature +6 -82
- data/plugins/edit_view/features/case_change.feature +22 -22
- data/plugins/edit_view/features/cursor_navigation.feature +2 -2
- data/plugins/edit_view/features/cut_and_paste.feature +9 -9
- data/plugins/edit_view/features/indentation_commands.feature +8 -8
- data/plugins/edit_view/features/line_delimiter.feature +7 -7
- data/plugins/edit_view/features/multiple_windows.feature +48 -48
- data/plugins/edit_view/features/step_definitions/dependency_steps.rb +0 -0
- data/plugins/edit_view/features/step_definitions/editing_steps.rb +237 -127
- data/plugins/edit_view/features/step_definitions/grammar_steps.rb +5 -1
- data/plugins/edit_view/features/step_definitions/notebook_steps.rb +38 -24
- data/plugins/edit_view/features/step_definitions/tab_steps.rb +83 -45
- data/plugins/edit_view/features/step_definitions/window_steps.rb +75 -54
- data/plugins/edit_view/features/support/env.rb +4 -23
- data/plugins/edit_view/lib/edit_view/commands/align_assignment_command.rb +29 -30
- data/plugins/edit_view/lib/edit_view/document.rb +23 -0
- data/plugins/edit_view/spec/edit_view/commands/align_assignment_command_spec.rb +83 -0
- data/plugins/edit_view/spec/edit_view/document/indentation_spec.rb +1 -1
- data/plugins/edit_view/spec/edit_view/document_spec.rb +1 -1
- data/plugins/edit_view/spec/spec_helper.rb +1 -4
- data/plugins/edit_view_swt/spec/edit_view_swt/word_movement_spec.rb +1 -1
- data/plugins/edit_view_swt/spec/spec_helper.rb +1 -4
- data/plugins/html_view/features/fixtures/sample.html +1 -1
- data/plugins/html_view/features/step_definitions/html_view_steps.rb +40 -39
- data/plugins/java/features/syntax_check_java.feature +18 -16
- data/plugins/line_tools/features/step_definitions/line_tools_steps.rb +18 -6
- data/plugins/macros/features/block_selection_in_macros.feature +47 -47
- data/plugins/macros/features/step_definitions/macro_steps.rb +9 -3
- data/plugins/macros/features/step_definitions/prediction_steps.rb +6 -2
- data/plugins/macros/plugin.rb +2 -1
- data/plugins/macros/spec/macros/predictive/sequence_finder_spec.rb +1 -1
- data/plugins/macros/spec/spec_helper.rb +1 -6
- data/plugins/outline_view/features/outline_view.feature +5 -5
- data/plugins/outline_view/features/step_definitions/outline_steps.rb +29 -17
- data/plugins/plugin_manager_ui/lib/plugin_manager_ui.rb +1 -1
- data/plugins/project/features/close_directory_tree.feature +0 -12
- data/plugins/project/features/open_directory_tree.feature +1 -2
- data/plugins/project/features/step_definitions/directory_steps.rb +13 -5
- data/plugins/project/features/step_definitions/file_steps.rb +23 -9
- data/plugins/project/features/step_definitions/find_file_steps.rb +6 -2
- data/plugins/project/features/step_definitions/project_tree_steps.rb +6 -2
- data/plugins/project/features/watch_for_modified_files.feature +1 -1
- data/plugins/project/spec/project/adapters/remote_protocols/ftp_spec.rb +1 -1
- data/plugins/project/spec/project/adapters/remote_protocols/sftp_spec.rb +1 -1
- data/plugins/project/spec/project/adapters/remote_spec.rb +1 -1
- data/plugins/project/spec/project/dir_mirror_spec.rb +1 -1
- data/plugins/project/spec/project/file_list_spec.rb +1 -1
- data/plugins/project/spec/project/file_mirror_spec.rb +2 -1
- data/plugins/project/spec/spec_helper.rb +1 -4
- data/plugins/project_search/spec/project_search/binary_data_detector_spec.rb +1 -1
- data/plugins/project_search/spec/project_search/word_search_spec.rb +1 -1
- data/plugins/project_search/spec/spec_helper.rb +1 -4
- data/plugins/{application → redcar}/features/navigation_history.feature +8 -8
- data/plugins/redcar/features/step_definitions/font_steps.rb +9 -5
- data/plugins/redcar/redcar.rb +0 -26
- data/plugins/repl/features/step_definitions/repl_steps.rb +15 -5
- data/plugins/repl/plugin.rb +1 -1
- data/plugins/repl/spec/repl/repl_mirror_spec.rb +1 -1
- data/plugins/repl/spec/spec_helper.rb +1 -4
- data/plugins/ruby/spec/ruby/repl_mirror_spec.rb +1 -1
- data/plugins/ruby/spec/spec_helper.rb +1 -5
- data/plugins/runnables/features/parameter_input.feature +43 -43
- data/plugins/runnables/features/step_definitions/runnable_steps.rb +9 -3
- data/plugins/runnables/plugin.rb +2 -2
- data/plugins/runnables/spec/runnables/output_processor_spec.rb +1 -1
- data/plugins/runnables/spec/spec_helper.rb +1 -5
- data/plugins/scm_svn/features/add_and_commit.feature +1 -0
- data/plugins/scm_svn/features/checkout.feature +1 -0
- data/plugins/scm_svn/features/edit_and_index.feature +1 -0
- data/plugins/scm_svn/features/ignore_files.feature +1 -0
- data/plugins/scm_svn/features/merge.feature +1 -0
- data/plugins/scm_svn/features/resolve_conflict.feature +1 -0
- data/plugins/scm_svn/features/revert_and_delete.feature +1 -0
- data/plugins/scm_svn/features/step_definitions/branch_and_merge_steps.rb +14 -9
- data/plugins/scm_svn/features/support/env.rb +4 -4
- data/plugins/scm_svn/features/switch_branches.feature +1 -0
- data/plugins/scm_svn/features/update.feature +1 -0
- data/plugins/strip_trailing_spaces/features/strip_trailing_spaces.feature +4 -4
- data/plugins/test_runner/plugin.rb +3 -1
- data/plugins/test_runner/spec/run_test_command_spec.rb +58 -50
- data/plugins/test_runner/spec/spec_helper.rb +1 -5
- data/plugins/textmate/features/step_definitions/tree_steps.rb +2 -0
- data/plugins/todo_list/features/todo_list.feature +1 -1
- data/plugins/todo_list/spec/spec_helper.rb +1 -4
- data/plugins/todo_list/spec/todo_list/file_parser_spec.rb +1 -1
- data/plugins/tree_view_swt/lib/tree_view_swt.rb +2 -1
- data/plugins/web_bookmarks/features/step_definitions/web_steps.rb +1 -1
- metadata +48 -48
- data/lib/redcar/installer.rb +0 -178
- data/plugins/key_bindings/spec/spec_helper.rb +0 -5
- data/plugins/scm/spec/spec_helper.rb +0 -5
@@ -25,37 +25,49 @@ def get_speedbar_field(field_name, expected_klass, speedbar=nil)
|
|
25
25
|
end
|
26
26
|
|
27
27
|
When /^I type "([^"]*)" into the "([^"]*)" field in the speedbar$/ do |text, field_name|
|
28
|
-
|
28
|
+
Swt.sync_exec do
|
29
|
+
get_speedbar_text_field(field_name).edit_view.document.text = text
|
30
|
+
end
|
29
31
|
end
|
30
32
|
|
31
33
|
When /^I press "([^"]*)" in the speedbar$/ do |button_name|
|
32
|
-
|
33
|
-
|
34
|
+
Swt.sync_exec do
|
35
|
+
speedbar = Redcar.app.focussed_window.speedbar
|
36
|
+
speedbar.controller.execute_listener_in_model(speedbar.__get_item_by_text_or_name(button_name))
|
37
|
+
end
|
34
38
|
end
|
35
39
|
|
36
40
|
When /^I check "([^"]*)" in the speedbar$/ do |checkbox_name|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
+
Swt.sync_exec do
|
42
|
+
speedbar = Redcar.app.focussed_window.speedbar
|
43
|
+
item = speedbar.__get_item_by_text_or_name(checkbox_name)
|
44
|
+
item.set_value(true)
|
45
|
+
speedbar.controller.execute_listener_in_model(item, true)
|
46
|
+
end
|
41
47
|
end
|
42
48
|
|
43
49
|
When /^I uncheck "([^"]*)" in the speedbar$/ do |checkbox_name|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
50
|
+
Swt.sync_exec do
|
51
|
+
speedbar = Redcar.app.focussed_window.speedbar
|
52
|
+
item = speedbar.__get_item_by_text_or_name(checkbox_name)
|
53
|
+
item.set_value(false)
|
54
|
+
speedbar.controller.execute_listener_in_model(item, false)
|
55
|
+
end
|
48
56
|
end
|
49
57
|
|
50
58
|
When /^I choose "([^"]*)" in the "([^"]*)" field in the speedbar$/ do |value, combo_name|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
59
|
+
Swt.sync_exec do
|
60
|
+
speedbar = Redcar.app.focussed_window.speedbar
|
61
|
+
item = get_speedbar_field(combo_name, Redcar::Speedbar::ComboItem)
|
62
|
+
item.set_value(value)
|
63
|
+
speedbar.controller.execute_listener_in_model(item, value)
|
64
|
+
end
|
55
65
|
end
|
56
66
|
|
57
67
|
When /^I close the speedbar$/ do
|
58
|
-
|
68
|
+
Swt.sync_exec do
|
69
|
+
Redcar.app.focussed_window.close_speedbar
|
70
|
+
end
|
59
71
|
end
|
60
72
|
|
61
73
|
Then /^the "([^"]*)" field in the speedbar should have text "([^"]*)"$/ do |field_name, text|
|
@@ -1,107 +1,131 @@
|
|
1
1
|
|
2
2
|
When /^I expand the tree row "([^\"]*)"$/ do |row|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
Swt.sync_exec do
|
4
|
+
item = visible_tree_items(top_tree).detect {|item| item.getText == row }
|
5
|
+
viewer = focussed_tree.controller.viewer
|
6
|
+
node = viewer.getViewerRowFromItem(item).getElement
|
7
|
+
viewer.expandToLevel(node, 1)
|
8
|
+
end
|
7
9
|
end
|
8
10
|
|
9
11
|
When /^I toggle tree visibility$/ do
|
10
|
-
|
12
|
+
Swt.sync_exec do
|
13
|
+
Redcar::Application::ToggleTreesCommand.new.run
|
14
|
+
end
|
11
15
|
end
|
12
16
|
|
13
17
|
When "I close the tree" do
|
14
|
-
|
18
|
+
Swt.sync_exec do
|
19
|
+
Redcar::Application::CloseTreeCommand.new.run
|
20
|
+
end
|
15
21
|
end
|
16
22
|
|
17
23
|
When /^I switch (up|down) a tree$/ do |type|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
24
|
+
Swt.sync_exec do
|
25
|
+
case type
|
26
|
+
when "down"
|
27
|
+
Redcar::Application::SwitchTreeDownCommand.new.run
|
28
|
+
when "up"
|
29
|
+
Redcar::Application::SwitchTreeUpCommand.new.run
|
30
|
+
end
|
23
31
|
end
|
24
32
|
end
|
25
33
|
|
26
34
|
When "I click the close button" do
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
35
|
+
Swt.sync_exec do
|
36
|
+
vtabitem = focussed_window.treebook.controller.tab_folder.selection
|
37
|
+
swtlabel = swt_label_for_item(vtabitem)
|
38
|
+
|
39
|
+
# Make sure the close icon is showing
|
40
|
+
FakeEvent.new(Swt::SWT::MouseEnter, swtlabel)
|
41
|
+
|
42
|
+
# Fire the click event
|
43
|
+
FakeEvent.new(Swt::SWT::MouseUp, swtlabel,
|
44
|
+
:x => Swt::Widgets::VTabLabel::ICON_PADDING + 1,
|
45
|
+
:y => Swt::Widgets::VTabLabel::ICON_PADDING + 1)
|
46
|
+
end
|
37
47
|
end
|
38
48
|
|
39
49
|
When /^I (?:(left|right)-)?click the (project|directory|"[^\"]*") tree tab$/ do |button, target|
|
40
|
-
|
41
|
-
|
42
|
-
|
50
|
+
Swt.sync_exec do
|
51
|
+
if target =~ /(project|directory)/
|
52
|
+
path = Redcar::Project::Manager.in_window(Redcar.app.focussed_window).path
|
53
|
+
target = File.basename(path) + "/"
|
54
|
+
end
|
55
|
+
target.gsub!('"', '')
|
56
|
+
vtabitem = focussed_window.treebook.controller.tab_folder.get_item(target)
|
57
|
+
swtlabel = swt_label_for_item(vtabitem)
|
58
|
+
|
59
|
+
button = (button == "right" ? 2 : 1)
|
60
|
+
FakeEvent.new(Swt::SWT::MouseEnter, swtlabel)
|
61
|
+
FakeEvent.new(Swt::SWT::MouseUp, swtlabel, :x => 1, :y => 1, :button => button)
|
43
62
|
end
|
44
|
-
target.gsub!('"', '')
|
45
|
-
vtabitem = focussed_window.treebook.controller.tab_folder.get_item(target)
|
46
|
-
swtlabel = swt_label_for_item(vtabitem)
|
47
|
-
|
48
|
-
button = (button == "right" ? 2 : 1)
|
49
|
-
FakeEvent.new(Swt::SWT::MouseEnter, swtlabel)
|
50
|
-
FakeEvent.new(Swt::SWT::MouseUp, swtlabel, :x => 1, :y => 1, :button => button)
|
51
63
|
end
|
52
64
|
|
53
65
|
Then /^I should (not )?see "([^\"]*)" in the tree$/ do |negate, rows|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
66
|
+
Swt.sync_exec do
|
67
|
+
item_names = visible_tree_items(top_tree).map(&:get_text)
|
68
|
+
rows.split(',').map(&:strip).each do |row|
|
69
|
+
if negate
|
70
|
+
item_names.should_not include row
|
71
|
+
else
|
72
|
+
item_names.should include row
|
73
|
+
end
|
60
74
|
end
|
61
75
|
end
|
62
76
|
end
|
63
77
|
|
64
78
|
Then /^there should (not )?be a tree titled "([^\"]*)"$/ do |negate,title|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
79
|
+
Swt.sync_exec do
|
80
|
+
if negate
|
81
|
+
tree_with_title(title).should == nil
|
82
|
+
else
|
83
|
+
tree_with_title(title).should_not == nil
|
84
|
+
end
|
69
85
|
end
|
70
86
|
end
|
71
87
|
|
72
88
|
Then /^the focussed tree should be titled "([^\"]*)"$/ do |title|
|
73
|
-
|
89
|
+
Swt.sync_exec do
|
90
|
+
focussed_tree.title.should == title
|
91
|
+
end
|
74
92
|
end
|
75
93
|
|
76
94
|
Then /^the tree width should be (the default|\d+ pixels|the minimum size)$/ do |w|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
95
|
+
Swt.sync_exec do
|
96
|
+
width = focussed_treebook_width
|
97
|
+
if w == "the default"
|
98
|
+
unless width == default_treebook_width
|
99
|
+
raise "The tree width was #{width}, expected #{default_treebook_width}"
|
100
|
+
end
|
101
|
+
elsif w == "the minimum size"
|
102
|
+
width.should == Redcar::ApplicationSWT::Window::MINIMUM_TREEBOOK_WIDTH
|
103
|
+
else
|
104
|
+
width.should == w.split(" ")[0].to_i
|
81
105
|
end
|
82
|
-
elsif w == "the minimum size"
|
83
|
-
width.should == Redcar::ApplicationSWT::Window::MINIMUM_TREEBOOK_WIDTH
|
84
|
-
else
|
85
|
-
width.should == w.split(" ")[0].to_i
|
86
106
|
end
|
87
107
|
end
|
88
108
|
|
89
109
|
When /^I activate the "([^"]*)" node in the tree$/ do |node_text|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
110
|
+
Swt.sync_exec do
|
111
|
+
controller = focussed_tree.tree_controller
|
112
|
+
model = focussed_tree.controller.model
|
113
|
+
mirror = focussed_tree.tree_mirror
|
114
|
+
node = find_node_with_text(mirror.top, node_text)
|
115
|
+
|
116
|
+
node.should_not be_nil
|
117
|
+
|
118
|
+
controller.activated(model, node)
|
119
|
+
end
|
98
120
|
end
|
99
121
|
|
100
122
|
When /^I rename the "([^"]*)" node in the tree$/ do |node_text|
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
123
|
+
Swt.sync_exec do
|
124
|
+
controller = focussed_tree.tree_controller
|
125
|
+
mirror = focussed_tree.tree_mirror
|
126
|
+
node = find_node_with_text(mirror.top, node_text)
|
127
|
+
|
128
|
+
node.should_not be_nil
|
129
|
+
controller.single_rename(focussed_tree, node)
|
130
|
+
end
|
107
131
|
end
|
@@ -1,17 +1,21 @@
|
|
1
1
|
|
2
2
|
Then /^the window should have title "([^\"]*)"$/ do |expected_title|
|
3
|
-
|
3
|
+
Swt.sync_exec do
|
4
|
+
active_shell.get_text.should == expected_title
|
5
|
+
end
|
4
6
|
end
|
5
7
|
|
6
8
|
When /^I set the treebook width to (the default|only a few pixels|the minimum width|\d+ pixels)$/ do |w|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
9
|
+
Swt.sync_exec do
|
10
|
+
if w == "only a few pixels"
|
11
|
+
width = 10
|
12
|
+
elsif w == "the minimum width"
|
13
|
+
width = Redcar::ApplicationSWT::Window::MINIMUM_TREEBOOK_WIDTH
|
14
|
+
elsif w == "the default"
|
15
|
+
width = default_treebook_width
|
16
|
+
else
|
17
|
+
width = w.split(" ")[0].to_i
|
18
|
+
end
|
19
|
+
focussed_window.controller.send(:set_sash_widths, width)
|
15
20
|
end
|
16
|
-
focussed_window.controller.send(:set_sash_widths, width)
|
17
21
|
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
|
1
2
|
require File.expand_path("../fake_event", __FILE__)
|
2
3
|
|
3
4
|
class TestingError < StandardError
|
@@ -7,89 +8,6 @@ def get_menu_name text
|
|
7
8
|
Redcar::Menu.parse(text)
|
8
9
|
end
|
9
10
|
|
10
|
-
module SwtHelper
|
11
|
-
def main_menu
|
12
|
-
display = Redcar::ApplicationSWT.display
|
13
|
-
shell = display.get_shells.to_a.first
|
14
|
-
menu_bar = shell.get_menu_bar
|
15
|
-
menu_bar
|
16
|
-
end
|
17
|
-
|
18
|
-
def first_shell
|
19
|
-
Redcar::ApplicationSWT.display.get_shells.to_a.first
|
20
|
-
end
|
21
|
-
|
22
|
-
def active_shell
|
23
|
-
focussed_window.controller.shell
|
24
|
-
end
|
25
|
-
|
26
|
-
def focussed_window
|
27
|
-
Redcar.app.focussed_window
|
28
|
-
end
|
29
|
-
|
30
|
-
def focussed_treebook_width
|
31
|
-
Redcar.app.focussed_window.controller.treebook_width
|
32
|
-
end
|
33
|
-
|
34
|
-
def focussed_tree
|
35
|
-
focussed_window.treebook.focussed_tree
|
36
|
-
end
|
37
|
-
|
38
|
-
def default_treebook_width
|
39
|
-
Redcar.app.focussed_window.controller.default_treebook_width
|
40
|
-
end
|
41
|
-
|
42
|
-
def tree_with_title(title)
|
43
|
-
focussed_window.treebook.trees.detect {|t| t.tree_mirror.title == title }
|
44
|
-
end
|
45
|
-
|
46
|
-
def dialog(type)
|
47
|
-
dialogs.detect {|d| d.is_a?(type) }
|
48
|
-
end
|
49
|
-
|
50
|
-
def dialogs
|
51
|
-
Redcar::ApplicationSWT.display.get_shells.to_a.map do |s|
|
52
|
-
Redcar::ApplicationSWT.shell_dialogs[s]
|
53
|
-
end.compact
|
54
|
-
end
|
55
|
-
|
56
|
-
def visible_tree_items(tree, items = [])
|
57
|
-
tree.getItems.to_a.each do |item|
|
58
|
-
items << item
|
59
|
-
visible_tree_items(item, items) if item.expanded?
|
60
|
-
end
|
61
|
-
return items
|
62
|
-
end
|
63
|
-
|
64
|
-
def top_tree
|
65
|
-
tree = focussed_tree.controller.viewer.get_tree
|
66
|
-
tree.extend(TreeHelpers)
|
67
|
-
tree
|
68
|
-
end
|
69
|
-
|
70
|
-
def find_node_with_text(top, node_text)
|
71
|
-
node = top.detect { |node| node.text == node_text }
|
72
|
-
return node if node
|
73
|
-
all_children = top.map{ |node| node.children }.flatten
|
74
|
-
find_node_with_text(all_children, node_text) unless all_children.empty?
|
75
|
-
end
|
76
|
-
|
77
|
-
def swt_label_for_item(vtabitem)
|
78
|
-
vtablabel = vtabitem.instance_variable_get "@label"
|
79
|
-
vtablabel.instance_variable_get "@label"
|
80
|
-
end
|
81
|
-
|
82
|
-
module TreeHelpers
|
83
|
-
def items
|
84
|
-
getItems.to_a
|
85
|
-
end
|
86
|
-
|
87
|
-
def item_texts
|
88
|
-
getItems.to_a.map {|item| item.getText}
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
93
11
|
class FakeDialogAdapter
|
94
12
|
def initialize
|
95
13
|
@responses = {}
|
@@ -192,6 +110,90 @@ class FakeDialogAdapter
|
|
192
110
|
end
|
193
111
|
end
|
194
112
|
|
113
|
+
module SwtHelper
|
114
|
+
|
115
|
+
def main_menu
|
116
|
+
display = Redcar::ApplicationSWT.display
|
117
|
+
shell = display.get_shells.to_a.first
|
118
|
+
menu_bar = shell.get_menu_bar
|
119
|
+
menu_bar
|
120
|
+
end
|
121
|
+
|
122
|
+
def first_shell
|
123
|
+
Redcar::ApplicationSWT.display.get_shells.to_a.first
|
124
|
+
end
|
125
|
+
|
126
|
+
def active_shell
|
127
|
+
focussed_window.controller.shell
|
128
|
+
end
|
129
|
+
|
130
|
+
def focussed_window
|
131
|
+
Redcar.app.focussed_window
|
132
|
+
end
|
133
|
+
|
134
|
+
def focussed_treebook_width
|
135
|
+
Redcar.app.focussed_window.controller.treebook_width
|
136
|
+
end
|
137
|
+
|
138
|
+
def focussed_tree
|
139
|
+
focussed_window.treebook.focussed_tree
|
140
|
+
end
|
141
|
+
|
142
|
+
def default_treebook_width
|
143
|
+
Redcar.app.focussed_window.controller.default_treebook_width
|
144
|
+
end
|
145
|
+
|
146
|
+
def tree_with_title(title)
|
147
|
+
focussed_window.treebook.trees.detect {|t| t.tree_mirror.title == title }
|
148
|
+
end
|
149
|
+
|
150
|
+
def dialog(type)
|
151
|
+
dialogs.detect {|d| d.is_a?(type) }
|
152
|
+
end
|
153
|
+
|
154
|
+
def dialogs
|
155
|
+
Redcar::ApplicationSWT.display.get_shells.to_a.map do |s|
|
156
|
+
Redcar::ApplicationSWT.shell_dialogs[s]
|
157
|
+
end.compact
|
158
|
+
end
|
159
|
+
|
160
|
+
def visible_tree_items(tree, items = [])
|
161
|
+
tree.getItems.to_a.each do |item|
|
162
|
+
items << item
|
163
|
+
visible_tree_items(item, items) if item.expanded?
|
164
|
+
end
|
165
|
+
return items
|
166
|
+
end
|
167
|
+
|
168
|
+
def top_tree
|
169
|
+
tree = focussed_tree.controller.viewer.get_tree
|
170
|
+
tree.extend(TreeHelpers)
|
171
|
+
tree
|
172
|
+
end
|
173
|
+
|
174
|
+
def find_node_with_text(top, node_text)
|
175
|
+
node = top.detect { |node| node.text == node_text }
|
176
|
+
return node if node
|
177
|
+
all_children = top.map{ |node| node.children }.flatten
|
178
|
+
find_node_with_text(all_children, node_text) unless all_children.empty?
|
179
|
+
end
|
180
|
+
|
181
|
+
def swt_label_for_item(vtabitem)
|
182
|
+
vtablabel = vtabitem.instance_variable_get "@label"
|
183
|
+
vtablabel.instance_variable_get "@label"
|
184
|
+
end
|
185
|
+
|
186
|
+
module TreeHelpers
|
187
|
+
def items
|
188
|
+
getItems.to_a
|
189
|
+
end
|
190
|
+
|
191
|
+
def item_texts
|
192
|
+
getItems.to_a.map {|item| item.getText}
|
193
|
+
end
|
194
|
+
end
|
195
|
+
end
|
196
|
+
|
195
197
|
World(SwtHelper)
|
196
198
|
|
197
199
|
def close_everything
|