redcar 0.7 → 0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (131) hide show
  1. data/CHANGES +42 -0
  2. data/README.md +5 -3
  3. data/Rakefile +39 -81
  4. data/bin/redcar +1 -1
  5. data/lib/redcar.rb +9 -6
  6. data/lib/redcar/installer.rb +1 -1
  7. data/lib/redcar/ruby_extensions.rb +19 -0
  8. data/lib/redcar/runner.rb +1 -1
  9. data/lib/redcar/usage.rb +3 -0
  10. data/lib/redcar_quick_start.rb +11 -11
  11. data/plugins/application/features/step_definitions/tree_steps.rb +22 -5
  12. data/plugins/application/features/step_definitions/window_steps.rb +9 -1
  13. data/plugins/application/features/support/env.rb +5 -2
  14. data/plugins/application/lib/application.rb +51 -46
  15. data/plugins/application/lib/application/window.rb +60 -30
  16. data/plugins/application_swt/lib/application_swt.rb +16 -16
  17. data/plugins/application_swt/lib/application_swt/window.rb +35 -7
  18. data/plugins/auto_completer/features/support/env.rb +0 -2
  19. data/plugins/auto_indenter/features/support/env.rb +0 -1
  20. data/plugins/auto_pairer/features/auto_pairer.feature +50 -45
  21. data/plugins/auto_pairer/features/support/env.rb +0 -1
  22. data/plugins/auto_pairer/lib/auto_pairer/document_controller.rb +11 -6
  23. data/plugins/clipboard-viewer/Screenshot.png +0 -0
  24. data/plugins/clipboard-viewer/lib/clipboard_viewer.rb +50 -0
  25. data/plugins/clipboard-viewer/lib/clipboard_viewer/browser_controller.rb +27 -0
  26. data/plugins/clipboard-viewer/lib/clipboard_viewer/clipboard_bar.rb +67 -0
  27. data/plugins/clipboard-viewer/plugin.rb +9 -0
  28. data/plugins/clipboard-viewer/views/clipboard.html.erb +15 -0
  29. data/plugins/clipboard-viewer/views/default.css +43 -0
  30. data/plugins/clipboard-viewer/views/redcar_small_icon.png +0 -0
  31. data/plugins/comment/features/line_comment.feature +137 -0
  32. data/plugins/comment/features/selection_comment.feature +21 -0
  33. data/plugins/comment/features/step_definitions/comment_steps.rb +7 -0
  34. data/plugins/comment/lib/comment.rb +266 -0
  35. data/plugins/comment/plugin.rb +7 -0
  36. data/plugins/comment/vendor/comment_lib.json +47 -0
  37. data/plugins/declarations/lib/declarations.rb +1 -1
  38. data/plugins/document_search/features/replace.feature +10 -2
  39. data/plugins/document_search/features/support/env.rb +0 -1
  40. data/plugins/document_search/lib/document_search.rb +4 -1
  41. data/plugins/document_search/lib/document_search/replace.rb +11 -3
  42. data/plugins/document_search/lib/document_search/search_and_replace.rb +5 -2
  43. data/plugins/edit_view/features/case_change.feature +9 -9
  44. data/plugins/edit_view/features/cursor_navigation.feature +36 -0
  45. data/plugins/edit_view/features/step_definitions/editing_steps.rb +63 -8
  46. data/plugins/edit_view/features/step_definitions/notebook_steps.rb +2 -0
  47. data/plugins/edit_view/features/step_definitions/tab_steps.rb +8 -5
  48. data/plugins/edit_view/features/support/env.rb +8 -2
  49. data/plugins/edit_view/lib/edit_view.rb +16 -1
  50. data/plugins/edit_view/lib/edit_view/actions/cmd_enter.rb +11 -0
  51. data/plugins/edit_view/lib/edit_view/document.rb +27 -10
  52. data/plugins/edit_view/lib/edit_view/edit_tab.rb +17 -4
  53. data/plugins/edit_view/spec/edit_view/document_spec.rb +3 -0
  54. data/plugins/edit_view_swt/lib/edit_view_swt.rb +42 -3
  55. data/plugins/edit_view_swt/lib/edit_view_swt/word_movement.rb +17 -15
  56. data/plugins/help/lib/help.rb +40 -0
  57. data/plugins/help/plugin.rb +8 -0
  58. data/plugins/html_view/features/step_definitions/html_view_steps.rb +6 -4
  59. data/plugins/line_tools/features/support/env.rb +0 -1
  60. data/plugins/macros/features/step_definitions/macro_steps.rb +0 -55
  61. data/plugins/macros/features/support/env.rb +0 -2
  62. data/plugins/open_default_app/lib/open_default_app.rb +35 -0
  63. data/plugins/open_default_app/plugin.rb +8 -0
  64. data/plugins/open_default_app/screenshot.png +0 -0
  65. data/plugins/plugin_manager_ui/lib/plugin_manager_ui.rb +17 -3
  66. data/plugins/project/features/find_file.feature +3 -2
  67. data/plugins/project/features/highlight_focussed_tab.feature +8 -0
  68. data/plugins/project/features/move_and_rename_files.feature +25 -0
  69. data/plugins/project/features/open_and_save_files.feature +10 -1
  70. data/plugins/project/features/open_directory_tree.feature +32 -2
  71. data/plugins/project/features/step_definitions/directory_steps.rb +17 -0
  72. data/plugins/project/features/step_definitions/project_tree_steps.rb +3 -0
  73. data/plugins/project/features/sub_project.feature +14 -0
  74. data/plugins/project/features/support/env.rb +22 -3
  75. data/plugins/project/features/watch_for_modified_files.feature +32 -9
  76. data/plugins/project/lib/project.rb +53 -21
  77. data/plugins/project/lib/project/adapters/local.rb +21 -16
  78. data/plugins/project/lib/project/adapters/remote.rb +15 -13
  79. data/plugins/project/lib/project/commands.rb +37 -16
  80. data/plugins/project/lib/project/dir_controller.rb +41 -42
  81. data/plugins/project/lib/project/drb_service.rb +35 -21
  82. data/plugins/project/lib/project/file_list.rb +7 -1
  83. data/plugins/project/lib/project/manager.rb +28 -3
  84. data/plugins/project/lib/project/sub_project.rb +17 -0
  85. data/plugins/project/lib/project/support/recycle.js +2 -0
  86. data/plugins/project/lib/project/support/trash.rb +72 -0
  87. data/plugins/project/spec/fixtures/multi-byte-files/a/341/204/200/341/205/247/341/206/274/341/204/205/341/205/251/foo +1 -0
  88. data/plugins/project/spec/fixtures/multi-byte-files//341/204/220/341/205/246/341/204/211/341/205/263/341/204/220/341/205/263.py +1 -0
  89. data/plugins/project/spec/project/file_list_spec.rb +4 -0
  90. data/plugins/redcar/features/goto_line_command.feature +20 -0
  91. data/plugins/redcar/redcar.rb +107 -47
  92. data/plugins/repl/lib/repl.rb +20 -20
  93. data/plugins/repl/lib/repl/clojure_mirror.rb +50 -58
  94. data/plugins/repl/lib/repl/groovy_mirror.rb +22 -41
  95. data/plugins/repl/lib/repl/repl_mirror.rb +85 -14
  96. data/plugins/repl/lib/repl/ruby_mirror.rb +12 -39
  97. data/plugins/repl/spec/repl/groovy_mirror_spec.rb +1 -1
  98. data/plugins/repl/spec/repl/ruby_mirror_spec.rb +12 -12
  99. data/plugins/ruby/README +6 -0
  100. data/plugins/ruby/lib/syntax_check/ruby.rb +28 -0
  101. data/plugins/ruby/plugin.rb +7 -0
  102. data/plugins/runnables/features/command_tree.feature +9 -0
  103. data/plugins/runnables/features/file_runner_input.feature +20 -0
  104. data/plugins/runnables/features/run_alternate_command.feature +14 -0
  105. data/plugins/runnables/features/support/env.rb +42 -5
  106. data/plugins/runnables/lib/runnables.rb +67 -21
  107. data/plugins/runnables/lib/runnables/commands.rb +35 -18
  108. data/plugins/runnables/lib/runnables/tree_mirror/nodes/runnable_group.rb +23 -37
  109. data/plugins/runnables/lib/runnables/tree_mirror/nodes/runnable_type_group.rb +16 -18
  110. data/plugins/scm_svn/features/support/env.rb +0 -3
  111. data/plugins/snippets/features/snippets.feature +17 -2
  112. data/plugins/snippets/features/support/env.rb +0 -1
  113. data/plugins/snippets/lib/snippets/tab_handler.rb +51 -18
  114. data/plugins/swt/lib/swt/cucumber_patches.rb +13 -68
  115. data/plugins/swt/lib/swt/cucumber_runner.rb +2 -3
  116. data/plugins/syntax_check/README +6 -0
  117. data/plugins/syntax_check/lib/syntax_check.rb +16 -0
  118. data/plugins/syntax_check/lib/syntax_check/checker.rb +47 -0
  119. data/plugins/syntax_check/lib/syntax_check/error.rb +23 -0
  120. data/plugins/syntax_check/plugin.rb +7 -0
  121. data/plugins/tree_view_swt/lib/tree_view_swt.rb +6 -0
  122. data/plugins/web_bookmarks/Screenshot.png +0 -0
  123. data/plugins/web_bookmarks/lib/web_bookmarks.rb +42 -0
  124. data/plugins/web_bookmarks/lib/web_bookmarks/bookmark.rb +43 -0
  125. data/plugins/web_bookmarks/lib/web_bookmarks/browser_bar.rb +70 -0
  126. data/plugins/web_bookmarks/lib/web_bookmarks/commands.rb +111 -0
  127. data/plugins/web_bookmarks/lib/web_bookmarks/tree.rb +67 -0
  128. data/plugins/web_bookmarks/lib/web_bookmarks/view_controller.rb +22 -0
  129. data/plugins/web_bookmarks/plugin.rb +11 -0
  130. data/plugins/web_bookmarks/views/index.html.erb +5 -0
  131. metadata +60 -10
