redcar 0.10 → 0.11.0dev

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. data/CHANGES +14 -0
  2. data/Rakefile +68 -29
  3. data/lib/redcar.rb +2 -2
  4. data/plugins/application/lib/application/dialogs/filter_list_dialog.rb +2 -1
  5. data/plugins/application_swt/spec/application_swt/gradient_spec.rb +3 -12
  6. data/plugins/core/lib/core/resource.rb +13 -5
  7. data/plugins/document_search/features/find.feature +366 -214
  8. data/plugins/document_search/features/incremental_search.feature +351 -0
  9. data/plugins/document_search/features/replace.feature +16 -16
  10. data/plugins/document_search/features/step_definitions/find_steps.rb +16 -0
  11. data/plugins/document_search/features/support/env.rb +11 -0
  12. data/plugins/document_search/lib/document_search.rb +149 -109
  13. data/plugins/document_search/lib/document_search/commands.rb +251 -202
  14. data/plugins/document_search/lib/document_search/find_speedbar.rb +138 -81
  15. data/plugins/document_search/lib/document_search/incremental_search_speedbar.rb +70 -0
  16. data/plugins/document_search/lib/document_search/query_options.rb +15 -39
  17. data/plugins/document_search/plugin.rb +1 -1
  18. data/plugins/edit_view/features/step_definitions/editing_steps.rb +6 -2
  19. data/plugins/edit_view_swt/lib/edit_view_swt.rb +2 -2
  20. data/plugins/file_parser/lib/file_parser.rb +6 -1
  21. data/plugins/html_view/features/step_definitions/web_view_steps.rb +12 -0
  22. data/plugins/html_view/features/support/env.rb +16 -0
  23. data/plugins/html_view/lib/html_view.rb +5 -1
  24. data/plugins/line_tools/lib/line_tools.rb +16 -0
  25. data/plugins/project/features/find_file.feature +28 -0
  26. data/plugins/project/features/open_and_save_files.feature +11 -0
  27. data/plugins/project/features/step_definitions/file_steps.rb +6 -1
  28. data/plugins/project/features/support/env.rb +2 -0
  29. data/plugins/project/lib/project.rb +49 -6
  30. data/plugins/project/lib/project/commands.rb +18 -6
  31. data/plugins/project/lib/project/find_file_dialog.rb +19 -8
  32. data/plugins/project/lib/project/find_recent_dialog.rb +30 -0
  33. data/plugins/project/lib/project/manager.rb +41 -10
  34. data/plugins/project/lib/project/recent.rb +64 -0
  35. data/plugins/project/spec/fixtures/myproject/vendor/bar.rb +0 -0
  36. data/plugins/project/spec/fixtures/myproject/vendor/plugins/bar.rb +0 -0
  37. data/plugins/{find-in-project → project_search}/TODO.md +3 -3
  38. data/plugins/project_search/features/support/env.rb +6 -0
  39. data/plugins/project_search/features/word_search.feature +34 -0
  40. data/plugins/project_search/lib/project_search.rb +73 -0
  41. data/plugins/project_search/lib/project_search/binary_data_detector.rb +46 -0
  42. data/plugins/project_search/lib/project_search/commands.rb +62 -0
  43. data/plugins/project_search/lib/project_search/hit.rb +17 -0
  44. data/plugins/{find-in-project/lib/find_in_project → project_search/lib/project_search}/images/collapsed.png +0 -0
  45. data/plugins/{find-in-project/lib/find_in_project → project_search/lib/project_search}/images/expanded.png +0 -0
  46. data/plugins/{find-in-project/lib/find_in_project → project_search/lib/project_search}/images/spinner.gif +0 -0
  47. data/plugins/project_search/lib/project_search/lucene_index.rb +64 -0
  48. data/plugins/project_search/lib/project_search/lucene_refresh.rb +22 -0
  49. data/plugins/project_search/lib/project_search/project.rb +14 -0
  50. data/plugins/project_search/lib/project_search/query.rb +29 -0
  51. data/plugins/{find-in-project/lib/find_in_project → project_search/lib/project_search}/stylesheets/style.css +14 -3
  52. data/plugins/project_search/lib/project_search/views/_file.html.erb +60 -0
  53. data/plugins/{find-in-project/lib/find_in_project → project_search/lib/project_search}/views/index.html.erb +12 -9
  54. data/plugins/project_search/lib/project_search/word_search.rb +105 -0
  55. data/plugins/project_search/lib/project_search/word_search_controller.rb +207 -0
  56. data/plugins/project_search/plugin.rb +8 -0
  57. data/plugins/project_search/spec/fixtures/project/binary_file.bin +0 -0
  58. data/plugins/project_search/spec/fixtures/project/foo.txt +43 -0
  59. data/plugins/project_search/spec/fixtures/project/qux.rb +3 -0
  60. data/plugins/project_search/spec/project_search/binary_data_detector_spec.rb +24 -0
  61. data/plugins/project_search/spec/project_search/word_search_spec.rb +157 -0
  62. data/plugins/project_search/spec/spec_helper.rb +27 -0
  63. data/plugins/redcar/redcar.rb +77 -71
  64. data/plugins/ruby/lib/ruby/syntax_checker.rb +1 -1
  65. data/plugins/snippets/features/snippets.feature +12 -0
  66. data/plugins/snippets/lib/snippets/tab_handler.rb +1 -1
  67. metadata +46 -25
  68. data/plugins/document_search/features/find_and_replace.feature +0 -723
  69. data/plugins/document_search/lib/document_search/find_and_replace_speedbar.rb +0 -142
  70. data/plugins/find-in-project/lib/find_in_project.rb +0 -35
  71. data/plugins/find-in-project/lib/find_in_project/commands.rb +0 -30
  72. data/plugins/find-in-project/lib/find_in_project/controllers.rb +0 -170
  73. data/plugins/find-in-project/lib/find_in_project/views/_divider.html.erb +0 -4
  74. data/plugins/find-in-project/lib/find_in_project/views/_file_heading.html.erb +0 -10
  75. data/plugins/find-in-project/lib/find_in_project/views/_file_line.html.erb +0 -6
  76. data/plugins/find-in-project/plugin.rb +0 -11
  77. data/plugins/project/lib/project/recent_directories.rb +0 -54
