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,3 +1,6 @@
1
+ puts "loading edit_view env.rb"
2
+
3
+ require File.expand_path("../../../../application/features/support/env", __FILE__)
1
4
 
2
5
  module SwtTabHelpers
3
6
  def hide_toolbar
@@ -5,20 +8,6 @@ module SwtTabHelpers
5
8
  Redcar.app.refresh_toolbar!
6
9
  end
7
10
 
8
- def get_tab_folders(shell=active_shell)
9
- hide_toolbar
10
- right_composite = shell.children.to_a.last
11
- notebook_sash_form = right_composite.children.to_a[0]
12
- tab_folders = notebook_sash_form.children.to_a.select do |c|
13
- c.class == Java::OrgEclipseSwtCustom::CTabFolder
14
- end
15
- end
16
-
17
- def get_tab_folder
18
- get_tab_folders.length.should == 1
19
- get_tab_folders.first
20
- end
21
-
22
11
  def get_browser_contents
23
12
  live_document = "document.getElementsByTagName('html')[0].innerHTML"
24
13
  r = focussed_tab.html_view.controller.execute("return #{live_document};").join('')
@@ -46,14 +35,6 @@ module SwtTabHelpers
46
35
  def model_tabs
47
36
  Redcar.app.windows.first.notebooks.map{|n| n.tabs}.flatten
48
37
  end
49
-
50
38
  end
51
39
 
52
- World(SwtTabHelpers)
53
-
54
- def putsall
55
- p :all
56
- p Redcar.app.windows.first.notebooks
57
- p Redcar.app.windows.first.notebooks.first.tabs
58
- p Redcar.app.windows.first.notebooks.last.tabs
59
- end
40
+ World(SwtTabHelpers)
@@ -2,53 +2,52 @@ module Redcar
2
2
  class EditView
3
3
 
4
4
  class AlignAssignmentCommand < Redcar::DocumentCommand
5
+ OPERATORS = /(\|{0,2}[+-\/%*!&]?={1,3}[>~]?)/
6
+ RELEVANT_LINE_PATTERN = /^([^=]+?)#{OPERATORS}(.*$)/o
7
+
5
8
  def execute
6
- operators = /(\|{0,2}[+-\/%*!]?={1,3}[>~]?)/
7
- relevant_line_pattern = /^([^=]+?)#{operators}(.*$)/o
8
-
9
- #fix the selection. this command operates on whole lines
10
- start_offset, end_offset = offsets_for_whole_lines(doc.cursor_offset, doc.selection_offset)
11
-
12
- doc.set_selection_range(start_offset, end_offset)
13
-
14
- doc.replace_selection do |old_text|
15
-
16
- #get max left-hand and right-hand sides in 1 pass
17
- lengths = old_text.lines.map do |line|
18
- [line =~ operators || -1, $1 && $1.size || -1]
19
- end
20
- lhs_len = lengths.reduce(0){|memo, len| len.first > memo ? len.first : memo}
21
- rhs_len = lengths.reduce(0){|memo, len| len.last > memo ? len.last : memo}
22
-
23
- #now replace the first token of the relevant lines
24
- old_text.lines.map do |line|
25
- line.chomp!
26
- if line =~ relevant_line_pattern
27
- "%-#{lhs_len}s%#{rhs_len}s %s" % [$1, $2, $3.strip]
28
- else
29
- line
30
- end
31
- end.join("\n")
9
+ doc.expand_selection_to_full_lines
10
+ doc.replace_selection(&AlignAssignmentCommand.method(:align))
11
+ end
12
+
13
+ def self.align(text)
14
+ # get max left-hand and right-hand sides in 1 pass
15
+ lengths = text.lines.map do |line|
16
+ [line =~ OPERATORS || -1, $1 && $1.size || -1]
32
17
  end
18
+
19
+ lhs_len = lengths.reduce(0) { |memo, len| len.first > memo ? len.first : memo }
20
+ rhs_len = lengths.reduce(0) { |memo, len| len.last > memo ? len.last : memo }
21
+
22
+ # now replace the first token of the relevant lines
23
+ text.lines.map do |line|
24
+ line.chomp!
25
+ if line =~ RELEVANT_LINE_PATTERN
26
+ "%-#{lhs_len}s%#{rhs_len}s %s" % [$1, $2, $3.strip]
27
+ else
28
+ line
29
+ end
30
+ end.join("\n")
33
31
  end
34
32
 
35
- def offsets_for_whole_lines(start_offset, end_offset)
33
+ def adjust_selection_to_full_lines(start_offset, end_offset)
36
34
  #are the selections in the right order?
37
35
  if start_offset > end_offset
38
36
  end_offset, start_offset = start_offset, end_offset
39
37
  end
40
38
 
41
39
  start_index = doc.line_at_offset(start_offset)