@@ -0,0 +1,11 @@
1
+ module Redcar
2
+ class EditView
3
+ module Actions
4
+ class CmdEnterHandler
5
+ def self.handle(edit_view, modifiers)
6
+ Redcar::Top::MoveNextLineCommand.new.run
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -62,20 +62,29 @@ module Redcar
62
62
  @controllers.values.flatten.uniq
63
63
  end
64
64
  end
65
-
66
- def save!
67
- # Call the before_save callback on any plugins that need it
68
- #
69
- # Pass self as an argument since plugins that use before_save
70
- # will most likely need access to the document being saved.
65
+
66
+ # Call the before_save and after_save callbacks on any plugins that need it
67
+ #
68
+ # Pass self as an argument since plugins that use before_save
69
+ # will most likely need access to the document being saved.
70
+ def between_save_hooks
71
71
  Redcar.plugin_manager.objects_implementing(:before_save).each do |object|
72
72
  object.before_save(self)
73
73
  end
74
- @mirror.commit(to_s)
75
- @edit_view.reset_last_checked
76
- set_modified(false)
74
+ yield
75
+ Redcar.plugin_manager.objects_implementing(:after_save).each do |object|
76
+ object.after_save(self)
77
+ end
77
78
  end
78
-
79
+
80
+ def save!
81
+ between_save_hooks do
82
+ @mirror.commit(to_s)
83
+ @edit_view.reset_last_checked
84
+ set_modified(false)
85
+ end
86
+ end
87
+
79
88
  def modified?