@@ -1,102 +1,159 @@
1
- module DocumentSearch
2
- class FindSpeedbar < Redcar::Speedbar
3
- class << self
4
- attr_accessor :previous_query, :previous_options
5
- end
6
- @previous_query = ''
7
- @previous_options = QueryOptions.new
1
+ module Redcar
2
+ module DocumentSearch
3
+ class FindSpeedbar < Redcar::Speedbar
4
+ class << self
5
+ attr_accessor :previous_query, :previous_replace, :previous_options
6
+ end
7
+ @previous_query = ''
8
+ @previous_replace = ''
9
+ @previous_options = QueryOptions.new
8
10
 
9
- attr_accessor :initial_query
11
+ attr_accessor :initial_query
10
12
 
11
- def doc
12
- win = Redcar.app.focussed_window
13
- tab = win.focussed_notebook_tab
14
- tab.document if tab
15
- end
13
+ NotFoundMessage = 'Not found!'
16
14
 
17
- def after_draw
18
- FindSpeedbar.previous_query ||= ""
19
- self.query.value = @initial_query || FindSpeedbar.previous_query
20
- self.query_type.value = QueryOptions.query_type_to_text(
21
- FindSpeedbar.previous_options.query_type)
22
- self.match_case.value = FindSpeedbar.previous_options.match_case
23
- self.wrap_around.value = FindSpeedbar.previous_options.wrap_around
24
- self.query.edit_view.document.select_all
25
- end
15
+ ### UI DEFINITION ###
26
16
 
27
- label :label, "Find:"
28
- textbox :query do |value|
29
- if doc
30
- update_options_from_ui
31
- FindSpeedbar.find_incremental
17
+ # Override num_columns to control number of rows.
18
+ def num_columns
19
+ return 7
32
20
  end
33
- end
34
21
 
35
- combo :query_type, ["Plain", "Regex", "Glob"], "Plain" do |val|
36
- FindSpeedbar.previous_options.query_type = QueryOptions.query_type_to_symbol(val)
37
- update_options_from_ui
38
- FindSpeedbar.find_incremental
39
- end
22
+ label :label_find, 'Find:'
23
+ textbox :query do |val|
24
+ FindSpeedbar.previous_query = val
25
+ end
40
26
 