42
- end_index = doc.line_at_offset(end_offset)
40
+ end_index = doc.line_at_offset(end_offset)
43
41
 
44
- #is the selection of the last line empty?
42
+ # is the selection of the last line empty?
45
43
  if end_offset == doc.offset_at_line(end_index)
46
44
  end_index -= 1
47
45
  end
48
46
 
49
47
  start_offset = doc.offset_at_line(start_index)
50
48
  end_offset = doc.offset_at_inner_end_of_line(end_index)
51
- return [start_offset, end_offset]
49
+
50
+ doc.set_selection_range(start_offset, end_offset)
52
51
  end
53
52
  end
54
53
  end
@@ -475,6 +475,29 @@ module Redcar
475
475
  def select_all
476
476
  set_selection_range(length, 0)
477
477
  end
478
+
479
+ # Ensures the selection runs from the start of a line to the end of that
480
+ # or another line, by widening it.
481
+ def expand_selection_to_full_lines
482
+ #are the selections in the right order?
483
+ start_offset, end_offset = cursor_offset, selection_offset
484
+ if start_offset > end_offset
485
+ end_offset, start_offset = start_offset, end_offset
486
+ end
487
+
488
+ start_index = line_at_offset(start_offset)
489
+ end_index = line_at_offset(end_offset)
490
+
491
+ # is the selection of the last line empty?
492
+ if end_offset == offset_at_line(end_index)
493
+ end_index -= 1
494
+ end
495
+
496
+ start_offset = offset_at_line(start_index)
497
+ end_offset = offset_at_inner_end_of_line(end_index)
498
+
499
+ set_selection_range(start_offset, end_offset)
500
+ end
478
501
 
479
502
  # Get the text selected by the user. If no text is selected
480
503
  # returns "".
@@ -0,0 +1,83 @@
1
+ require "spec_helper"
2
+
3
+ describe Redcar::EditView::AlignAssignmentCommand do
4
+
5
+ def check(starting, expected)
6
+ Redcar::EditView::AlignAssignmentCommand.align(starting.chomp).should == (expected).chomp
7
+ end
8
+
9
+ it "should align simple assignments" do
10
+ check(<<-END, <<-END2)
11
+ a = 4
12
+ bc = 5
13
+ d = 123
14
+ END
15
+ a = 4
16
+ bc = 5
17
+ d = 123
18
+ END2
19
+ end
20
+
21
+ it "should align simple indented assignments" do
22
+ check(<<-END, <<-END2)
23
+ a = 4
24
+ bc = 5
25
+ d = 123
26
+ END
27
+ a = 4
28
+ bc = 5
29
+ d = 123
30
+ END2
31
+ end
32
+
33
+ it "should align rows that have empty lines" do
34
+ check(<<-END, <<-END2)
35
+ a = 1
36
+
37
+ ab = 123
38
+ END
39
+ a = 1
40
+
41
+ ab = 123
42
+ END2
43
+ end
44
+
45
+ it "should align the right hand side" do
46
+ check(<<-END, <<-END2)
47
+ a = 1
48
+ bb = 2
49
+ ccc = 3
50
+ END
51
+ a = 1
52
+ bb = 2
53
+ ccc = 3
54
+ END2
55
+ end
56
+
57
+ it "should align different length operators" do
58
+ check(<<-END, <<-END2)
59
+ Integer === 1
60
+ two =~ /2/
61
+ @three||= 3333
62
+ bits &= 0b101010
63
+ END
64
+ Integer === 1
65
+ two =~ /2/
66
+ @three ||= 3333
67
+ bits &= 0b101010
68
+ END2
69
+ end
70
+
71
+ it "should align hashrockets" do
72
+ check(<<-END, <<-END2)
73
+ {:one => 1,
74
+ :two => 22,
75
+ :threee => 333}
76
+ END
77
+ {:one => 1,
78
+ :two => 22,
79
+ :threee => 333}
80
+ END2
81
+ end
82
+ end
83
+
@@ -1,5 +1,5 @@
1
1
 
2
- require File.join(File.dirname(__FILE__), %w".. .. spec_helper")
2
+ require "spec_helper"
3
3
 
4
4
  describe Redcar::Document::Indentation do
5
5
  class MockDoc
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), "..", "spec_helper")
1
+ require "spec_helper"
2
2
 
3
3
  describe Redcar::Document do
4
4
  class TestEditView
@@ -1,5 +1,2 @@
1
- $:.push File.join(File.dirname(__FILE__), '..', '..', '..', 'lib')
2
1
 
3
- require 'redcar'
4
- Redcar.environment = :test
5
- Redcar.load_unthreaded
2
+ Redcar.plugin_manager.load("edit_view")
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), "..", "spec_helper")
1
+ require "spec_helper"
2
2
 