80
89
  @modified
81
90
  end
@@ -441,10 +450,18 @@ module Redcar
441
450
  controller.selection_offset
442
451
  end
443
452
 
453
+ def selection_offset=(value)
454
+ set_selection_range(cursor_offset, value)
455
+ end
456
+
444
457
  def selection_line
445
458
  line_at_offset(selection_offset)
446
459
  end
447
460
 
461
+ def selection_line_offset
462
+ selection_offset - offset_at_line(selection_line)
463
+ end
464
+
448
465
  # Set the range of text selected by the user.
449
466
  #
450
467
  # @param [Integer] cursor_offset
@@ -1,13 +1,26 @@
1
1
  module Redcar
2
2
  class EditTab < Tab
3
-
3
+
4
4
  attr_reader :edit_view
5
-
5
+
6
6
  def initialize(*args)
7
7
  super
8
8
  create_edit_view
9
9
  end
10
-
10
+
11
+ def update_for_file_changes
12
+ old_icon = @icon
13
+ doc = @edit_view.document
14
+ if doc and doc.path
15
+ if File.exists?(doc.path)
16
+ @icon = :file if icon == :exclamation
17
+ else
18
+ @icon = :exclamation
19
+ end
20
+ end
21
+ notify_listeners(:changed_icon, @icon) if old_icon != @icon
22
+ end
23
+
11
24
  def create_edit_view