41
- toggle :match_case, 'Match case', nil, false do |val|
42
- FindSpeedbar.previous_options.match_case = val
43
- update_options_from_ui
44
- FindSpeedbar.find_incremental
45
- end
27
+ toggle :is_regex, 'Regex', nil, false do |val|
28
+ FindSpeedbar.previous_options.is_regex = val
29
+ end
46
30
 
47
- toggle :wrap_around, 'Wrap around', nil, true do |val|
48
- FindSpeedbar.previous_options.wrap_around = val
49
- update_options_from_ui
50
- FindSpeedbar.find_incremental
51
- end
31
+ toggle :match_case, 'Match case', nil, false do |val|
32
+ FindSpeedbar.previous_options.match_case = val
33
+ end
52
34
 
53
- button :previous, "Previous", "Alt+Return" do
54
- if doc
55
- update_options_from_ui
56
- FindSpeedbar.find_previous
35
+ toggle :wrap_around, 'Wrap around', nil, true do |val|
36
+ FindSpeedbar.previous_options.wrap_around = val
57
37
  end
58
- end
59
38
 
60
- button :next, "Next", "Return" do
61
- if doc
62
- update_options_from_ui
63
- FindSpeedbar.find_next
39
+ label :label_not_found, NotFoundMessage # Hack: Set label for sizing, clear in after_draw
40
+ label :label_space_end_row1, ""
41
+ label :label_spacer_start_row2, ""
42
+
43
+ label :label_replace, 'Replace:'
44
+ textbox :replace do |val|
45
+ FindSpeedbar.previous_replace = val
64
46
  end
65
- end
66
47
 
67
- def update_options_from_ui
68
- if doc and self.query.value and self.query.value != ""
69
- FindSpeedbar.previous_query = self.query.value
70
- FindSpeedbar.previous_options.query_type =
71
- QueryOptions.query_type_to_symbol(self.query_type.value)
72
- FindSpeedbar.previous_options.match_case = self.match_case.value
73
- FindSpeedbar.previous_options.wrap_around = self.wrap_around.value
48
+ button :replace_find, 'Replace && Find', 'Alt+Return' do
49
+ FindSpeedbar.replace_and_find(
50
+ FindSpeedbar.previous_query,
51
+ FindSpeedbar.previous_replace,
52
+ FindSpeedbar.previous_options) or not_found
74
53
  end
75
- end
76
54
 
77
- def self.find_incremental
78
- cmd = FindIncrementalCommand.new(FindSpeedbar.previous_query, FindSpeedbar.previous_options)
79
- cmd.run(:env => {:edit_view => Redcar::EditView.focussed_tab_edit_view})
80
- end
55
+ button :replace_all, 'Replace All', nil do
56
+ FindSpeedbar.replace_all(
57
+ FindSpeedbar.previous_query,
58
+ FindSpeedbar.previous_replace,
59
+ FindSpeedbar.previous_options) or not_found
60
+ end
81
61
 
82
- def self.find_next
83
- cmd = FindNextCommand.new(FindSpeedbar.previous_query, FindSpeedbar.previous_options)
84
- cmd.run(:env => {:edit_view => Redcar::EditView.focussed_tab_edit_view})
85
- end
62
+ button :replace_all_in_selection, 'Replace in Selection', nil do
63
+ FindSpeedbar.replace_all_in_selection(
64
+ FindSpeedbar.previous_query,
65
+ FindSpeedbar.previous_replace,
66
+ FindSpeedbar.previous_options) or not_found
67
+ end
86
68
 
