redcar 0.8.1 → 0.9.0
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.
- data/CHANGES +41 -1
- data/README.md +1 -1
- data/Rakefile +5 -6
- data/lib/plugin_manager/lib/plugin_manager.rb +1 -2
- data/lib/redcar.rb +19 -14
- data/lib/redcar/installer.rb +21 -17
- data/lib/redcar/runner.rb +10 -7
- data/lib/redcar/usage.rb +1 -0
- data/lib/redcar_quick_start.rb +8 -12
- data/lib/regex_replace.rb +3 -3
- data/plugins/application/features/step_definitions/menu_steps.rb +10 -0
- data/plugins/application/features/step_definitions/speedbar_steps.rb +8 -2
- data/plugins/application/features/step_definitions/tree_steps.rb +48 -6
- data/plugins/application/features/step_definitions/window_steps.rb +9 -4
- data/plugins/application/features/support/env.rb +20 -1
- data/plugins/application/features/support/fake_event.rb +14 -0
- data/plugins/application/lib/application.rb +29 -12
- data/plugins/application/lib/application/dialogs/filter_list_dialog.rb +19 -0
- data/plugins/application/lib/application/speedbar.rb +23 -17
- data/plugins/application/lib/application/tab.rb +20 -15
- data/plugins/application/lib/application/treebook.rb +10 -7
- data/plugins/application/lib/application/window.rb +1 -1
- data/plugins/application/plugin.rb +1 -1
- data/plugins/application_swt/lib/application_swt/dialog_adapter.rb +4 -4
- data/plugins/application_swt/lib/application_swt/dialogs/filter_list_dialog_controller.rb +15 -4
- data/plugins/application_swt/lib/application_swt/icon.rb +3 -5
- data/plugins/application_swt/lib/application_swt/notebook/tab_drag_and_drop_listener.rb +4 -4
- data/plugins/application_swt/lib/application_swt/notebook/tab_transfer.rb +5 -5
- data/plugins/application_swt/lib/application_swt/speedbar.rb +34 -120
- data/plugins/application_swt/lib/application_swt/speedbar/button_item.rb +20 -0
- data/plugins/application_swt/lib/application_swt/speedbar/combo_item.rb +38 -0
- data/plugins/application_swt/lib/application_swt/speedbar/label_item.rb +15 -0
- data/plugins/application_swt/lib/application_swt/speedbar/slider_item.rb +32 -0
- data/plugins/application_swt/lib/application_swt/speedbar/text_box_item.rb +36 -0
- data/plugins/application_swt/lib/application_swt/speedbar/toggle_item.rb +29 -0
- data/plugins/application_swt/lib/application_swt/tab.rb +1 -3
- data/plugins/application_swt/lib/application_swt/toolbar.rb +19 -20
- data/plugins/application_swt/lib/application_swt/treebook.rb +24 -9
- data/plugins/application_swt/lib/application_swt/window.rb +110 -98
- data/plugins/application_swt/lib/swt/vtab_folder.rb +77 -32
- data/plugins/application_swt/lib/swt/vtab_item.rb +9 -0
- data/plugins/application_swt/lib/swt/vtab_label.rb +63 -23
- data/plugins/application_swt/plugin.rb +1 -1
- data/plugins/clipboard-viewer/lib/clipboard_viewer/clipboard_bar.rb +2 -2
- data/plugins/comment/features/line_comment.feature +116 -4
- data/plugins/comment/lib/comment.rb +18 -16
- data/plugins/connection_manager/lib/connection_manager/commands.rb +1 -1
- data/plugins/connection_manager/lib/connection_manager/private_key_store.rb +5 -3
- data/plugins/declarations/lib/declarations.rb +1 -1
- data/plugins/declarations/lib/declarations/parser.rb +68 -20
- data/plugins/document_search/features/replace.feature +18 -0
- data/plugins/document_search/lib/document_search.rb +37 -54
- data/plugins/document_search/lib/document_search/replace_all_command.rb +27 -0
- data/plugins/document_search/lib/document_search/replace_command.rb +38 -0
- data/plugins/document_search/lib/document_search/replace_next_command.rb +27 -0
- data/plugins/document_search/lib/document_search/search_and_replace.rb +17 -24
- data/plugins/edit_view/features/step_definitions/editing_steps.rb +4 -4
- data/plugins/edit_view/features/step_definitions/tab_steps.rb +9 -0
- data/plugins/edit_view/features/step_definitions/window_steps.rb +0 -12
- data/plugins/edit_view/lib/edit_view/document.rb +2 -0
- data/plugins/edit_view/lib/edit_view/document/command.rb +8 -8
- data/plugins/edit_view/lib/edit_view/edit_tab.rb +21 -7
- data/plugins/edit_view/lib/edit_view/select_font_dialog.rb +6 -0
- data/plugins/edit_view/lib/edit_view/select_theme_dialog.rb +6 -0
- data/plugins/edit_view_swt/lib/edit_view_swt.rb +92 -43
- data/plugins/edit_view_swt/lib/edit_view_swt/document.rb +17 -4
- data/plugins/find-in-project/lib/find_in_project.rb +1 -4
- data/plugins/find-in-project/lib/find_in_project/commands.rb +0 -14
- data/plugins/find-in-project/lib/find_in_project/controllers.rb +12 -0
- data/plugins/find-in-project/lib/find_in_project/views/index.html.erb +5 -0
- data/plugins/groovy/features/fixtures/test.groovy +0 -0
- data/plugins/groovy/features/step_definitions/groovy_steps.rb +27 -0
- data/plugins/groovy/features/support/env.rb +27 -0
- data/plugins/groovy/features/syntax_check_groovy.feature +72 -0
- data/plugins/groovy/lib/syntax_check/groovy.rb +76 -0
- data/plugins/groovy/plugin.rb +7 -0
- data/plugins/help/lib/help.rb +28 -4
- data/plugins/help/lib/help/help_tab.rb +11 -0
- data/plugins/help/lib/help/view_controller.rb +25 -0
- data/plugins/help/plugin.rb +2 -1
- data/plugins/{view_shortcuts → help}/views/default.css +0 -0
- data/plugins/{view_shortcuts → help}/views/index.html.erb +1 -1
- data/plugins/{view_shortcuts → help}/views/redcar_small_icon.png +0 -0
- data/plugins/html_view/features/browser_bar.feature +47 -0
- data/plugins/html_view/features/fixtures/other.html +1 -0
- data/plugins/html_view/features/fixtures/sample.html +1 -0
- data/plugins/html_view/features/step_definitions/html_view_steps.rb +45 -5
- data/plugins/html_view/features/support/env.rb +26 -0
- data/plugins/html_view/features/web_preview.feature +21 -0
- data/plugins/html_view/lib/html_controller.rb +5 -5
- data/plugins/html_view/lib/html_view.rb +62 -10
- data/plugins/{web_bookmarks/lib/web_bookmarks → html_view/lib/html_view}/browser_bar.rb +32 -20
- data/plugins/html_view/lib/html_view/commands.rb +64 -0
- data/plugins/{web_bookmarks/lib/web_bookmarks/view_controller.rb → html_view/lib/html_view/default_controller.rb} +7 -6
- data/plugins/html_view/lib/html_view/html_tab.rb +17 -6
- data/plugins/html_view/plugin.rb +3 -3
- data/plugins/{web_bookmarks → html_view}/views/index.html.erb +0 -0
- data/plugins/javascript/features/fixtures/test.js +0 -0
- data/plugins/javascript/features/support/env.rb +4 -0
- data/plugins/javascript/features/syntax_check_javascript.feature +27 -0
- data/plugins/javascript/lib/syntax_check/javascript.rb +52 -0
- data/plugins/javascript/plugin.rb +7 -0
- data/plugins/javascript/vendor/jslint.js +539 -0
- data/plugins/macros/lib/macros/commands.rb +3 -3
- data/plugins/open_default_app/lib/open_default_app.rb +29 -3
- data/plugins/open_default_app/plugin.rb +1 -1
- data/plugins/outline_view/features/outline_view.feature +79 -0
- data/plugins/outline_view/features/step_definitions/outline_steps.rb +45 -0
- data/plugins/outline_view/lib/outline_view.rb +1 -1
- data/plugins/outline_view/spec/fixtures/some_project/javascript.js +10 -0
- data/plugins/outline_view/spec/fixtures/some_project/nothing_to_see.rb +0 -0
- data/plugins/outline_view/spec/fixtures/some_project/one_lonely_class.rb +2 -0
- data/plugins/outline_view/spec/fixtures/some_project/similar_names.rb +18 -0
- data/plugins/outline_view/spec/fixtures/some_project/something_fancy.rb +736 -0
- data/plugins/outline_view/spec/fixtures/some_project/trailing_space.rb +5 -0
- data/plugins/outline_view_swt/lib/outline_view_swt.rb +17 -19
- data/plugins/pair_highlighter/lib/pair_highlighter/document_controller.rb +1 -4
- data/plugins/plugin_manager_ui/lib/plugin_manager_ui.rb +12 -3
- data/plugins/project/features/close_directory_tree.feature +27 -0
- data/plugins/project/features/highlight_focussed_tab.feature +45 -1
- data/plugins/project/features/open_and_save_files.feature +33 -0
- data/plugins/project/features/open_directory_tree.feature +37 -11
- data/plugins/project/features/step_definitions/directory_steps.rb +1 -1
- data/plugins/project/features/step_definitions/drb_steps.rb +40 -0
- data/plugins/project/features/support/env.rb +17 -0
- data/plugins/project/lib/project.rb +12 -2
- data/plugins/project/lib/project/commands.rb +101 -99
- data/plugins/project/lib/project/drb_service.rb +55 -65
- data/plugins/project/lib/project/manager.rb +29 -4
- data/plugins/project/lib/project/project_tree_controller.rb +24 -0
- data/plugins/project/lib/project/support/trash.rb +1 -0
- data/plugins/redcar/redcar.rb +100 -37
- data/plugins/redcar_debug/lib/redcar_debug.rb +3 -3
- data/plugins/repl/features/step_definitions/repl_steps.rb +3 -0
- data/plugins/repl/lib/repl.rb +4 -11
- data/plugins/repl/lib/repl/repl_tab.rb +26 -0
- data/plugins/ruby/features/fixtures/test.rb +0 -0
- data/plugins/ruby/features/support/env.rb +4 -0
- data/plugins/ruby/features/syntax_check_ruby.feature +25 -0
- data/plugins/runnables/features/command_tree.feature +28 -0
- data/plugins/runnables/lib/runnables.rb +1 -0
- data/plugins/runnables/lib/runnables/commands.rb +4 -4
- data/plugins/runnables/lib/runnables/output_processor.rb +5 -5
- data/plugins/runnables/lib/runnables/tree_mirror/tree_controller.rb +2 -7
- data/plugins/runnables/lib/runnables/tree_mirror/tree_mirror.rb +13 -8
- data/plugins/scm_git/lib/scm_git/change.rb +5 -5
- data/plugins/strip_trailing_spaces/features/fixtures/test.txt +3 -0
- data/plugins/strip_trailing_spaces/features/strip_trailing_spaces.feature +34 -0
- data/plugins/strip_trailing_spaces/lib/strip_trailing_spaces.rb +3 -38
- data/plugins/swt/lib/swt.rb +5 -13
- data/plugins/swt/lib/swt/full_swt.rb +15 -13
- data/plugins/syntax_check/features/step_definitions/syntax_check_steps.rb +7 -0
- data/plugins/syntax_check/lib/syntax_check.rb +21 -3
- data/plugins/syntax_check/lib/syntax_check/error.rb +4 -3
- data/plugins/task_manager/lib/task_manager.rb +1 -1
- data/plugins/textmate/vendor/redcar-bundles/Bundles/Ant.tmbundle/Preferences/Autocompletions.tmPreferences +345 -0
- data/plugins/textmate/vendor/redcar-bundles/Bundles/Ant.tmbundle/Preferences/Symbol List Target.tmPreferences +22 -0
- data/plugins/textmate/vendor/redcar-bundles/Bundles/Ant.tmbundle/Snippets/Doc Banner.tmSnippet +20 -0
- data/plugins/textmate/vendor/redcar-bundles/Bundles/Ant.tmbundle/Syntaxes/Ant.tmLanguage +247 -0
- data/plugins/textmate/vendor/redcar-bundles/Bundles/Ant.tmbundle/info.plist +55 -0
- data/plugins/textmate/vendor/redcar-bundles/Bundles/RedcarRepl.tmbundle/Syntaxes/GroovyRepl.plist +40 -0
- data/plugins/textmate/vendor/redcar-bundles/Bundles/RedcarRepl.tmbundle/info.plist +1 -1
- data/plugins/textmate/vendor/redcar-bundles/Bundles/Ruby Haml.tmbundle/Syntaxes/Ruby_Haml.tmLanguage +0 -1
- data/plugins/textmate/vendor/redcar-bundles/Bundles/Ruby Sass.tmbundle/Syntaxes/Ruby Sass.tmLanguage +626 -0
- data/plugins/textmate/vendor/redcar-bundles/Bundles/Ruby Sass.tmbundle/info.plist +16 -0
- data/plugins/todo_list/features/support/env.rb +8 -0
- data/plugins/todo_list/features/todo_list.feature +26 -0
- data/plugins/todo_list/lib/todo_list.rb +1 -0
- data/plugins/todo_list/lib/todo_list/file_parser.rb +23 -19
- data/plugins/todo_list/lib/todo_list/todo_controller.rb +60 -100
- data/plugins/todo_list/spec/fixtures/project/FIXME.file +3 -0
- data/plugins/todo_list/spec/fixtures/project/NOTE.ignored.file +1 -0
- data/plugins/todo_list/spec/fixtures/project/OPTIMIZE_colon.file +1 -0
- data/plugins/todo_list/spec/fixtures/project/XXX.ignored +1 -0
- data/plugins/todo_list/spec/fixtures/project/ignored_directory/TODO.file +2 -0
- data/plugins/todo_list/spec/fixtures/settings.rb +11 -0
- data/plugins/todo_list/spec/spec_helper.rb +6 -0
- data/plugins/todo_list/spec/todo_list/file_parser_spec.rb +35 -0
- data/plugins/tree/lib/tree.rb +1 -0
- data/plugins/tree/lib/tree/command.rb +5 -0
- data/plugins/web_bookmarks/features/bookmark.feature +37 -0
- data/plugins/web_bookmarks/features/fixtures/other.html +1 -0
- data/plugins/web_bookmarks/features/fixtures/sample.html +1 -0
- data/plugins/web_bookmarks/features/step_definitions/web_steps.rb +4 -0
- data/plugins/web_bookmarks/features/support/env.rb +26 -0
- data/plugins/web_bookmarks/lib/web_bookmarks.rb +0 -10
- data/plugins/web_bookmarks/lib/web_bookmarks/bookmark.rb +10 -1
- data/plugins/web_bookmarks/lib/web_bookmarks/commands.rb +1 -47
- data/plugins/web_bookmarks/lib/web_bookmarks/tree.rb +21 -14
- data/{plugins/application → share}/icons/close.png +0 -0
- data/{plugins/application → share}/icons/darwin-file.png +0 -0
- data/{plugins/application → share}/icons/darwin-folder.png +0 -0
- data/share/icons/open-source-flipped.png +0 -0
- data/{plugins/application/icons/redcar_icon_beta_dev.png → share/icons/redcar-icon-beta-dev.png} +0 -0
- data/{plugins/application/icons/redcar_icon_beta.png → share/icons/redcar-icon-beta.png} +0 -0
- data/{plugins/application → share}/icons/redcar-splash.png +0 -0
- metadata +90 -30
- data/lib/redcar/jvm_options_probe.rb +0 -33
- data/plugins/document_search/lib/document_search/replace.rb +0 -113
- data/plugins/document_search/lib/document_search/search.rb +0 -45
- data/plugins/outline_view_swt/lib/icons/alias.png +0 -0
- data/plugins/outline_view_swt/lib/icons/assignment.png +0 -0
- data/plugins/outline_view_swt/lib/icons/attribute.png +0 -0
- data/plugins/outline_view_swt/lib/icons/class.png +0 -0
- data/plugins/outline_view_swt/lib/icons/interface.png +0 -0
- data/plugins/outline_view_swt/lib/icons/method.png +0 -0
- data/plugins/strip_trailing_spaces/CHANGELOG +0 -12
- data/plugins/strip_trailing_spaces/README.md +0 -32
- data/plugins/view_shortcuts/lib/view_shortcuts.rb +0 -52
- data/plugins/view_shortcuts/plugin.rb +0 -11
|
@@ -57,6 +57,7 @@ module Redcar
|
|
|
57
57
|
end
|
|
58
58
|
|
|
59
59
|
def offset_at_line(line_ix)
|
|
60
|
+
line_ix = [line_ix, line_count - 1].min
|
|
60
61
|
jface_document.get_line_offset(line_ix)
|
|
61
62
|
end
|
|
62
63
|
|
|
@@ -72,15 +73,27 @@ module Redcar
|
|
|
72
73
|
def replace(offset, length, text)
|
|
73
74
|
@model.verify_text(offset, offset+length, text)
|
|
74
75
|
jface_document.replace(offset, length, text)
|
|
75
|
-
#if length > text.length
|
|
76
|
-
# @swt_mate_document.mateText.redraw
|
|
77
|
-
#end
|
|
78
76
|
@model.modify_text
|
|
79
77
|
end
|
|
80
78
|
|
|
81
79
|
def text=(text)
|
|
82
80
|
@model.verify_text(0, length, text)
|
|
83
|
-
|
|
81
|
+
top_pixel = styledText.getTopPixel
|
|
82
|
+
caret = cursor_offset
|
|
83
|
+
line = line_at_offset(caret)
|
|
84
|
+
caret = caret - offset_at_line(line)
|
|
85
|
+
|
|
86
|
+
styledText.setRedraw(false)
|
|
87
|
+
styledText.setText(text)
|
|
88
|
+
|
|
89
|
+
unless line > line_count - 1
|
|
90
|
+
# The documents new text is still longer than our previous position, restore position
|
|
91
|
+
line_offset = offset_at_line(line)
|
|
92
|
+
styledText.setCaretOffset([line_offset + caret, offset_at_line(line + 1) - 1].min)
|
|
93
|
+
styledText.setTopPixel(top_pixel)
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
styledText.setRedraw(true)
|
|
84
97
|
@model.modify_text
|
|
85
98
|
notify_listeners(:set_text)
|
|
86
99
|
end
|
|
@@ -7,10 +7,7 @@ module Redcar
|
|
|
7
7
|
Redcar::Menu::Builder.build do
|
|
8
8
|
sub_menu "Edit" do
|
|
9
9
|
sub_menu "Search" do
|
|
10
|
-
|
|
11
|
-
item "Find In Project!", Redcar::FindInProject::OpenSearch
|
|
12
|
-
item "Edit Preferences", Redcar::FindInProject::EditPreferences
|
|
13
|
-
end
|
|
10
|
+
item "Find In Project!", Redcar::FindInProject::OpenSearch
|
|
14
11
|
end
|
|
15
12
|
end
|
|
16
13
|
end
|
|
@@ -26,19 +26,5 @@ module Redcar
|
|
|
26
26
|
end
|
|
27
27
|
end
|
|
28
28
|
end
|
|
29
|
-
|
|
30
|
-
class EditPreferences < Redcar::Command
|
|
31
|
-
def execute
|
|
32
|
-
Redcar.app.make_sure_at_least_one_window_open # open a new window if needed
|
|
33
|
-
|
|
34
|
-
Redcar::FindInProject.storage # populate the file if it isn't already
|
|
35
|
-
|
|
36
|
-
tab = Redcar.app.focussed_window.new_tab(Redcar::EditTab)
|
|
37
|
-
mirror = Project::FileMirror.new(File.join(Redcar.user_dir, "storage", "find_in_project.yaml"))
|
|
38
|
-
tab.edit_view.document.mirror = mirror
|
|
39
|
-
tab.edit_view.reset_undo
|
|
40
|
-
tab.focus
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
29
|
end
|
|
44
30
|
end
|
|
@@ -51,6 +51,18 @@ module Redcar
|
|
|
51
51
|
doc.scroll_to_line(line.to_i)
|
|
52
52
|
nil
|
|
53
53
|
end
|
|
54
|
+
|
|
55
|
+
def preferences
|
|
56
|
+
Redcar.app.make_sure_at_least_one_window_open # open a new window if needed
|
|
57
|
+
|
|
58
|
+
Redcar::FindInProject.storage # populate the file if it isn't already
|
|
59
|
+
|
|
60
|
+
tab = Redcar.app.focussed_window.new_tab(Redcar::EditTab)
|
|
61
|
+
mirror = Project::FileMirror.new(File.join(Redcar.user_dir, "storage", "find_in_project.yaml"))
|
|
62
|
+
tab.edit_view.document.mirror = mirror
|
|
63
|
+
tab.edit_view.reset_undo
|
|
64
|
+
tab.focus
|
|
65
|
+
end
|
|
54
66
|
|
|
55
67
|
def close
|
|
56
68
|
Thread.kill(@thread) if @thread
|
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
<label for="match_case">Match case</label>
|
|
41
41
|
<input type="checkbox" id="with_context" <%="checked=checked" if @with_context %>>
|
|
42
42
|
<label for="with_context">With context</label>
|
|
43
|
+
<a href="#" title="Edit Preferences" id="edit_preferences">Edit Preferences...</a>
|
|
43
44
|
</td>
|
|
44
45
|
<td></td>
|
|
45
46
|
</tr>
|
|
@@ -94,6 +95,10 @@
|
|
|
94
95
|
$('#recent_queries').show();
|
|
95
96
|
}
|
|
96
97
|
});
|
|
98
|
+
|
|
99
|
+
$('#edit_preferences').click(function(ev) {
|
|
100
|
+
Controller.preferences();
|
|
101
|
+
});
|
|
97
102
|
|
|
98
103
|
// in the case the user wants to search for things like <table>, we need to unescape the entities
|
|
99
104
|
String.prototype.unescapeHTML = function() {
|
|
File without changes
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
When /^I add "([^"]*)" to the groovy classpath$/ do |dir|
|
|
2
|
+
File.open(File.expand_path("../../fixtures/.redcar/classpath.groovy", __FILE__), "a") do |f|
|
|
3
|
+
f.puts <<-CONFIG
|
|
4
|
+
def redcar_config = new File(getClass().protectionDomain.codeSource.location.path).parentFile
|
|
5
|
+
def project = redcar_config.parentFile
|
|
6
|
+
def classpath = []
|
|
7
|
+
|
|
8
|
+
//installed libraries
|
|
9
|
+
def lib = new File(project.path + File.separator + "lib")
|
|
10
|
+
lib.list().each {name -> classpath << lib.path+File.separator+name}
|
|
11
|
+
|
|
12
|
+
//compiled classes
|
|
13
|
+
def target_classes = new File(
|
|
14
|
+
project.path + File.separator +
|
|
15
|
+
"target" + File.separator +
|
|
16
|
+
"classes"
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
classpath << target_classes.path
|
|
20
|
+
|
|
21
|
+
//other classes
|
|
22
|
+
classpath << project.path + File.separator + "#{dir}"
|
|
23
|
+
|
|
24
|
+
return classpath.toArray()
|
|
25
|
+
CONFIG
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
After do
|
|
2
|
+
# Truncate the test file
|
|
3
|
+
File.open(File.expand_path("../../fixtures/test.groovy", __FILE__), "w")
|
|
4
|
+
|
|
5
|
+
#recreate the classpath file
|
|
6
|
+
File.open(File.expand_path("../../fixtures/.redcar/classpath.groovy", __FILE__), "w") do |f|
|
|
7
|
+
f.puts <<-CONFIG
|
|
8
|
+
def redcar_config = new File(getClass().protectionDomain.codeSource.location.path).parentFile
|
|
9
|
+
def project = redcar_config.parentFile
|
|
10
|
+
def classpath = []
|
|
11
|
+
|
|
12
|
+
//installed libraries
|
|
13
|
+
def lib = new File(project.path + File.separator + "lib")
|
|
14
|
+
lib.list().each {name -> classpath << lib.path+File.separator+name}
|
|
15
|
+
|
|
16
|
+
//compiled classes
|
|
17
|
+
def target_classes = new File(
|
|
18
|
+
project.path + File.separator +
|
|
19
|
+
"target" + File.separator +
|
|
20
|
+
"classes"
|
|
21
|
+
)
|
|
22
|
+
classpath << target_classes.path
|
|
23
|
+
|
|
24
|
+
return classpath.toArray()
|
|
25
|
+
CONFIG
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
Feature: Syntax Checking for Groovy
|
|
2
|
+
As a user
|
|
3
|
+
I want to get annotations on syntax errors in Groovy files
|
|
4
|
+
|
|
5
|
+
Background:
|
|
6
|
+
When I have opened "plugins/groovy/features/fixtures/test.groovy"
|
|
7
|
+
|
|
8
|
+
Scenario: A syntax-clean Groovy file has no syntax error annotations
|
|
9
|
+
When I replace the contents with "class Foo {\n\n}"
|
|
10
|
+
And I save the tab
|
|
11
|
+
Then the tab should not have annotations
|
|
12
|
+
|
|
13
|
+
Scenario: A syntax-error in a Groovy file should cause syntax error annotations
|
|
14
|
+
When I replace the contents with "class Foo {\n sdef\n}"
|
|
15
|
+
And I save the tab
|
|
16
|
+
Then the tab should have annotations
|
|
17
|
+
And the tab should have an annotation on line 2
|
|
18
|
+
|
|
19
|
+
Scenario: Fixing a syntax-error in a Groovy file should cause syntax error annotations to vanish
|
|
20
|
+
When I replace the contents with "class Foo {\n sdef\n}"
|
|
21
|
+
And I save the tab
|
|
22
|
+
Then the tab should have annotations
|
|
23
|
+
When I replace the contents with "class Foo {\n\n}"
|
|
24
|
+
And I save the tab
|
|
25
|
+
Then the tab should not have annotations
|
|
26
|
+
|
|
27
|
+
Scenario: A file which references unknown groovy classes should cause syntax error annotations
|
|
28
|
+
And I replace the contents with "class Foo {\n def x = new Bar(10)\n def y = new FooBar()\n}"
|
|
29
|
+
And I save the tab
|
|
30
|
+
Then the tab should have annotations
|
|
31
|
+
And the tab should have an annotation on line 2
|
|
32
|
+
|
|
33
|
+
Scenario: A project can add libraries and compiled class directories to the groovy classpath
|
|
34
|
+
When I will choose "plugins/groovy/features/fixtures" from the "open_directory" dialog
|
|
35
|
+
And I open a directory
|
|
36
|
+
And I replace the contents with "class Foo {\n def x = new Bar(10)\n def y = new FooBar()\n}"
|
|
37
|
+
And I save the tab
|
|
38
|
+
Then the tab should not have annotations
|
|
39
|
+
|
|
40
|
+
Scenario: If a project classpath.groovy file has syntax errors, there should be an error message and annotations
|
|
41
|
+
And I close the focussed tab
|
|
42
|
+
Given I have not suppressed syntax checking message dialogs
|
|
43
|
+
When I will choose "plugins/groovy/features/fixtures" from the "open_directory" dialog
|
|
44
|
+
And I open a directory
|
|
45
|
+
And I have opened "plugins/groovy/features/fixtures/.redcar/classpath.groovy"
|
|
46
|
+
And I replace the contents with "def x = 4\nsdef"
|
|
47
|
+
And I save the tab
|
|
48
|
+
Then I should see a message box containing "An error occurred while loading groovy classpath file"
|
|
49
|
+
|
|
50
|
+
Scenario: If an error occurs while parsing a groovy file, there should be an error message
|
|
51
|
+
Given I have not suppressed syntax checking message dialogs
|
|
52
|
+
When I will choose "plugins/groovy/features/fixtures" from the "open_directory" dialog
|
|
53
|
+
And I open a directory
|
|
54
|
+
And I add "lib2" to the groovy classpath
|
|
55
|
+
And I replace the contents with "class Foo {\n def x = new Bar(10)\n def y = new FooBaz()\n}"
|
|
56
|
+
And I save the tab
|
|
57
|
+
Then I should see a message box containing "An error occurred while parsing"
|
|
58
|
+
And the tab should have an annotation on line 2
|
|
59
|
+
|
|
60
|
+
Scenario: If syntax message dialogs are suppressed, I should see no message boxes
|
|
61
|
+
Given I have suppressed syntax checking message dialogs
|
|
62
|
+
When I will choose "plugins/groovy/features/fixtures" from the "open_directory" dialog
|
|
63
|
+
And I open a directory
|
|
64
|
+
And I have opened "plugins/groovy/features/fixtures/.redcar/classpath.groovy"
|
|
65
|
+
And I replace the contents with "sdef"
|
|
66
|
+
And I save the tab
|
|
67
|
+
Then the tab should not have annotations
|
|
68
|
+
When I close the focussed tab
|
|
69
|
+
And I add "lib2" to the groovy classpath
|
|
70
|
+
And I replace the contents with "class Foo {\n def x = new Bar(10)\n def y = new FooBaz()\n}"
|
|
71
|
+
And I save the tab
|
|
72
|
+
Then the tab should have an annotation on line 2
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
require 'java'
|
|
2
|
+
|
|
3
|
+
module Redcar
|
|
4
|
+
module SyntaxCheck
|
|
5
|
+
class Groovy < Checker
|
|
6
|
+
supported_grammars "Groovy", "Easyb"
|
|
7
|
+
|
|
8
|
+
def initialize(document)
|
|
9
|
+
super
|
|
10
|
+
unless @loaded
|
|
11
|
+
require File.join(Redcar.asset_dir,"groovy-all")
|
|
12
|
+
import 'groovy.lang.GroovyShell'
|
|
13
|
+
import 'org.codehaus.groovy.control.CompilationFailedException'
|
|
14
|
+
import 'org.codehaus.groovy.control.CompilerConfiguration'
|
|
15
|
+
@loaded = true
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def check(*args)
|
|
20
|
+
path = manifest_path(doc)
|
|
21
|
+
name = File.basename(path)
|
|
22
|
+
shell = create_shell
|
|
23
|
+
text = doc.get_all_text
|
|
24
|
+
io = java.io.File.new(path)
|
|
25
|
+
begin
|
|
26
|
+
shell.parse(io)
|
|
27
|
+
rescue CompilationFailedException => e
|
|
28
|
+
create_syntax_error(doc, e.message, name).annotate
|
|
29
|
+
rescue Object => e
|
|
30
|
+
SyntaxCheck.message(
|
|
31
|
+
"An error occurred while parsing #{name}: #{e.message}",:error)
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def create_syntax_error(doc, message, name)
|
|
36
|
+
message =~ /#{Regexp.escape(name)}: (\d+):(.*)/
|
|
37
|
+
line = $1.to_i - 1
|
|
38
|
+
message = $2
|
|
39
|
+
SyntaxCheck::Error.new(doc, line, message)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def classpath_files(project)
|
|
43
|
+
project.config_files("classpath.groovy")
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def classpath(project)
|
|
47
|
+
parts = []
|
|
48
|
+
shell = GroovyShell.new
|
|
49
|
+
files = classpath_files(project)
|
|
50
|
+
return unless files.any?
|
|
51
|
+
files.each do |path|
|
|
52
|
+
begin
|
|
53
|
+
file = java.io.File.new(path)
|
|
54
|
+
part = shell.run(file, [])
|
|
55
|
+
parts += part if part
|
|
56
|
+
rescue Object => e
|
|
57
|
+
SyntaxCheck.message(
|
|
58
|
+
"An error occurred while loading groovy classpath file #{path}: #{e.message}",:error)
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
parts
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def create_shell
|
|
65
|
+
config = CompilerConfiguration.new
|
|
66
|
+
if project = Redcar::Project::Manager.focussed_project
|
|
67
|
+
classpath = classpath(project)
|
|
68
|
+
config.setClasspathList(classpath) if classpath and classpath.any?
|
|
69
|
+
end
|
|
70
|
+
shell = GroovyShell.new(config)
|
|
71
|
+
shell.setProperty("out",nil)
|
|
72
|
+
shell
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
end
|
data/plugins/help/lib/help.rb
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
|
|
2
|
+
require 'help/view_controller'
|
|
3
|
+
require 'help/help_tab'
|
|
4
|
+
|
|
2
5
|
module Redcar
|
|
3
6
|
class Help
|
|
4
7
|
def self.menus
|
|
@@ -7,6 +10,7 @@ module Redcar
|
|
|
7
10
|
group(:priority => :first) do
|
|
8
11
|
item "Online Help", :command => OnlineHelpCommand
|
|
9
12
|
item "Submit a Bug", :command => SubmitABugCommand
|
|
13
|
+
item "Keyboard Shortcuts", :command => ViewShortcutsCommand
|
|
10
14
|
end
|
|
11
15
|
end
|
|
12
16
|
end
|
|
@@ -19,20 +23,40 @@ module Redcar
|
|
|
19
23
|
[map]
|
|
20
24
|
end
|
|
21
25
|
|
|
26
|
+
def self.toolbars
|
|
27
|
+
ToolBar::Builder.build do
|
|
28
|
+
item "Keyboard Shortcuts", :command => ViewShortcutsCommand, :icon => File.join(Redcar::ICONS_DIRECTORY, "/keyboard.png"), :barname => :help
|
|
29
|
+
item "Help", :command => OnlineHelpCommand, :icon => File.join(Redcar::ICONS_DIRECTORY, "/question.png"), :barname => :help
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
class ViewShortcutsCommand < Redcar::Command
|
|
34
|
+
def execute
|
|
35
|
+
controller = Help::ViewController.new
|
|
36
|
+
tab = win.new_tab(Help::HelpTab)
|
|
37
|
+
tab.html_view.controller = controller
|
|
38
|
+
tab.focus
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
22
42
|
class SubmitABugCommand < Redcar::Command
|
|
23
43
|
def execute
|
|
24
|
-
Redcar::
|
|
44
|
+
Redcar::HtmlView::DisplayWebContent.new(
|
|
25
45
|
"Submit a Bug",
|
|
26
|
-
"https://redcar.lighthouseapp.com/projects/25090-redcar/tickets/new"
|
|
46
|
+
"https://redcar.lighthouseapp.com/projects/25090-redcar/tickets/new",
|
|
47
|
+
true,
|
|
48
|
+
Help::HelpTab
|
|
27
49
|
).run
|
|
28
50
|
end
|
|
29
51
|
end
|
|
30
52
|
|
|
31
53
|
class OnlineHelpCommand < Redcar::Command
|
|
32
54
|
def execute
|
|
33
|
-
Redcar::
|
|
55
|
+
Redcar::HtmlView::DisplayWebContent.new(
|
|
34
56
|
"Online Help",
|
|
35
|
-
"http://github.com/redcar/redcar/wiki/Users-Guide"
|
|
57
|
+
"http://github.com/redcar/redcar/wiki/Users-Guide",
|
|
58
|
+
true,
|
|
59
|
+
Help::HelpTab
|
|
36
60
|
).run
|
|
37
61
|
end
|
|
38
62
|
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
module Redcar
|
|
2
|
+
class Help
|
|
3
|
+
class ViewController
|
|
4
|
+
include HtmlController
|
|
5
|
+
|
|
6
|
+
def title
|
|
7
|
+
"Shortcuts"
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def clean_name(command)
|
|
11
|
+
name = command.to_s.sub("Command","")
|
|
12
|
+
idx = name.rindex("::")
|
|
13
|
+
unless idx.nil?
|
|
14
|
+
name = name[idx+2,name.length]
|
|
15
|
+
end
|
|
16
|
+
name = name.split(/(?=[A-Z])/).map{|w| w}.join(" ").sub("R E P L","REPL")
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def index
|
|
20
|
+
rhtml = ERB.new(File.read(File.join(File.dirname(__FILE__), "..", "..", "views", "index.html.erb")))
|
|
21
|
+
rhtml.result(binding)
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
data/plugins/help/plugin.rb
CHANGED
|
File without changes
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<html>
|
|
2
2
|
<head>
|
|
3
3
|
<title>Keyboard Shortcuts</title>
|
|
4
|
-
<% redcar_css = File.expand_path(File.join(Redcar.root, %w(plugins
|
|
4
|
+
<% redcar_css = File.expand_path(File.join(Redcar.root, %w(plugins help views default.css))) %>
|
|
5
5
|
<link rel="stylesheet" href="file://<%= redcar_css %>" type="text/css" media="screen">
|
|
6
6
|
</head>
|
|
7
7
|
<body>
|