12
25
  @edit_view = Redcar::EditView.new
13
26
  @edit_view.add_listener(:focussed, &method(:edit_view_focussed))
@@ -15,7 +28,7 @@ module Redcar
15
28
  @edit_view.document.add_listener(:selection_range_changed) { notify_listeners(:selection_changed) }
16
29
  @edit_view.add_listener(:title_changed) { |newt| self.title = newt }
17
30
  end
18
-
31
+
19
32
  def edit_view_focussed
20
33
  notify_listeners(:focus)
21
34
  end
@@ -9,6 +9,9 @@ describe Redcar::Document do
9
9
  def reset_last_checked
10
10
  end
11
11
 
12
+ def remove_all_annotations(o = nil); end
13
+ def grammar; end
14
+
12
15
  def controller
13
16
  o = Object.new
14
17
  def o.method_missing(*_)
@@ -147,7 +147,7 @@ module Redcar
147
147
  action = st.getKeyBinding(event.character | event.stateMask)
148
148
  if (action == Swt::SWT::NULL)
149
149
  # see if we have a control character
150
- if ((event.stateMask & SWT.CTRL) != 0 && event.character <= 31)
150
+ if ((event.stateMask & Swt::SWT::CTRL) != 0 && event.character <= 31)
151
151
  # get the character from the CTRL+char sequence, the control
152
152
  # key subtracts 64 from the value of the key that it modifies
153
153
  c = event.character + 64
@@ -201,12 +201,19 @@ module Redcar
201
201
 
202
202
  def undo
203
203
  @undo_manager.undo
204
+ unless @undo_manager.undoable?
205
+ @undoable_override = false
206
+ end
204
207
  EditView.undo_sensitivity.recompute
205
208
  EditView.redo_sensitivity.recompute
206
209
  end
207
210
 
208
211
  def undoable?
209
- @undo_manager.undoable
212
+ # The override malarky is because the JFace::TextViewerUndoManager doesn't
213
+ # recognize that typing while in Block Selection mode makes the edit view
214
+ # undoable. (Even though it faithfully records the actions, and responds
215
+ # correctly to "undo".) So we override the undo manager for this case.
216
+ @undoable_override || @undo_manager.undoable
210
217
  end
211
218
 
212
219
  def redo
@@ -221,6 +228,7 @@ module Redcar
221
228
 
222
229
  def reset_undo
223
230
  @undo_manager.reset
231
+ @undoable_override = false
224
232
  end
225
233
 
226
234
  def compound
@@ -237,6 +245,19 @@ module Redcar
237
245
  @undo_manager.end_compound_change
238
246
  end
239
247
 
248
+ def annotations(options = nil)
249
+ return @mate_text.annotations unless options
250
+ if options[:line]
251
+ @mate_text.annotationsOnLine(line + 1)
252
+ elsif options[:type]
253
+ annotations_of_type(options[:type])
254
+ end
255
+ end
256
+
257
+ def annotations_of_type(type)
258
+ annotations.select {|a| a.type == type }
259
+ end
260
+
240
261
  def add_annotation_type(name, image_path, rgb)
241
262
  rgb = Swt::Graphics::RGB.new(rgb[0], rgb[1], rgb[2])
242
263
  @mate_text.addAnnotationType(name, image_path, rgb)