87
- def self.find_previous
88
- cmd = FindPreviousCommand.new(FindSpeedbar.previous_query, FindSpeedbar.previous_options)
89
- cmd.run(:env => {:edit_view => Redcar::EditView.focussed_tab_edit_view})
90
- end
69
+ button :find_previous, 'Previous', 'Shift+Return' do
70
+ FindSpeedbar.find_previous or not_found
71
+ end
72
+
73
+ button :find_next, 'Next', 'Return' do
74
+ FindSpeedbar.find_next or not_found
75
+ end
76
+
77
+ ### UI OPERATIONS ###
78
+
79
+ # Initializes UI elements.
80
+ def after_draw
81
+ clear_not_found
82
+ # If the current selection (from @initial_query) is equal to previous_replace, we ignore
83
+ # that selection and just use the previous value for the query.
84
+ #
85
+ # This is especially important in the following command sequence: Select; Use selection for
86
+ # query; Select; Use selection for replace; Open Find speedbar. Without the fix, the prior
87
+ # selection for the query gets overwritten with the current selection, which is annoying and
88
+ # useless.
89
+ if ((FindSpeedbar.previous_replace.length > 0) &&
90
+ (@initial_query == FindSpeedbar.previous_replace))
91
+ self.query.value = FindSpeedbar.previous_query
92
+ else
93
+ self.query.value = @initial_query || FindSpeedbar.previous_query
94
+ end
95
+ self.replace.value = FindSpeedbar.previous_replace || ""
96
+ self.is_regex.value = FindSpeedbar.previous_options.is_regex
97
+ self.match_case.value = FindSpeedbar.previous_options.match_case
98
+ self.wrap_around.value = FindSpeedbar.previous_options.wrap_around
99
+ self.query.edit_view.document.select_all
100
+ end
101
+
102
+ # Sets the "Not found" label message, invoking the system beep.
103
+ def not_found
104
+ Swt::Widgets::Display.get_current.beep
105
+ self.label_not_found.text = NotFoundMessage
106
+ end
107
+
108
+ # Clears the "Not found" label message.
109
+ def clear_not_found
110
+ self.label_not_found.text = ''
111
+ end
112
+
113
+ ### COMMANDS ###
114
+
115
+ def self.find_next
116
+ cmd = FindNextCommand.new(FindSpeedbar.previous_query, FindSpeedbar.previous_options)
117
+ cmd.run(:env => {:edit_view => Redcar::EditView.focussed_tab_edit_view})
118
+ end
119
+
120
+ def self.find_previous
121
+ cmd = FindPreviousCommand.new(FindSpeedbar.previous_query, FindSpeedbar.previous_options)
122
+ cmd.run(:env => {:edit_view => Redcar::EditView.focussed_tab_edit_view})
123
+ end
124
+
125
+ # Note: The assumption that we set find only from selected text means we don't have to update
126
+ # search.
127
+ def self.use_selection_for_find(doc, active_speedbar=nil)
128
+ return unless doc.selection?
129
+ FindSpeedbar.previous_query = doc.selected_text
130
+ if active_speedbar && (active_speedbar.is_a? FindSpeedbar)
131
+ active_speedbar.query.value = FindSpeedbar.previous_query
132
+ end
133
+ end
134
+
135
+ def self.replace_and_find(query, replace, options)
136
+ cmd = ReplaceAndFindCommand.new(query, replace, options)
137
+ cmd.run(:env => {:edit_view => Redcar::EditView.focussed_tab_edit_view})
138
+ end
139
+
140
+ def self.replace_all(query, replace, options)
141
+ cmd = ReplaceAllCommand.new(query, replace, options, false)
142
+ cmd.run(:env => {:edit_view => Redcar::EditView.focussed_tab_edit_view})
143
+ end
144
+
145
+ def self.replace_all_in_selection(query, replace, options)
146
+ cmd = ReplaceAllCommand.new(query, replace, options, true)
147
+ cmd.run(:env => {:edit_view => Redcar::EditView.focussed_tab_edit_view})
148
+ end
91
149
 
92
- # Note: The assumption that we set find only from selected text means we don't have to update
93
- # search.
94
- def self.use_selection_for_find(doc, active_speedbar=nil)
95
- return unless doc.selection?
96
- FindSpeedbar.previous_query = doc.selected_text
97
- if active_speedbar
98
- active_speedbar.query.value = FindSpeedbar.previous_query
150
+ def self.use_selection_for_replace(doc, active_speedbar=nil)
151
+ return unless doc.selection?
152
+ FindSpeedbar.previous_replace = doc.selected_text
153
+ if active_speedbar && (active_speedbar.instance_of? FindSpeedbar)
154
+ active_speedbar.replace.value = FindSpeedbar.previous_replace
155
+ end
99
156
  end
100
157
  end
101
158
  end