3
3
  describe Redcar::EditViewSWT::WordMoveListener do
4
4
  before do
@@ -1,5 +1,2 @@
1
- $:.push File.join(File.dirname(__FILE__), '..', '..', '..', 'lib')
2
1
 
3
- require 'redcar'
4
- Redcar.environment = :test
5
- Redcar.load_unthreaded
2
+ Redcar.plugin_manager.load("edit_view_swt")
@@ -1 +1 @@
1
- <html><b>Hello!!</b></html>
1
+ <html>I see you!</html>
@@ -3,18 +3,13 @@ Then /^the HTML tab (should (not )?say|says) "([^"]*)"$/ do |_, negation, needle
3
3
  contents = nil
4
4
  started = false
5
5
 
6
- thread = Thread.new do
7
- started = true
8
- start = Time.now
9
- contents = get_browser_contents
10
- while !contents or (contents and !contents.match(needle)) && Time.now - start < limit
11
- contents = get_browser_contents
12
- sleep 0.1
13
- end
6
+ start = Time.now
7
+ contents = Swt.sync_exec { get_browser_contents }
8
+ while !contents or (contents and !contents.match(needle)) && Time.now - start < limit
9
+ contents = Swt.sync_exec { get_browser_contents }
10
+ sleep 0.1
14
11
  end
15
12
 
16
- Redcar.gui.yield_until { started && !thread.alive? }
17
-
18
13
  # For now, just skip on XUL platforms on which we can't get browser exec results
19
14
  # (current version of SWT and XulRunner). More info at:
20
15
  # https://bugs.eclipse.org/bugs/show_bug.cgi?id=259687
@@ -24,41 +19,47 @@ Then /^the HTML tab (should (not )?say|says) "([^"]*)"$/ do |_, negation, needle
24
19
  end
25
20
 
26
21
  When /^I click "([^\"]+)" in the HTML tab$/ do |link|