@@ -246,6 +267,17 @@ module Redcar
246
267
  @mate_text.addAnnotation(annotation_name, line, text, start, length)
247
268
  end
248
269
 
270
+ def remove_annotation(mate_annotation)
271
+ @mate_text.removeAnnotation(mate_annotation)
272
+ end
273
+
274
+ def remove_all_annotations(options = nil)
275
+ return @mate_text.remove_all_annotations unless options
276
+ annotations(options).each do |ann|
277
+ remove_annotation(ann)
278
+ end
279
+ end
280
+
249
281
  def create_document
250
282
  @document = EditViewSWT::Document.new(@model.document, @mate_text.mate_document)
251
283
  @model.document.controller = @document
@@ -281,6 +313,9 @@ module Redcar
281
313
  @mate_text.set_margin_column(-1)
282
314
  end
283
315
  end
316
+ h13 = @model.document.add_listener(:changed) do
317
+ @undoable_override = true
318
+ end
284
319
  @mate_text.getTextWidget.addMouseListener(MouseListener.new(self))
285
320
  @mate_text.getTextWidget.addFocusListener(FocusListener.new(self))
286
321
  @mate_text.getTextWidget.addVerifyListener(VerifyListener.new(@model.document, self))
@@ -289,7 +324,7 @@ module Redcar
289
324
  @mate_text.get_control.add_key_listener(KeyListener.new(self))
290
325
  @handlers << [@model.document, h1] << [@model, h2] << [@model, h3] << [@model, h4] <<
291
326
  [@model, h5] << [@model, h6] << [@model, h7] << [@model, h8] <<
292
- [@model, h9] << [@model, h11]
327
+ [@model, h9] << [@model, h11] << [@model.document, h13]
293
328
  end
294
329
 
295
330
  def right_click(mouse_event)
@@ -322,6 +357,8 @@ module Redcar
322
357
  end
323
358
 
324
359
  def verify_key(key_event)
360
+ #uncomment this line for key debugging
361
+ #puts "got keyevent: #{key_event.character} #{key_event.stateMask}"
325
362
  if @edit_view_swt.model.document.block_selection_mode?
326
363
  @edit_view_swt.begin_compound
327
364
  end
@@ -337,6 +374,8 @@ module Redcar
337
374
  key_event.doit = !@edit_view_swt.model.delete_pressed(ApplicationSWT::Menu::BindingTranslator.modifiers(key_event))
338
375
  elsif key_event.character == Swt::SWT::BS
339
376
  key_event.doit = !@edit_view_swt.model.backspace_pressed(ApplicationSWT::Menu::BindingTranslator.modifiers(key_event))
377
+ elsif key_event.character == 13 and (key_event.stateMask == Swt::SWT::COMMAND or key_event.stateMask == Swt::SWT::CTRL)
378
+ key_event.doit = !@edit_view_swt.model.cmd_enter_pressed(ApplicationSWT::Menu::BindingTranslator.modifiers(key_event))
340
379
  end
341
380
  end
342
381
  end
@@ -12,24 +12,25 @@ module Redcar
12
12
  if [Swt::SWT::MOVEMENT_WORD, Swt::SWT::MOVEMENT_WORD_END].include? e.movement
13
13
  e.newOffset = next_offset(e.offset, e.lineOffset, e.lineText)
14
14
  # SWT gets pissy without this:
15
- if e.newOffset == e.lineOffset + e.lineText.length + 1
15
+ if e.newOffset == e.lineOffset + e.lineText.chars.length + 1
16
16
  e.newOffset += 1
17
17
  end
18
18
  end
19
19
  end
20
20
 
21
- def next_offset(offset, line_offset, line_text)
22
- if offset == line_offset + line_text.length
23
- offset + 1
21
+ def next_offset(chars_offset, chars_line_offset, line_text)
22
+ if chars_offset == chars_line_offset + line_text.chars.length
23
+ chars_offset + 1
24
24
  else
25
- future_text = line_text[(offset - line_offset)..-1]
25
+ future_text = line_text.chars[(chars_offset - chars_line_offset)..-1].to_s
26
26
  if future_text == nil or future_text == ""