102
- end
159
+ end
@@ -0,0 +1,70 @@
1
+ module Redcar
2
+ module DocumentSearch
3
+ class IncrementalSearchSpeedbar < Redcar::Speedbar
4
+ class << self
5
+ attr_accessor :previous_query, :previous_options
6
+ end
7
+ @previous_query = ''
8
+ @previous_options = QueryOptions.new
9
+
10
+ ### UI ###
11
+
12
+ label :label, 'Find:'
13
+ textbox :query do |value|
14
+ # Check to avoid multiple searches from duplicate text update events.
15
+ if IncrementalSearchSpeedbar.previous_query != self.query.value
16
+ IncrementalSearchSpeedbar.previous_query = self.query.value
17
+ IncrementalSearchSpeedbar.find_incremental
18
+ end
19
+ end
20
+
21
+ toggle :is_regex, 'Regex', nil, false do |val|
22
+ IncrementalSearchSpeedbar.previous_options.is_regex = val
23
+ IncrementalSearchSpeedbar.find_incremental
24
+ end
25
+
26
+ toggle :match_case, 'Match case', nil, false do |val|
27
+ IncrementalSearchSpeedbar.previous_options.match_case = val
28
+ IncrementalSearchSpeedbar.find_incremental
29
+ end
30
+
31
+ toggle :wrap_around, 'Wrap around', nil, true do |val|
32
+ IncrementalSearchSpeedbar.previous_options.wrap_around = val
33
+ IncrementalSearchSpeedbar.find_incremental
34
+ end
35
+
36
+ def after_draw
37
+ IncrementalSearchSpeedbar.previous_query ||= ""
38
+ self.query.value = IncrementalSearchSpeedbar.previous_query
39
+ self.is_regex.value = IncrementalSearchSpeedbar.previous_options.is_regex
40
+ self.match_case.value = IncrementalSearchSpeedbar.previous_options.match_case
41
+ self.wrap_around.value = IncrementalSearchSpeedbar.previous_options.wrap_around
42
+ self.query.edit_view.document.select_all
43
+ end
44
+
45
+ ### COMMANDS ###
46
+
47
+ def self.find_incremental
48
+ cmd = FindNextCommand.new(
49
+ IncrementalSearchSpeedbar.previous_query,
50
+ IncrementalSearchSpeedbar.previous_options,
51
+ always_start_within_selection=true)
52
+ cmd.run(:env => {:edit_view => Redcar::EditView.focussed_tab_edit_view})
53
+ end
54
+
55
+ def self.find_next
56
+ cmd = FindNextCommand.new(
57
+ IncrementalSearchSpeedbar.previous_query,
58
+ IncrementalSearchSpeedbar.previous_options)
59
+ cmd.run(:env => {:edit_view => Redcar::EditView.focussed_tab_edit_view})
60
+ end
61
+
62
+ def self.find_previous
63
+ cmd = FindPreviousCommand.new(
64
+ IncrementalSearchSpeedbar.previous_query,
65
+ IncrementalSearchSpeedbar.previous_options)
66
+ cmd.run(:env => {:edit_view => Redcar::EditView.focussed_tab_edit_view})
67
+ end
68
+ end
69
+ end
70
+ end
@@ -1,44 +1,20 @@
1
- module DocumentSearch
2
- # Encapsulates options for search queries.
3
- class QueryOptions
4
- attr_accessor :query_type
5
- attr_accessor :match_case
6
- attr_accessor :wrap_around
1
+ module Redcar
2
+ module DocumentSearch
3
+ # Encapsulates options for search queries.
4
+ class QueryOptions
5
+ attr_accessor :is_regex
6
+ attr_accessor :match_case
7
+ attr_accessor :wrap_around
7
8
 
8
- # Initializes with default options.
9
- def initialize
10
- @query_type = :query_plain
11
- @match_case = false
12
- @wrap_around = true
13
- end
14
-
15
- ### UTILITY ###
16
-
17
- # Maps a search type combo box value to the corresponding search type symbol.
18
- def self.query_type_to_symbol(query_type_text)
19
- case query_type_text
20
- when "Plain"
21
- :query_plain
22
- when "Regex"
23
- :query_regex
24
- when "Glob"
25
- :query_glob
26
- else
27
- raise "Invalid query type: #{query_type_text}"
28
- end
29
- end
9
+ DEFAULT_IS_REGEX = false
10
+ DEFAULT_MATCH_CASE = false
11
+ DEFAULT_WRAP_AROUND = true
30
12
 