27
- html_view = focussed_tab.html_view
28
- # The JQuery way doesn't seem to work - I'm getting errors with this:
29
- # => html_view.controller.execute(%{ $("a:contains(#{link.gsub('"', '\"')})").click(); })
30
- # So, click the link the old-fashioned way.
31
- js = <<-JAVASCRIPT
32
- var link, evt, links, cancelled, i;
33
- links = document.getElementsByTagName("a");
34
- for (i = 0; i < links.length; i++) {
35
- if (links[i].innerHTML.search(#{link.inspect}) > -1) {
36
- link = links[i];
37
- break;
38
- }
39
- }
40
-
41
- if (typeof(link) !== "undefined") {
42
- if (document.createEvent) {
43
- evt = document.createEvent("MouseEvents");
44
- evt.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
45
- cancelled = !link.dispatchEvent(evt);
46
- } else if (link.fireEvent) {
47
- cancelled = !link.fireEvent("onclick");
22
+ Swt.sync_exec do
23
+ html_view = focussed_tab.html_view
24
+ # The JQuery way doesn't seem to work - I'm getting errors with this:
25
+ # => html_view.controller.execute(%{ $("a:contains(#{link.gsub('"', '\"')})").click(); })
26
+ # So, click the link the old-fashioned way.
27
+ js = <<-JAVASCRIPT
28
+ var link, evt, links, cancelled, i;
29
+ links = document.getElementsByTagName("a");
30
+ for (i = 0; i < links.length; i++) {
31
+ if (links[i].innerHTML.search(#{link.inspect}) > -1) {
32
+ link = links[i];
33
+ break;
34
+ }
48
35
  }
49
- if (!cancelled) {
50
- window.location = link.href;
36
+
37
+ if (typeof(link) !== "undefined") {
38
+ if (document.createEvent) {
39
+ evt = document.createEvent("MouseEvents");
40
+ evt.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
41
+ cancelled = !link.dispatchEvent(evt);
42
+ } else if (link.fireEvent) {
43
+ cancelled = !link.fireEvent("onclick");
44
+ }
45
+ if (!cancelled) {
46
+ window.location = link.href;
47
+ }
51
48
  }
52
- }
53
- JAVASCRIPT
54
-
55
- html_view.controller.execute(js)
49
+ JAVASCRIPT
50
+
51
+ html_view.controller.execute(js)
52
+ end
56
53
  end
57
54
 
58
55
  When /^I open the browser bar$/ do
59
- Redcar::HtmlView::ToggleBrowserBar.new.run
56
+ Swt.sync_exec do
57
+ Redcar::HtmlView::ToggleBrowserBar.new.run
58
+ end
60
59
  end
61
60
 
62
61
  When /^I open a web preview$/ do
63
- Redcar::HtmlView::ViewFileInWebBrowserCommand.new.run
62
+ Swt.sync_exec do
63
+ Redcar::HtmlView::ViewFileInWebBrowserCommand.new.run
64
+ end
64
65
  end
@@ -41,23 +41,25 @@ Feature: Syntax Checking for Java
41
41
  Then the tab should have annotations
42
42
  And the tab should have an annotation on line 2
43
43
 
44
- Scenario: A project can add libraries and compiled class directories to the java classpath
45
- When I will choose "plugins/java/features/fixtures" from the "open_directory" dialog
46
- And I open a directory
47
- And I replace the contents with "class Foo {\n Bar x = new Bar(10);\n FooBar y = new FooBar();\n}"
48
- And I save the tab
49
- And I wait "2.5" seconds
50
- Then the tab should not have annotations
44
+ # NOT without groovy it can't.
45
+ # TODO: remove java plugins dependency on groovy plugin, then uncomment these
46
+ # Scenario: A project can add libraries and compiled class directories to the java classpath
47
+ # When I will choose "plugins/java/features/fixtures" from the "open_directory" dialog
48
+ # And I open a directory
49
+ # And I replace the contents with "class Foo {\n Bar x = new Bar(10);\n FooBar y = new FooBar();\n}"
50
+ # And I save the tab
51
+ # And I wait "2.5" seconds
52
+ # Then the tab should not have annotations
51
53
 
52
- Scenario: If a project classpath.java file has syntax errors, there should be an error message and annotations
53
- And I close the focussed tab
54
- Given I have not suppressed syntax checking message dialogs
55
- When I will choose "plugins/java/features/fixtures" from the "open_directory" dialog
56
- And I open a directory
57
- And I have opened "plugins/java/features/fixtures/.redcar/classpath.groovy"
58
- And I replace the contents with "def x = 4\nsdef"
59
- And I save the tab
60
- Then I should see a message box containing "An error occurred while loading classpath file"
54
+ # Scenario: If a project classpath.java file has syntax errors, there should be an error message and annotations
55
+ # And I close the focussed tab
56
+ # Given I have not suppressed syntax checking message dialogs
57
+ # When I will choose "plugins/java/features/fixtures" from the "open_directory" dialog
58
+ # And I open a directory
59
+ # And I have opened "plugins/java/features/fixtures/.redcar/classpath.groovy"
60
+ # And I replace the contents with "def x = 4\nsdef"
61
+ # And I save the tab
62
+ # Then I should see a message box containing "An error occurred while loading classpath file"
61
63
 
62
64
  Scenario: If an error occurs while parsing a java file, there should be an error message
63
65
  Given I have not suppressed syntax checking message dialogs
@@ -1,23 +1,35 @@
1
1
  When /^I kill the line$/ do
2
- Redcar::LineTools::KillLineCommand.new.run(:env => {:edit_view => implicit_edit_view})
2
+ Swt.sync_exec do
3
+ Redcar::LineTools::KillLineCommand.new.run(:env => {:edit_view => implicit_edit_view})
4
+ end
3
5
  end
4
6
 
5
7
  When /^I trim the line$/ do
6
- Redcar::LineTools::TrimLineAfterCursorCommand.new.run(:env => {:edit_view => implicit_edit_view})
8
+ Swt.sync_exec do
9
+ Redcar::LineTools::TrimLineAfterCursorCommand.new.run(:env => {:edit_view => implicit_edit_view})
10
+ end
7
11
  end
8
12
 
9
13
  When /^I lower the text$/ do
10
- Redcar::LineTools::LowerTextCommand.new.run(:env => {:edit_view => implicit_edit_view})
14
+ Swt.sync_exec do
15
+ Redcar::LineTools::LowerTextCommand.new.run(:env => {:edit_view => implicit_edit_view})
16
+ end
11
17
  end
12
18
 
13
19
  When /^I raise the text$/ do
14
- Redcar::LineTools::RaiseTextCommand.new.run(:env => {:edit_view => implicit_edit_view})
20
+ Swt.sync_exec do
21
+ Redcar::LineTools::RaiseTextCommand.new.run(:env => {:edit_view => implicit_edit_view})
22
+ end
15
23
  end
16
24
 
17
25
  When /^I replace the line$/ do
18
- Redcar::LineTools::ReplaceLineCommand.new.run(:env => {:edit_view => implicit_edit_view})
26
+ Swt.sync_exec do
27
+ Redcar::LineTools::ReplaceLineCommand.new.run(:env => {:edit_view => implicit_edit_view})
28
+ end
19
29
  end
20
30
 
21
31
  When /^I clear the line$/ do
22
- Redcar::LineTools::ClearLineCommand.new.run(:env => {:edit_view => implicit_edit_view})
32
+ Swt.sync_exec do
33
+ Redcar::LineTools::ClearLineCommand.new.run(:env => {:edit_view => implicit_edit_view})
34
+ end
23
35
  end