27
- line_offset + line_text.length
27
+ chars_line_offset + line_text.chars.length
28
28
  else
29
29
  if md = future_text.match(MOVE_FORWARD_RE)
30
- offset + md.end(0)
30
+ chars_match_end = future_text.byte_offset_to_char_offset(md.end(0))
31
+ chars_offset + chars_match_end
31
32
  else
32
- line_offset + line_text.length
33
+ chars_line_offset + line_text.chars.length
33
34
  end
34
35
  end
35
36
  end
@@ -45,18 +46,19 @@ module Redcar
45
46
  end
46
47
  end
47
48
 
48
- def previous_offset(offset, line_offset, line_text)
49
- if offset == line_offset
50
- offset - 1
49
+ def previous_offset(chars_offset, chars_line_offset, line_text)
50
+ if chars_offset == chars_line_offset
51
+ chars_offset - 1
51
52
  else
52
- future_text = line_text[0..(offset - line_offset - 1)].reverse
53
+ future_text = line_text.chars[0..(chars_offset - chars_line_offset - 1)].reverse.to_s
53
54
  if future_text == nil or future_text == ""
54
- line_offset
55
+ chars_line_offset
55
56
  else
56
57
  if md = future_text.match(MOVE_FORWARD_RE)
57
- offset - md.end(0)
58
+ chars_match_end = future_text.byte_offset_to_char_offset(md.end(0))
59
+ chars_offset - chars_match_end
58
60
  else
59
- line_offset
61
+ chars_line_offset
60
62
  end
61
63
  end
62
64
  end
@@ -0,0 +1,40 @@
1
+
2
+ module Redcar
3
+ class Help
4
+ def self.menus
5
+ Redcar::Menu::Builder.build do
6
+ sub_menu "Help" do
7
+ group(:priority => :first) do
8
+ item "Online Help", :command => OnlineHelpCommand
9
+ item "Submit a Bug", :command => SubmitABugCommand
10
+ end
11
+ end
12
+ end
13
+ end
14
+
15
+ def self.keymaps
16
+ map = Redcar::Keymap.build("main", [:osx, :linux, :windows]) do
17
+ link "F1", OnlineHelpCommand
18
+ end
19
+ [map]
20
+ end
21
+
22
+ class SubmitABugCommand < Redcar::Command
23
+ def execute
24
+ Redcar::WebBookmarks::DisplayWebContent.new(
25
+ "Submit a Bug",
26
+ "https://redcar.lighthouseapp.com/projects/25090-redcar/tickets/new"
27
+ ).run
28
+ end
29
+ end
30
+
31
+ class OnlineHelpCommand < Redcar::Command
32
+ def execute
33
+ Redcar::WebBookmarks::DisplayWebContent.new(
34
+ "Online Help",
35
+ "http://github.com/redcar/redcar/wiki/Users-Guide"
36
+ ).run
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,8 @@
1
+
2
+ Plugin.define do
3
+ name "help"
4
+ version "1.0"
5
+ file "lib", "help"
6
+ object "Redcar::Help"
7
+ dependencies "web_bookmarks", ">0"
8
+ end
@@ -14,9 +14,11 @@ Then /^the HTML tab (should say|says) "([^"]*)"$/ do |_, needle|
14
14
  end
15
15
 
16
16
  Redcar.gui.yield_until { started && !thread.alive? }
17
-
18
- # For now, just skip on windows. We can't get browser exec results
19
- # on current version of SWT and XulRunner. More info at:
17
+
18
+ # For now, just skip on XUL platforms on which we can't get browser exec results
19
+ # (current version of SWT and XulRunner). More info at:
20
20
  # https://bugs.eclipse.org/bugs/show_bug.cgi?id=259687
21
- contents.should match needle unless Redcar.platform == :windows
21
+ unless (contents.nil? or contents.empty?) and [:windows, :linux].include? Redcar.platform
22
+ contents.should match needle
23
+ end
22
24
  end
@@ -1 +0,0 @@
1
- RequireSupportFiles File.dirname(__FILE__) + "/../../../edit_view/features/"
@@ -9,58 +9,3 @@ end
9
9
  When /I run the last recorded macro/ do