31
- # Maps a search type symbol to a text value for the search type combo box.
32
- def self.query_type_to_text(query_type_symbol)
33
- case query_type_symbol
34
- when :query_plain
35
- 'Plain'
36
- when :query_regex
37
- 'Regex'
38
- when :query_glob
39
- 'Glob'
40
- else
41
- raise "Invalid query type symbol: #{query_type_symbol}"
13
+ # Initializes with default options.
14
+ def initialize
15
+ @is_regex = DEFAULT_IS_REGEX
16
+ @match_case = DEFAULT_MATCH_CASE
17
+ @wrap_around = DEFAULT_WRAP_AROUND
42
18
  end
43
19
  end
44
20
  end
@@ -3,6 +3,6 @@ Plugin.define do
3
3
  name "document_search"
4
4
  version "1.0"
5
5
  file "lib", "document_search"
6
- object "DocumentSearch"
6
+ object "Redcar::DocumentSearch"
7
7
  dependencies "edit_view", ">0"
8
8
  end
@@ -108,7 +108,7 @@ When /^I press the Backspace key in the edit tab$/ do
108
108
  edit_view.backspace_pressed([])
109
109
  end
110
110
 
111
- Then /^the contents should be "(.*)"$/ do |text|
111
+ Then /^the contents should (not )?be "(.*)"$/ do |negative,text|
112
112
  expected = unescape_text(text)
113
113
  doc = Redcar::EditView.focussed_edit_view_document
114
114
  actual = doc.to_s
@@ -121,7 +121,11 @@ Then /^the contents should be "(.*)"$/ do |text|
121
121
  end
122
122
  actual = actual.insert(actual.char_offset_to_byte_offset(char_seloff), "<s>") unless char_curoff == char_seloff
123
123
  end
124
- actual.should == expected
124
+ if negative
125
+ actual.should_not == expected
126
+ else
127
+ actual.should == expected
128
+ end
125
129
  end
126
130
 
127
131
  Then /^the contents of the edit tab should be "(.*)"$/ do |text|
@@ -195,7 +195,7 @@ module Redcar
195
195
  end
196
196
 
197
197
  def create_undo_manager
198
- @undo_manager = JFace::Text::TextViewerUndoManager.new(500)
198
+ @undo_manager = JFace::Text::TextViewerUndoManager.new(5000)
199
199
  @undo_manager.connect(@mate_text.viewer)
200
200
  end
201
201
 
@@ -527,7 +527,7 @@ module Redcar
527
527
  def biggest_visible_line
528
528
  @mate_text.viewer.get_bottom_index
529
529
  end
530
-
530
+
531
531
  def ensure_visible(offset)
532
532
  line = @document.line_at_offset(offset)
533
533
  line_start_offset = @document.offset_at_line(line)
@@ -21,6 +21,11 @@ module Redcar
21
21
  self.skip_types = options['skip_types'] || [:executable, :mountpoint, :symlink, :zero]
22
22
  end
23
23
 
24
+ def directory?(pathname)
25
+ f = java.io.File.new(pathname.path.to_java)
26
+ f.directory?
27
+ end
28
+
24
29
  def each_file(&block)
25
30
  file_index, excluded_paths = 0, []
26
31
  structure = Dir.glob("#{root_path}/**/*", File::FNM_DOTMATCH)
@@ -29,7 +34,7 @@ module Redcar
29
34
  next if excluded_paths.any? { |ep| fullpath =~ /^#{Regexp.escape(ep)}(\/|$)/ }
30
35
  path = Pathname.new(fullpath)
31
36
  is_excluded_pattern = excluded_patterns.any? { |pattern| fullpath =~ pattern }
32
- if path.directory?
37
+ if directory?(path)
33
38
  excluded_paths << path if excluded_dirs.include?(path.basename.to_s) || is_excluded_pattern
34
39
  else
35
40
  skipped = skip_types.find { |st| path.send("#{st}?") }
@@ -0,0 +1,12 @@
1
+
2
+ Then /I should see "(.*)" in the web view/ do |expected|
3
+ body.include?(expected)
4
+ end
5
+
6
+ Given /^I fill in "(.*)" with "(.*)" in the web view$/ do |field, value|
7
+ fill_in(field, :with => value)
8
+ end
9
+
10
+ When /I press "(.*)" in the web view/ do |button_name|
11
+ click_button(button_name)
12
+ end