redcar 0.9.2 → 0.10
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +34 -4
- data/Rakefile +2 -1
- data/lib/redcar.rb +3 -3
- data/lib/redcar/installer.rb +2 -3
- data/plugins/application/features/step_definitions/dialog_steps.rb +7 -0
- data/plugins/application/features/step_definitions/key_steps.rb +18 -0
- data/plugins/application/features/step_definitions/menu_steps.rb +5 -6
- data/plugins/application/features/step_definitions/speedbar_steps.rb +29 -9
- data/plugins/application/features/step_definitions/tree_steps.rb +13 -0
- data/plugins/application/features/support/env.rb +39 -5
- data/plugins/application/features/support/fake_event.rb +12 -0
- data/plugins/application/lib/application.rb +5 -6
- data/plugins/application/lib/application/dialog.rb +53 -10
- data/plugins/application/lib/application/dialogs/modeless_list_dialog.rb +85 -0
- data/plugins/application/lib/application/keymap.rb +10 -8
- data/plugins/application/lib/application/menu.rb +38 -16
- data/plugins/application/lib/application/treebook.rb +30 -0
- data/plugins/application/lib/application/window.rb +20 -2
- data/plugins/application/spec/application/command/executor_spec.rb +1 -0
- data/plugins/application/spec/application/menu_spec.rb +26 -26
- data/plugins/application/spec/application/treebook_spec.rb +6 -6
- data/plugins/application/spec/spec_helper.rb +10 -1
- data/plugins/application_swt/lib/application_swt.rb +25 -3
- data/plugins/application_swt/lib/application_swt/dialog_adapter.rb +48 -27
- data/plugins/application_swt/lib/application_swt/dialogs/filter_list_dialog_controller.rb +22 -11
- data/plugins/application_swt/lib/application_swt/dialogs/modeless_dialog.rb +113 -0
- data/plugins/application_swt/lib/application_swt/dialogs/modeless_html_dialog.rb +85 -0
- data/plugins/application_swt/lib/application_swt/dialogs/modeless_list_dialog_controller.rb +143 -0
- data/plugins/application_swt/lib/application_swt/gradient.rb +61 -0
- data/plugins/application_swt/lib/application_swt/menu/binding_translator.rb +4 -4
- data/plugins/application_swt/lib/application_swt/notebook.rb +5 -8
- data/plugins/application_swt/lib/application_swt/speedbar.rb +1 -0
- data/plugins/application_swt/lib/application_swt/treebook.rb +6 -8
- data/plugins/application_swt/lib/application_swt/window.rb +85 -57
- data/plugins/application_swt/lib/swt/graphics_utils.rb +23 -0
- data/plugins/application_swt/lib/swt/vtab_folder.rb +7 -0
- data/plugins/application_swt/lib/swt/vtab_label.rb +1 -1
- data/plugins/application_swt/spec/application_swt/gradient_spec.rb +142 -0
- data/plugins/auto_completer/lib/auto_completer.rb +10 -42
- data/plugins/auto_completer/lib/auto_completer/list_dialog.rb +21 -0
- data/plugins/clojure/lib/clojure.rb +33 -0
- data/plugins/{repl/lib/repl/clojure_mirror.rb → clojure/lib/clojure/repl_mirror.rb} +16 -20
- data/plugins/clojure/plugin.rb +9 -0
- data/plugins/{repl/spec/repl/clojure_mirror_spec.rb → clojure/spec/clojure/repl_mirror_spec.rb} +12 -13
- data/plugins/clojure/spec/spec_helper.rb +5 -0
- data/plugins/{repl → clojure}/vendor/Wrapper.clj +0 -0
- data/plugins/{repl → clojure}/vendor/dummy +0 -0
- data/plugins/{repl → clojure}/vendor/enclojure-wrapper.jar +0 -0
- data/plugins/connection_manager/lib/connection_manager.rb +13 -13
- data/plugins/declarations/lib/declarations.rb +17 -6
- data/plugins/document_search/features/find.feature +389 -0
- data/plugins/document_search/features/find_and_replace.feature +723 -0
- data/plugins/document_search/features/replace.feature +69 -62
- data/plugins/document_search/lib/document_search.rb +81 -64
- data/plugins/document_search/lib/document_search/commands.rb +258 -0
- data/plugins/document_search/lib/document_search/find_and_replace_speedbar.rb +142 -0
- data/plugins/document_search/lib/document_search/find_speedbar.rb +102 -0
- data/plugins/document_search/lib/document_search/query_options.rb +45 -0
- data/plugins/edit_view/features/case_change.feature +9 -5
- data/plugins/edit_view/features/step_definitions/editing_steps.rb +19 -0
- data/plugins/edit_view/lib/edit_view.rb +15 -12
- data/plugins/edit_view/lib/edit_view/actions/arrow_keys.rb +12 -2
- data/plugins/edit_view/lib/edit_view/commands/text_conversion_commands.rb +1 -1
- data/plugins/edit_view/lib/edit_view/document.rb +129 -99
- data/plugins/edit_view_swt/lib/edit_view_swt.rb +33 -15
- data/plugins/encryption/encryption.rb +2 -0
- data/plugins/find-in-project/lib/find_in_project.rb +3 -5
- data/plugins/find-in-project/lib/find_in_project/views/index.html.erb +2 -0
- data/plugins/groovy/features/step_definitions/groovy_steps.rb +2 -2
- data/plugins/groovy/features/syntax_check_groovy.feature +3 -3
- data/plugins/groovy/lib/groovy.rb +38 -0
- data/plugins/groovy/lib/groovy/commands.rb +10 -0
- data/plugins/{repl/lib/repl/groovy_mirror.rb → groovy/lib/groovy/repl_mirror.rb} +33 -13
- data/plugins/groovy/lib/{syntax_check/groovy.rb → groovy/syntax_checker.rb} +13 -8
- data/plugins/groovy/plugin.rb +5 -4
- data/plugins/{repl/spec/repl/groovy_mirror_spec.rb → groovy/spec/groovy/repl_mirror_spec.rb} +14 -13
- data/plugins/groovy/spec/spec_helper.rb +5 -0
- data/plugins/html_view/assets/json2.js +476 -0
- data/plugins/html_view/lib/html_view.rb +1 -0
- data/plugins/java/features/fixtures/test.java +0 -0
- data/plugins/java/features/support/env.rb +27 -0
- data/plugins/java/features/syntax_check_java.feature +86 -0
- data/plugins/java/lib/syntax_check/java.rb +86 -0
- data/plugins/java/plugin.rb +7 -0
- data/plugins/javascript/features/fixtures/test2.js +5 -0
- data/plugins/javascript/features/step_definitions/javascript_steps.rb +16 -0
- data/plugins/javascript/features/support/env.rb +14 -0
- data/plugins/javascript/features/syntax_check_javascript.feature +46 -3
- data/plugins/javascript/lib/syntax_check/javascript.rb +15 -9
- data/plugins/line_tools/features/trim_line.feature +49 -0
- data/plugins/line_tools/lib/line_tools.rb +5 -1
- data/plugins/mirah/README +7 -0
- data/plugins/mirah/features/fixtures/test.mirah +2 -0
- data/plugins/mirah/features/syntax_check_mirah.feature +46 -0
- data/plugins/mirah/lib/mirah.rb +43 -0
- data/plugins/mirah/lib/mirah/my_error_handler.rb +22 -0
- data/plugins/mirah/lib/mirah/repl_mirror.rb +50 -0
- data/plugins/mirah/lib/mirah/syntax_checker.rb +38 -0
- data/plugins/mirah/plugin.rb +8 -0
- data/plugins/mirah/spec/mirah/repl_mirror_spec.rb +188 -0
- data/plugins/mirah/spec/spec_helper.rb +5 -0
- data/plugins/mirah/vendor/mirah-parser.jar +0 -0
- data/plugins/pair_highlighter/lib/pair_highlighter/document_controller.rb +24 -23
- data/plugins/plugin_manager_ui/lib/plugin_manager_ui.rb +10 -1
- data/plugins/plugin_manager_ui/views/index.html.erb +2 -0
- data/plugins/project/features/find_file.feature +40 -16
- data/plugins/project/features/highlight_focussed_tab.feature +16 -10
- data/plugins/project/features/step_definitions/find_file_steps.rb +11 -0
- data/plugins/project/features/step_definitions/project_tree_steps.rb +5 -1
- data/plugins/project/features/support/env.rb +5 -0
- data/plugins/project/lib/project/commands.rb +8 -1
- data/plugins/project/lib/project/dir_controller.rb +4 -1
- data/plugins/project/lib/project/find_file_dialog.rb +16 -12
- data/plugins/project/lib/project/manager.rb +30 -1
- data/plugins/project_search/vendor/lucene/CHANGELOG +147 -0
- data/plugins/project_search/vendor/lucene/CONTRIBUTORS +17 -0
- data/plugins/project_search/vendor/lucene/Gemfile +9 -0
- data/plugins/project_search/vendor/lucene/Gemfile.lock +33 -0
- data/plugins/project_search/vendor/lucene/LICENSE +19 -0
- data/plugins/project_search/vendor/lucene/README.rdoc +283 -0
- data/plugins/project_search/vendor/lucene/Rakefile +35 -0
- data/plugins/project_search/vendor/lucene/examples/active_model/serializers.rb +25 -0
- data/plugins/project_search/vendor/lucene/examples/active_model/validation.rb +26 -0
- data/plugins/project_search/vendor/lucene/examples/admin/Rakefile +4 -0
- data/plugins/project_search/vendor/lucene/examples/admin/admin.rb +29 -0
- data/plugins/project_search/vendor/lucene/examples/admin/public/jquery.js +4376 -0
- data/plugins/project_search/vendor/lucene/examples/admin/public/neo4j.css +153 -0
- data/plugins/project_search/vendor/lucene/examples/admin/public/neo_admin.js +18 -0
- data/plugins/project_search/vendor/lucene/examples/admin/spec/admin_spec.rb +26 -0
- data/plugins/project_search/vendor/lucene/examples/admin/views/index.erb +21 -0
- data/plugins/project_search/vendor/lucene/examples/filetree/README.rdoc +9 -0
- data/plugins/project_search/vendor/lucene/examples/filetree/app.rb +7 -0
- data/plugins/project_search/vendor/lucene/examples/filetree/batch.props +5 -0
- data/plugins/project_search/vendor/lucene/examples/filetree/features/step_definitions/add_steps.rb +121 -0
- data/plugins/project_search/vendor/lucene/examples/filetree/features/support/env.rb +30 -0
- data/plugins/project_search/vendor/lucene/examples/filetree/features/support/rspec_helper.rb +50 -0
- data/plugins/project_search/vendor/lucene/examples/filetree/features/treesizes.feature +19 -0
- data/plugins/project_search/vendor/lucene/examples/imdb/1_create_neo_db.rb +66 -0
- data/plugins/project_search/vendor/lucene/examples/imdb/2_index_db.rb +23 -0
- data/plugins/project_search/vendor/lucene/examples/imdb/README +12 -0
- data/plugins/project_search/vendor/lucene/examples/imdb/find_actors.rb +56 -0
- data/plugins/project_search/vendor/lucene/examples/imdb/install.sh +12 -0
- data/plugins/project_search/vendor/lucene/examples/imdb/model.rb +37 -0
- data/plugins/project_search/vendor/lucene/examples/railway/README +111 -0
- data/plugins/project_search/vendor/lucene/examples/railway/railnet-app.rb +31 -0
- data/plugins/project_search/vendor/lucene/examples/railway/railnet-data.rb +42 -0
- data/plugins/project_search/vendor/lucene/examples/rest/example.rb +41 -0
- data/plugins/project_search/vendor/lucene/examples/you_might_know/YouMightKnow.java +60 -0
- data/plugins/project_search/vendor/lucene/examples/you_might_know/all_simple_paths.rb +34 -0
- data/plugins/project_search/vendor/lucene/examples/you_might_know/nodes.rb +34 -0
- data/plugins/project_search/vendor/lucene/examples/you_might_know/you_might_know.rb +50 -0
- data/plugins/project_search/vendor/lucene/lib/lucene.rb +15 -0
- data/plugins/project_search/vendor/lucene/lib/lucene/config.rb +145 -0
- data/plugins/project_search/vendor/lucene/lib/lucene/document.rb +96 -0
- data/plugins/project_search/vendor/lucene/lib/lucene/field_info.rb +144 -0
- data/plugins/project_search/vendor/lucene/lib/lucene/hits.rb +54 -0
- data/plugins/project_search/vendor/lucene/lib/lucene/index.rb +267 -0
- data/plugins/project_search/vendor/lucene/lib/lucene/index_info.rb +146 -0
- data/plugins/project_search/vendor/lucene/lib/lucene/index_searcher.rb +157 -0
- data/plugins/project_search/vendor/lucene/lib/lucene/jars.rb +5 -0
- data/plugins/project_search/vendor/lucene/lib/lucene/query_dsl.rb +135 -0
- data/plugins/project_search/vendor/lucene/lib/lucene/transaction.rb +117 -0
- data/plugins/project_search/vendor/lucene/lib/lucene/version.rb +3 -0
- data/plugins/project_search/vendor/lucene/lucene.gemspec +23 -0
- data/plugins/project_search/vendor/lucene/spec/lucene/document_spec.rb +32 -0
- data/plugins/project_search/vendor/lucene/spec/lucene/field_info_spec.rb +70 -0
- data/plugins/project_search/vendor/lucene/spec/lucene/index_info_spec.rb +76 -0
- data/plugins/project_search/vendor/lucene/spec/lucene/index_spec.rb +643 -0
- data/plugins/project_search/vendor/lucene/spec/lucene/query_dsl_spec.rb +142 -0
- data/plugins/project_search/vendor/lucene/spec/lucene/sort_spec.rb +101 -0
- data/plugins/project_search/vendor/lucene/spec/lucene/spec_helper.rb +10 -0
- data/plugins/project_search/vendor/lucene/spec/lucene/transaction_spec.rb +118 -0
- data/plugins/redcar/features/alter_font_size.feature +25 -0
- data/plugins/redcar/features/step_definitions/font_steps.rb +34 -0
- data/plugins/redcar/redcar.rb +256 -43
- data/plugins/repl/features/command_editing.feature +55 -0
- data/plugins/repl/features/command_history.feature +75 -0
- data/plugins/repl/features/step_definitions/repl_steps.rb +17 -1
- data/plugins/repl/features/support/env.rb +24 -0
- data/plugins/repl/features/support/fake_repl.rb +16 -0
- data/plugins/repl/lib/repl.rb +17 -74
- data/plugins/repl/lib/repl/repl_command.rb +20 -0
- data/plugins/repl/lib/repl/repl_mirror.rb +168 -22
- data/plugins/repl/lib/repl/repl_tab.rb +131 -6
- data/plugins/repl/plugin.rb +1 -1
- data/plugins/repl/spec/repl/repl_mirror_spec.rb +72 -0
- data/plugins/repl/spec/spec_helper.rb +1 -1
- data/plugins/repl_swt/lib/repl_swt.rb +7 -0
- data/plugins/repl_swt/lib/repl_swt/key_listener.rb +43 -0
- data/plugins/repl_swt/plugin.rb +8 -0
- data/plugins/ruby/lib/ruby.rb +35 -0
- data/plugins/{repl/lib/repl/ruby_mirror.rb → ruby/lib/ruby/repl_mirror.rb} +12 -12
- data/plugins/ruby/lib/{syntax_check/ruby.rb → ruby/syntax_checker.rb} +3 -3
- data/plugins/ruby/plugin.rb +5 -4
- data/plugins/{repl/spec/repl/ruby_mirror_spec.rb → ruby/spec/ruby/repl_mirror_spec.rb} +38 -29
- data/plugins/ruby/spec/spec_helper.rb +5 -0
- data/plugins/runnables/lib/runnables.rb +2 -0
- data/plugins/runnables/lib/runnables/command_output_controller.rb +5 -0
- data/plugins/runnables/lib/runnables/output_processor.rb +14 -3
- data/plugins/runnables/views/command_output.html.erb +3 -2
- data/plugins/scm/lib/scm.rb +4 -2
- data/plugins/scm/lib/scm/diff_mirror.rb +6 -6
- data/plugins/scm_git/lib/scm_git.rb +136 -107
- data/plugins/scm_git/lib/scm_git/change.rb +28 -19
- data/plugins/snippets/lib/snippets/explorer.rb +2 -2
- data/plugins/swt/lib/swt/full_swt.rb +1 -0
- data/plugins/syntax_check/features/step_definitions/syntax_check_steps.rb +4 -0
- data/plugins/syntax_check/features/support/env.rb +3 -0
- data/plugins/syntax_check/lib/syntax_check.rb +71 -5
- data/plugins/syntax_check/lib/syntax_check/annotation.rb +61 -0
- data/plugins/test_runner/lib/test_runner.rb +39 -0
- data/plugins/test_runner/lib/test_runner/rspec_runner.rb +20 -0
- data/plugins/test_runner/lib/test_runner/run_test_command.rb +63 -0
- data/plugins/test_runner/lib/test_runner/runnable_test_runner.rb +26 -0
- data/plugins/test_runner/plugin.rb +8 -0
- data/plugins/test_runner/spec/run_test_command_spec.rb +51 -0
- data/plugins/test_runner/spec/spec_helper.rb +5 -0
- data/plugins/textmate/lib/textmate.rb +12 -2
- data/plugins/textmate/vendor/redcar-bundles/Bundles/HTML.tmbundle/Syntaxes/HTML.plist +0 -2
- data/plugins/textmate/vendor/redcar-bundles/Bundles/Mirah.tmbundle/Syntaxes/Mirah.plist +22 -0
- data/plugins/textmate/vendor/redcar-bundles/Bundles/Mirah.tmbundle/info.plist +12 -0
- data/plugins/textmate/vendor/redcar-bundles/Bundles/Ruby.tmbundle/Syntaxes/Ruby.plist +2 -0
- data/plugins/todo_list/lib/todo_list.rb +7 -0
- data/plugins/todo_list/lib/todo_list/todo_controller.rb +3 -1
- data/plugins/tree/lib/tree.rb +4 -0
- data/plugins/tree_view_swt/lib/tree_view_swt.rb +5 -0
- data/plugins/web_bookmarks/lib/web_bookmarks.rb +10 -0
- metadata +137 -22
- data/plugins/document_search/features/search.feature +0 -163
- data/plugins/document_search/lib/document_search/replace_all_command.rb +0 -27
- data/plugins/document_search/lib/document_search/replace_command.rb +0 -38
- data/plugins/document_search/lib/document_search/replace_next_command.rb +0 -27
- data/plugins/document_search/lib/document_search/search_and_replace.rb +0 -81
- data/plugins/ruby/README +0 -6
@@ -85,7 +85,7 @@ module Redcar
|
|
85
85
|
JavaMateView::ThemeManager.load_themes(dir)
|
86
86
|
end
|
87
87
|
|
88
|
-
attr_reader :mate_text, :widget, :model
|
88
|
+
attr_reader :mate_text, :widget, :model, :key_listener, :verify_key_listener
|
89
89
|
|
90
90
|
def initialize(model, parent, options={})
|
91
91
|
@options = options
|
@@ -110,7 +110,7 @@ module Redcar
|
|
110
110
|
|
111
111
|
create_model_listeners
|
112
112
|
end
|
113
|
-
|
113
|
+
|
114
114
|
def create_mate_text
|
115
115
|
@mate_text = JavaMateView::MateText.new(@parent, !!@options[:single_line])
|
116
116
|
@mate_text.set_font(EditView.font, EditView.font_size)
|
@@ -288,7 +288,7 @@ module Redcar
|
|
288
288
|
@mate_text.get_text_widget.right_margin = 0
|
289
289
|
end
|
290
290
|
end
|
291
|
-
|
291
|
+
|
292
292
|
def char_width
|
293
293
|
return 0 if !!@options[:single_line]
|
294
294
|
@char_width ||= begin
|
@@ -299,11 +299,11 @@ module Redcar
|
|
299
299
|
width
|
300
300
|
end
|
301
301
|
end
|
302
|
-
|
302
|
+
|
303
303
|
def clear_char_width
|
304
304
|
@char_width = nil
|
305
305
|
end
|
306
|
-
|
306
|
+
|
307
307
|
def create_document
|
308
308
|
@document = EditViewSWT::Document.new(@model.document, @mate_text.mate_document)
|
309
309
|
@model.document.controller = @document
|
@@ -317,17 +317,17 @@ module Redcar
|
|
317
317
|
h5 = @model.add_listener(:invisibles_changed) do |new_bool|
|
318
318
|
@mate_text.showInvisibles(new_bool)
|
319
319
|
end
|
320
|
-
|
320
|
+
|
321
321
|
h6 = @model.add_listener(:word_wrap_changed) do |should_word_wrap|
|
322
322
|
@mate_text.set_word_wrap(should_word_wrap)
|
323
323
|
reset_right_margin
|
324
324
|
end
|
325
|
-
|
325
|
+
|
326
326
|
h11 = @model.add_listener(:margin_column_changed) do |new_column|
|
327
327
|
@mate_text.set_margin_column(new_column)
|
328
328
|
reset_right_margin
|
329
329
|
end
|
330
|
-
|
330
|
+
|
331
331
|
h12 = @model.add_listener(:show_margin_changed) do |new_bool|
|
332
332
|
if new_bool
|
333
333
|
@mate_text.set_margin_column(@model.margin_column)
|
@@ -335,13 +335,13 @@ module Redcar
|
|
335
335
|
@mate_text.set_margin_column(-1)
|
336
336
|
end
|
337
337
|
end
|
338
|
-
|
338
|
+
|
339
339
|
h7 = @model.add_listener(:font_changed) do
|
340
340
|
@mate_text.set_font(EditView.font, EditView.font_size)
|
341
341
|
clear_char_width
|
342
342
|
reset_right_margin
|
343
343
|
end
|
344
|
-
|
344
|
+
|
345
345
|
h8 = @model.add_listener(:theme_changed) do
|
346
346
|
@mate_text.set_theme_by_name(EditView.theme)
|
347
347
|
end
|
@@ -355,8 +355,10 @@ module Redcar
|
|
355
355
|
@mate_text.getTextWidget.addFocusListener(FocusListener.new(self))
|
356
356
|
@mate_text.getTextWidget.addVerifyListener(VerifyListener.new(@model.document, self))
|
357
357
|
@mate_text.getTextWidget.addModifyListener(ModifyListener.new(@model.document, self))
|
358
|
-
@
|
359
|
-
@
|
358
|
+
@verify_key_listener = VerifyKeyListener.new(self)
|
359
|
+
@key_listener = KeyListener.new(self)
|
360
|
+
@mate_text.get_control.add_verify_key_listener(@verify_key_listener)
|
361
|
+
@mate_text.get_control.add_key_listener(@key_listener)
|
360
362
|
@handlers << [@model.document, h1] << [@model, h2] << [@model, h3] << [@model, h4] <<
|
361
363
|
[@model, h5] << [@model, h6] << [@model, h7] << [@model, h8] <<
|
362
364
|
[@model, h9] << [@model, h11] << [@model.document, h13]
|
@@ -467,15 +469,15 @@ module Redcar
|
|
467
469
|
@mate_text.get_text_widget.add_word_movement_listener(WordMoveListener.new(self))
|
468
470
|
@mate_text.get_text_widget.add_control_listener(ControlListener.new(self))
|
469
471
|
end
|
470
|
-
|
472
|
+
|
471
473
|
class ControlListener
|
472
474
|
def initialize(edit_view_swt)
|
473
475
|
@edit_view_swt = edit_view_swt
|
474
476
|
end
|
475
|
-
|
477
|
+
|
476
478
|
def controlMoved(*_)
|
477
479
|
end
|
478
|
-
|
480
|
+
|
479
481
|
def controlResized(e)
|
480
482
|
@edit_view_swt.reset_right_margin
|
481
483
|
end
|
@@ -498,6 +500,22 @@ module Redcar
|
|
498
500
|
@mate_text.viewer.set_top_index(line_index)
|
499
501
|
end
|
500
502
|
|
503
|
+
def scroll_to_horizontal_offset(offset)
|
504
|
+
@mate_text.get_text_widget.set_horizontal_index(offset)
|
505
|
+
end
|
506
|
+
|
507
|
+
def smallest_visible_horizontal_index
|
508
|
+
@mate_text.get_text_widget.get_horizontal_index
|
509
|
+
end
|
510
|
+
|
511
|
+
def largest_visible_horizontal_index
|
512
|
+
wpix = @mate_text.get_text_widget.get_client_area.width
|
513
|
+
gc = org.eclipse.swt.graphics.GC.new(@mate_text.get_text_widget)
|
514
|
+
inc = gc.getFontMetrics().getAverageCharWidth()
|
515
|
+
gc.dispose
|
516
|
+
@mate_text.get_text_widget.get_horizontal_index + (wpix/inc)
|
517
|
+
end
|
518
|
+
|
501
519
|
def model_grammar_changed(name)
|
502
520
|
@mate_text.set_grammar_by_name(name)
|
503
521
|
end
|
@@ -29,6 +29,7 @@ module Encryption
|
|
29
29
|
def execute
|
30
30
|
Encryption.lazy_load
|
31
31
|
result = Redcar::Application::Dialog.input("Password", "Enter password")
|
32
|
+
return if result[:button] == :cancel
|
32
33
|
pw = result[:value]
|
33
34
|
begin
|
34
35
|
doc.text = Encryption.decrypt(doc.to_s, pw)
|
@@ -42,6 +43,7 @@ module Encryption
|
|
42
43
|
def execute
|
43
44
|
Encryption.lazy_load
|
44
45
|
result = Redcar::Application::Dialog.input("Password", "Enter password")
|
46
|
+
return if result[:button] == :cancel
|
45
47
|
pw = result[:value]
|
46
48
|
doc.text = Encryption.encrypt(doc.to_s, pw)
|
47
49
|
end
|
@@ -5,14 +5,12 @@ module Redcar
|
|
5
5
|
class FindInProject
|
6
6
|
def self.menus
|
7
7
|
Redcar::Menu::Builder.build do
|
8
|
-
sub_menu "
|
9
|
-
|
10
|
-
item "Find In Project!", Redcar::FindInProject::OpenSearch
|
11
|
-
end
|
8
|
+
sub_menu "Project" do
|
9
|
+
item "Find in Project!", :command => Redcar::FindInProject::OpenSearch, :priority => 3
|
12
10
|
end
|
13
11
|
end
|
14
12
|
end
|
15
|
-
|
13
|
+
|
16
14
|
def self.toolbars
|
17
15
|
ToolBar::Builder.build do
|
18
16
|
item "Find in Project", :command => OpenSearch, :icon => File.join(Redcar::ICONS_DIRECTORY, "application-search-result.png"), :barname => :project
|
@@ -1,5 +1,7 @@
|
|
1
1
|
<% jquery_path = File.expand_path(File.join(Redcar.root, %w(plugins html_view assets jquery-1.4.min.js))) %>
|
2
2
|
<script type="text/javascript" src="file://<%= jquery_path %>"></script>
|
3
|
+
<% json_path = File.expand_path(File.join(Redcar.root, %w(plugins html_view assets json2.js))) %>
|
4
|
+
<script type="text/javascript" src="file://<%= json_path %>"></script>
|
3
5
|
|
4
6
|
<% plugin_css = File.expand_path(File.join(@plugin_root, %w(lib find_in_project stylesheets style.css))) %>
|
5
7
|
<link rel="stylesheet" href="file://<%= plugin_css %>" type="text/css" media="screen">
|
@@ -1,5 +1,5 @@
|
|
1
|
-
When /^I add "([^"]*)" to the
|
2
|
-
File.open(File.expand_path("
|
1
|
+
When /^I add "([^"]*)" to the "([^"]*)" classpath$/ do |dir,plugin|
|
2
|
+
File.open(File.expand_path("plugins/#{plugin}/features/fixtures/.redcar/classpath.groovy"), "a") do |f|
|
3
3
|
f.puts <<-CONFIG
|
4
4
|
def redcar_config = new File(getClass().protectionDomain.codeSource.location.path).parentFile
|
5
5
|
def project = redcar_config.parentFile
|
@@ -51,7 +51,7 @@ Feature: Syntax Checking for Groovy
|
|
51
51
|
Given I have not suppressed syntax checking message dialogs
|
52
52
|
When I will choose "plugins/groovy/features/fixtures" from the "open_directory" dialog
|
53
53
|
And I open a directory
|
54
|
-
And I add "lib2" to the groovy classpath
|
54
|
+
And I add "lib2" to the "groovy" classpath
|
55
55
|
And I replace the contents with "class Foo {\n def x = new Bar(10)\n def y = new FooBaz()\n}"
|
56
56
|
And I save the tab
|
57
57
|
Then I should see a message box containing "An error occurred while parsing"
|
@@ -66,7 +66,7 @@ Feature: Syntax Checking for Groovy
|
|
66
66
|
And I save the tab
|
67
67
|
Then the tab should not have annotations
|
68
68
|
When I close the focussed tab
|
69
|
-
And I add "lib2" to the groovy classpath
|
69
|
+
And I add "lib2" to the "groovy" classpath
|
70
70
|
And I replace the contents with "class Foo {\n def x = new Bar(10)\n def y = new FooBaz()\n}"
|
71
71
|
And I save the tab
|
72
|
-
Then the tab should have an annotation on line 2
|
72
|
+
Then the tab should have an annotation on line 2
|
@@ -0,0 +1,38 @@
|
|
1
|
+
|
2
|
+
require 'groovy/commands'
|
3
|
+
require 'groovy/repl_mirror'
|
4
|
+
require 'groovy/syntax_checker'
|
5
|
+
|
6
|
+
module Redcar
|
7
|
+
class Groovy
|
8
|
+
|
9
|
+
def self.load_dependencies
|
10
|
+
unless @loaded
|
11
|
+
require File.join(Redcar.asset_dir,"groovy-all")
|
12
|
+
@loaded = true
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.menus
|
17
|
+
Redcar::Menu::Builder.build do
|
18
|
+
sub_menu "Plugins" do
|
19
|
+
sub_menu "REPL" do
|
20
|
+
item "Open Groovy REPL", GroovyOpenREPL
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.keymaps
|
27
|
+
osx = Keymap.build("main", :osx) do
|
28
|
+
link "Cmd+Alt+G", GroovyOpenREPL
|
29
|
+
end
|
30
|
+
|
31
|
+
linwin = Keymap.build("main", [:linux, :windows]) do
|
32
|
+
link "Ctrl+Alt+G", GroovyOpenREPL
|
33
|
+
end
|
34
|
+
|
35
|
+
[linwin, osx]
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -2,8 +2,8 @@
|
|
2
2
|
require 'java'
|
3
3
|
|
4
4
|
module Redcar
|
5
|
-
class
|
6
|
-
class
|
5
|
+
class Groovy
|
6
|
+
class ReplMirror < Redcar::REPL::ReplMirror
|
7
7
|
def title
|
8
8
|
"Groovy REPL"
|
9
9
|
end
|
@@ -11,13 +11,13 @@ module Redcar
|
|
11
11
|
def grammar_name
|
12
12
|
"Groovy REPL"
|
13
13
|
end
|
14
|
-
|
14
|
+
|
15
15
|
def prompt
|
16
16
|
"groovy>"
|
17
|
-
end
|
17
|
+
end
|
18
18
|
|
19
19
|
def evaluator
|
20
|
-
@instance ||=
|
20
|
+
@instance ||= ReplMirror::Evaluator.new
|
21
21
|
end
|
22
22
|
|
23
23
|
def format_error(e)
|
@@ -25,19 +25,39 @@ module Redcar
|
|
25
25
|
"ERROR #{e.class}:\n #{e.message}\n #{backtrace.join("\n ")}"
|
26
26
|
end
|
27
27
|
|
28
|
+
def help
|
29
|
+
h = super
|
30
|
+
h << """
|
31
|
+
Note on Groovy Script Scoping:
|
32
|
+
Classes, undefined variables, and undefined closures are saved in the script
|
33
|
+
binding between statements.
|
34
|
+
Defined methods, closures, and variables are not added to the binding,
|
35
|
+
because they are considered local variables and thus are not available after
|
36
|
+
the defining statement.
|
37
|
+
|
38
|
+
Example:
|
39
|
+
|
40
|
+
def foo = 'hello! I am a local variable'
|
41
|
+
foo = 'hi! I am a binding variable'
|
42
|
+
|
43
|
+
See 'http://groovy.codehaus.org/Scoping+and+the+Semantics+of+%22def%22'
|
44
|
+
for more information.
|
45
|
+
"""
|
46
|
+
end
|
47
|
+
|
28
48
|
class Evaluator
|
29
|
-
def self.
|
49
|
+
def self.load_dependencies
|
30
50
|
unless @loaded
|
31
|
-
|
51
|
+
Groovy.load_dependencies
|
32
52
|
import 'groovy.lang.GroovyShell'
|
33
53
|
import 'java.io.PrintWriter'
|
34
54
|
import 'java.io.StringWriter'
|
35
55
|
@loaded = true
|
36
56
|
end
|
37
57
|
end
|
38
|
-
|
58
|
+
|
39
59
|
def initialize
|
40
|
-
|
60
|
+
Evaluator.load_dependencies
|
41
61
|
@out = StringWriter.new
|
42
62
|
@shell = GroovyShell.new
|
43
63
|
@shell.setProperty('out',@out)
|
@@ -48,9 +68,9 @@ module Redcar
|
|
48
68
|
end
|
49
69
|
|
50
70
|
def execute(cmd)
|
51
|
-
output = @shell.evaluate(cmd).to_s
|
52
|
-
output = "null" unless output and not output.
|
53
|
-
if @out and not @out.toString().
|
71
|
+
output = @shell.evaluate(cmd,"GroovyREPL").to_s
|
72
|
+
output = "null" unless output and not output.empty?
|
73
|
+
if @out and not @out.toString().empty?
|
54
74
|
console = @out.toString() + "\n"
|
55
75
|
else
|
56
76
|
console = ""
|
@@ -62,4 +82,4 @@ module Redcar
|
|
62
82
|
end
|
63
83
|
end
|
64
84
|
end
|
65
|
-
end
|
85
|
+
end
|
@@ -1,14 +1,14 @@
|
|
1
|
+
|
1
2
|
require 'java'
|
2
3
|
|
3
4
|
module Redcar
|
4
|
-
|
5
|
-
class
|
5
|
+
class Groovy
|
6
|
+
class SyntaxChecker < Redcar::SyntaxCheck::Checker
|
6
7
|
supported_grammars "Groovy", "Easyb"
|
7
8
|
|
8
|
-
def
|
9
|
-
super
|
9
|
+
def self.load_dependencies
|
10
10
|
unless @loaded
|
11
|
-
|
11
|
+
Groovy.load_dependencies
|
12
12
|
import 'groovy.lang.GroovyShell'
|
13
13
|
import 'org.codehaus.groovy.control.CompilationFailedException'
|
14
14
|
import 'org.codehaus.groovy.control.CompilerConfiguration'
|
@@ -16,6 +16,11 @@ module Redcar
|
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
+
def initialize(document)
|
20
|
+
super
|
21
|
+
SyntaxChecker.load_dependencies
|
22
|
+
end
|
23
|
+
|
19
24
|
def check(*args)
|
20
25
|
path = manifest_path(doc)
|
21
26
|
name = File.basename(path)
|
@@ -27,7 +32,7 @@ module Redcar
|
|
27
32
|
rescue CompilationFailedException => e
|
28
33
|
create_syntax_error(doc, e.message, name).annotate
|
29
34
|
rescue Object => e
|
30
|
-
SyntaxCheck.message(
|
35
|
+
Redcar::SyntaxCheck.message(
|
31
36
|
"An error occurred while parsing #{name}: #{e.message}",:error)
|
32
37
|
end
|
33
38
|
end
|
@@ -36,7 +41,7 @@ module Redcar
|
|
36
41
|
message =~ /#{Regexp.escape(name)}: (\d+):(.*)/
|
37
42
|
line = $1.to_i - 1
|
38
43
|
message = $2
|
39
|
-
SyntaxCheck::Error.new(doc, line, message)
|
44
|
+
Redcar::SyntaxCheck::Error.new(doc, line, message)
|
40
45
|
end
|
41
46
|
|
42
47
|
def classpath_files(project)
|
@@ -54,7 +59,7 @@ module Redcar
|
|
54
59
|
part = shell.run(file, [])
|
55
60
|
parts += part if part
|
56
61
|
rescue Object => e
|
57
|
-
SyntaxCheck.message(
|
62
|
+
Redcar::SyntaxCheck.message(
|
58
63
|
"An error occurred while loading groovy classpath file #{path}: #{e.message}",:error)
|
59
64
|
end
|
60
65
|
end
|
data/plugins/groovy/plugin.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
Plugin.define do
|
2
2
|
name "groovy"
|
3
|
-
version "0
|
4
|
-
file "lib", "
|
5
|
-
object "Redcar::
|
6
|
-
dependencies "syntax_check", ">0"
|
3
|
+
version "1.0"
|
4
|
+
file "lib", "groovy"
|
5
|
+
object "Redcar::Groovy"
|
6
|
+
dependencies "syntax_check", ">0",
|
7
|
+
"repl", ">0"
|
7
8
|
end
|
data/plugins/{repl/spec/repl/groovy_mirror_spec.rb → groovy/spec/groovy/repl_mirror_spec.rb}
RENAMED
@@ -1,9 +1,9 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__),
|
1
|
+
require File.join(File.dirname(__FILE__),'..', 'spec_helper')
|
2
2
|
|
3
|
-
class Redcar::
|
4
|
-
describe
|
3
|
+
class Redcar::Groovy
|
4
|
+
describe ReplMirror do
|
5
5
|
before(:all) do
|
6
|
-
@mirror =
|
6
|
+
@mirror = ReplMirror.new
|
7
7
|
@changed_event = false
|
8
8
|
@mirror.add_listener(:change) { @changed_event = true }
|
9
9
|
end
|
@@ -12,44 +12,45 @@ class Redcar::REPL
|
|
12
12
|
while @mirror.read.nil? || @mirror.read[-8,8] != "groovy> "
|
13
13
|
end
|
14
14
|
end
|
15
|
-
|
15
|
+
|
16
16
|
describe "before executing" do
|
17
17
|
it "should exist" do
|
18
18
|
@mirror.should be_exist
|
19
19
|
end
|
20
|
-
|
20
|
+
|
21
21
|
it "should have a title" do
|
22
22
|
@mirror.title.should == "Groovy REPL"
|
23
23
|
end
|
24
|
-
|
24
|
+
|
25
25
|
it "should not be changed" do
|
26
26
|
@mirror.should_not be_changed
|
27
27
|
end
|
28
28
|
end
|
29
|
-
|
29
|
+
|
30
30
|
describe "after executing" do
|
31
31
|
it "should exist" do
|
32
32
|
@mirror.should be_exist
|
33
33
|
end
|
34
|
-
|
34
|
+
|
35
35
|
it "should have a title" do
|
36
36
|
@mirror.title.should == "Groovy REPL"
|
37
37
|
end
|
38
|
-
|
38
|
+
|
39
39
|
it "should not be changed" do
|
40
40
|
@mirror.should_not be_changed
|
41
41
|
end
|
42
|
-
|
42
|
+
|
43
43
|
it "should have a prompt" do
|
44
44
|
wait_for_prompt
|
45
45
|
@mirror.read.should == (<<-Groovy).chomp
|
46
46
|
# Groovy REPL
|
47
|
+
# type 'help' for help
|
47
48
|
|
48
49
|
groovy>
|
49
50
|
Groovy
|
50
51
|
end
|
51
|
-
|
52
|
+
|
52
53
|
end
|
53
|
-
|
54
|
+
|
54
55
|
end
|
55
56
|
end
|