10
10
  Redcar::Macros::RunLastCommand.new.run
11
11
  end
12
-
13
- When /^I type "([^"]*)"$/ do |text|
14
- text = text.gsub("\\t", "\t").gsub("\\n", "\n")
15
- text.split(//).each do |letter|
16
- edit_view = Redcar::EditView.focussed_edit_view
17
- edit_view.type_character(letter[0])
18
- end
19
- end
20
-
21
- edit_view_action_steps = {
22
- :LINE_UP => "I move up",
23
- :LINE_DOWN => "I move down",
24
- :LINE_START => "I move to the start of the line",
25
- :LINE_END => "I move to the end of the line",
26
- :COLUMN_PREVIOUS => "I move left",
27
- :COLUMN_NEXT => "I move right",
28
- :PAGE_UP => "I page up",
29
- :PAGE_DOWN => "I page down",
30
- :WORD_PREVIOUS => "I move to the previous word",
31
- :WORD_NEXT => "I move to the next word",
32
- :TEXT_START => "I move to the start of the text",
33
- :TEXT_END => "I move to the end of the text",
34
- :WINDOW_START => "I move to the start of the window",
35
- :WINDOW_END => "I move to the end of the window",
36
- :SELECT_ALL => "I select all",
37
- :SELECT_LINE_UP => "I select up",
38
- :SELECT_LINE_DOWN => "I select down",
39
- :SELECT_LINE_START => "I select to the start of the line",
40
- :SELECT_LINE_END => "I select to the end of the line",
41
- :SELECT_COLUMN_PREVIOUS => "I select left",
42
- :SELECT_COLUMN_NEXT => "I select right",
43
- :SELECT_PAGE_UP => "I select page up",
44
- :SELECT_PAGE_DOWN => "I select page down",
45
- :SELECT_WORD_PREVIOUS => "I select to the previous word",
46
- :SELECT_WORD_NEXT => "I select to the next word",
47
- :SELECT_TEXT_START => "I select to the start of the text",
48
- :SELECT_TEXT_END => "I select to the end of the text",
49
- :SELECT_WINDOW_START => "I select to the start of the window",
50
- :SELECT_WINDOW_END => "I select to the end of the window",
51
- :CUT => "dsafjl;fjsadfk",
52
- :COPY => "asdfkjalsgj",
53
- :PASTE => "asdfasdfe",
54
- :DELETE_PREVIOUS => "I backspace",
55
- :DELETE_NEXT => "I delete",
56
- :DELETE_WORD_PREVIOUS => "I delete to the previous word",
57
- :DELETE_WORD_NEXT => "I delete to the next word"
58
- }
59
-
60
- edit_view_action_steps.each do |action_symbol, step_text|
61
- When step_text do
62
- Redcar::EditView.focussed_edit_view.invoke_action(action_symbol)
63
- end
64
- end
65
-
66
-
@@ -1,2 +0,0 @@
1
- RequireSupportFiles File.dirname(__FILE__) + "/../../../edit_view/features/"
2
- RequireSupportFiles File.dirname(__FILE__) + "/../../../line_tools/features/"
@@ -0,0 +1,35 @@
1
+ module Redcar
2
+
3
+ class OpenDefaultApp
4
+
5
+ def self.project_context_menus(tree, node, controller)
6
+ Menu::Builder.build do
7
+ if node and node.path
8
+ item ("Open Default App"){OpenDefaultAppCommand.new(node.path).run }
9
+ end
10
+ end
11
+ end
12
+
13
+ class OpenDefaultAppCommand < Redcar::Command
14
+ import java.awt.Desktop
15
+
16
+ attr_reader :path
17
+
18
+ def initialize(path)
19
+ @path = path
20
+ end
21
+
22
+ def execute(options=nil)
23
+ @path ||= options[:value]
24
+ begin
25
+ file = java::io::File.new(path)
26
+ desktop = Desktop.get_desktop
27
+ desktop.open(file)
28
+ rescue Object => e
29
+ Application::Dialog.message_box("A default application could not be found for this type of file.")
30
+ end
31
+ end
32
+ end
33
+
34
+ end
35
+ end