redcar 0.9.2 → 0.10
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 +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
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
$LOAD_PATH << File.expand_path(File.dirname(__FILE__) + "/../../lib")
|
|
2
|
+
$LOAD_PATH << File.expand_path(File.dirname(__FILE__) + "/..")
|
|
3
|
+
require 'lucene'
|
|
4
|
+
require 'lucene/spec_helper'
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
describe Lucene::QueryDSL, 'used from Index.find' do
|
|
8
|
+
|
|
9
|
+
before(:each) do
|
|
10
|
+
setup_lucene
|
|
11
|
+
@index = Index.new('my_index')
|
|
12
|
+
@index.field_infos[:value][:type] = Fixnum
|
|
13
|
+
@index << {:id => '42', :name => 'andreas', :foo => 'bar', :value => 1}
|
|
14
|
+
@index << {:id => '43', :name => 'andreas', :foo => 'baaz', :value => 2}
|
|
15
|
+
@index << {:id => '44', :name => 'x', :foo => 'bar', :value => 3}
|
|
16
|
+
@index << {:id => '45', :name => ['x','y','z']}
|
|
17
|
+
|
|
18
|
+
@doc1 = @index.uncommited['42']
|
|
19
|
+
@doc2 = @index.uncommited['43']
|
|
20
|
+
@doc3 = @index.uncommited['44']
|
|
21
|
+
@doc4 = @index.uncommited['45']
|
|
22
|
+
@index.commit
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
it "should find a document using a simple dsl query" do
|
|
26
|
+
hits = @index.find { name == 'andreas'}
|
|
27
|
+
|
|
28
|
+
hits.size.should == 2
|
|
29
|
+
hits.should include(@doc1, @doc2)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
it "should find a document using a compound | expression" do
|
|
33
|
+
hits = @index.find { (name == 'andreas') | (name == 'x')}
|
|
34
|
+
hits.size.should == 4
|
|
35
|
+
hits.should include(@doc1, @doc2, @doc3, @doc4)
|
|
36
|
+
|
|
37
|
+
hits = @index.find { (name == 'andreasx') | (name == 'x')}
|
|
38
|
+
hits.size.should == 2
|
|
39
|
+
hits.should include(@doc3, @doc4)
|
|
40
|
+
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
it "should find a document using a compound & expression with the same key" do
|
|
44
|
+
hits = @index.find { (name == 'y') & (name == 'x')}
|
|
45
|
+
hits.size.should == 1
|
|
46
|
+
hits.should include(@doc4)
|
|
47
|
+
|
|
48
|
+
hits = @index.find { (name == 'y') & (name == 'x') & (name == 'a')}
|
|
49
|
+
hits.size.should == 0
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
it "should find with Range" do
|
|
53
|
+
hits = @index.find { value == 2..9 }
|
|
54
|
+
hits.size.should == 2
|
|
55
|
+
hits.should include(@doc2, @doc3)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
it "should find with Range in a compound expression " do
|
|
59
|
+
hits = @index.find { (name == 'andreas') & (value == 2..9) }
|
|
60
|
+
hits.size.should == 1
|
|
61
|
+
hits.should include(@doc2)
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
it "should find with a compound & expression" do
|
|
66
|
+
hits = @index.find { (name == 'andreas') & (foo == 'bar')}
|
|
67
|
+
|
|
68
|
+
hits.size.should == 1
|
|
69
|
+
hits.should include(@doc1)
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
describe Lucene::QueryDSL do
|
|
75
|
+
|
|
76
|
+
it "should parse & expressions" do
|
|
77
|
+
expr = Lucene::QueryDSL.parse{ (name == 'andreas') & (age == 30)}
|
|
78
|
+
expr.op.should == :&
|
|
79
|
+
expr.left.left.should == :name
|
|
80
|
+
expr.left.right.should == 'andreas'
|
|
81
|
+
|
|
82
|
+
expr.right.left.should == :age
|
|
83
|
+
expr.right.right.should == 30
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
it "should parse | expressions" do
|
|
87
|
+
expr = Lucene::QueryDSL.parse{ (name == 'andreas') | (age == 30)}
|
|
88
|
+
expr.op.should == :|
|
|
89
|
+
expr.left.left.should == :name
|
|
90
|
+
expr.left.right.should == 'andreas'
|
|
91
|
+
|
|
92
|
+
expr.right.left.should == :age
|
|
93
|
+
expr.right.right.should == 30
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
it "should parse range expressions" do
|
|
97
|
+
expr = Lucene::QueryDSL.parse{ name == 1..3}
|
|
98
|
+
|
|
99
|
+
expr.left.should == :name
|
|
100
|
+
expr.right.should be_kind_of(Range)
|
|
101
|
+
expr.right.first.should == 1
|
|
102
|
+
expr.right.last.should == 3
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
it "should generate a lucene query" do
|
|
106
|
+
expr = Lucene::QueryDSL.parse{ name == 'andreas' }
|
|
107
|
+
query = expr.to_lucene(Lucene::IndexInfo.new(:id))
|
|
108
|
+
query.should be_kind_of(Java::OrgApacheLuceneSearch::TermQuery)
|
|
109
|
+
term = query.getTerm
|
|
110
|
+
term.field.should == 'name'
|
|
111
|
+
term.text.should == 'andreas'
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
it "should know which fields are being used in a query" do
|
|
115
|
+
expr = Lucene::QueryDSL.parse{ name == 'andreas' }
|
|
116
|
+
expr._fields.should == [:name]
|
|
117
|
+
|
|
118
|
+
expr = Lucene::QueryDSL.parse{ (name == 'andreas') | (age == 1) }
|
|
119
|
+
expr._fields.should == [:name, :age]
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
it "should generate a lucene query" do
|
|
124
|
+
expr = Lucene::QueryDSL.parse{ (name == 'andreas') & (age == 1) }
|
|
125
|
+
query = expr.to_lucene(Lucene::IndexInfo.new(:id))
|
|
126
|
+
|
|
127
|
+
query.should be_kind_of(Java::OrgApacheLuceneSearch::BooleanQuery)
|
|
128
|
+
|
|
129
|
+
clauses = query.getClauses()
|
|
130
|
+
clauses.size.should == 2
|
|
131
|
+
|
|
132
|
+
term0 = clauses[0].getQuery.getTerm
|
|
133
|
+
term0.field.should == 'name'
|
|
134
|
+
term0.text.should == 'andreas'
|
|
135
|
+
|
|
136
|
+
term1 = clauses[1].getQuery.getTerm
|
|
137
|
+
term1.field.should == 'age'
|
|
138
|
+
term1.text.should == '1'
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
end
|
|
142
|
+
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
$LOAD_PATH << File.expand_path(File.dirname(__FILE__) + "/../../lib")
|
|
2
|
+
$LOAD_PATH << File.expand_path(File.dirname(__FILE__) + "/..")
|
|
3
|
+
require 'lucene'
|
|
4
|
+
require 'lucene/spec_helper'
|
|
5
|
+
|
|
6
|
+
describe "Index.find and sort" do
|
|
7
|
+
before(:all) do
|
|
8
|
+
setup_lucene
|
|
9
|
+
@index = Index.new('myindex')
|
|
10
|
+
@index.clear
|
|
11
|
+
@index << {:id => '1', :name => 'zzz', :category=>'abc', :group=>'z'}
|
|
12
|
+
@index << {:id => '2', :name => 'andreas', :category=>'abc',:group=>'z'}
|
|
13
|
+
@index << {:id => '3', :name => 'ted', :category=>'xyz',:group=>'z'}
|
|
14
|
+
@index << {:id => '4', :name => 'zoo', :category=>'abc',:group=>'z'}
|
|
15
|
+
@index << {:id => '5', :name => 'ted', :category=>'abc',:group=>'z'}
|
|
16
|
+
@index << {:id => '6', :name => 'ted', :category=>'zyx',:group=>'z'}
|
|
17
|
+
@index.commit
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
it "should handle find and sort by name using Asc" do
|
|
21
|
+
r = @index.find(:group => 'z', :sort_by=>Asc[:name])
|
|
22
|
+
r.size.should == 6
|
|
23
|
+
r[0][:id].should == '2'
|
|
24
|
+
r[4][:id].should == '4'
|
|
25
|
+
r[5][:id].should == '1'
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
it "should handle find and sort by name using Asc" do
|
|
29
|
+
r = @index.find(:group => 'z', :sort_by=>Desc[:name])
|
|
30
|
+
r.size.should == 6
|
|
31
|
+
r[0][:id].should == '1'
|
|
32
|
+
r[1][:id].should == '4'
|
|
33
|
+
r[5][:id].should == '2'
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
it "should handle find and sort by name" do
|
|
37
|
+
r = @index.find(:group => 'z', :sort_by=>:name)
|
|
38
|
+
r.size.should == 6
|
|
39
|
+
r[0][:id].should == '2'
|
|
40
|
+
r[4][:id].should == '4'
|
|
41
|
+
r[5][:id].should == '1'
|
|
42
|
+
|
|
43
|
+
sort_category = r[1][:id] == '5' &&
|
|
44
|
+
r[2][:id] == '3' &&
|
|
45
|
+
r[3][:id] == '6'
|
|
46
|
+
sort_category.should == false
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
it "should handle find and sort by name and category using Asc" do
|
|
50
|
+
r = @index.find(:group => 'z', :sort_by=>Asc[:name, :category])
|
|
51
|
+
r.size.should == 6
|
|
52
|
+
r[0][:id].should == '2'
|
|
53
|
+
r[4][:id].should == '4'
|
|
54
|
+
r[5][:id].should == '1'
|
|
55
|
+
r[1][:id].should == '5'
|
|
56
|
+
r[2][:id].should == '3'
|
|
57
|
+
r[3][:id].should == '6'
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
it "should handle find and sort by name and category using two Asc" do
|
|
61
|
+
r = @index.find(:group => 'z', :sort_by=>[Asc[:name], Asc[:category]])
|
|
62
|
+
r.size.should == 6
|
|
63
|
+
r[0][:id].should == '2'
|
|
64
|
+
r[4][:id].should == '4'
|
|
65
|
+
r[5][:id].should == '1'
|
|
66
|
+
r[1][:id].should == '5'
|
|
67
|
+
r[2][:id].should == '3'
|
|
68
|
+
r[3][:id].should == '6'
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
it "should handle find and sort by ASC name and DESC category" do
|
|
72
|
+
r = @index.find(:group => 'z', :sort_by=>[Asc[:name], Desc[:category]])
|
|
73
|
+
r.size.should == 6
|
|
74
|
+
r[0][:id].should == '2'
|
|
75
|
+
r[4][:id].should == '4'
|
|
76
|
+
r[5][:id].should == '1'
|
|
77
|
+
r[1][:id].should == '6'
|
|
78
|
+
r[2][:id].should == '3'
|
|
79
|
+
r[3][:id].should == '5'
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
it "should handle find and sort by name and category" do
|
|
83
|
+
r = @index.find(:group => 'z', :sort_by=>[:name,:category])
|
|
84
|
+
r.size.should == 6
|
|
85
|
+
r[0][:id].should == '2'
|
|
86
|
+
r[4][:id].should == '4'
|
|
87
|
+
r[5][:id].should == '1'
|
|
88
|
+
r[1][:id].should == '5'
|
|
89
|
+
r[2][:id].should == '3'
|
|
90
|
+
r[3][:id].should == '6'
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
it "should handle find with string and sort by name" do
|
|
94
|
+
r = @index.find("group:z", :sort_by=>:name)
|
|
95
|
+
r.size.should == 6
|
|
96
|
+
r[0][:id].should == '2'
|
|
97
|
+
r[4][:id].should == '4'
|
|
98
|
+
r[5][:id].should == '1'
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
end
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
$LOAD_PATH << File.expand_path(File.dirname(__FILE__) + "/../../lib")
|
|
2
|
+
$LOAD_PATH << File.expand_path(File.dirname(__FILE__) + "/..")
|
|
3
|
+
require 'lucene'
|
|
4
|
+
require 'lucene/spec_helper'
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
describe Lucene::Transaction do
|
|
8
|
+
|
|
9
|
+
before(:each) do
|
|
10
|
+
setup_lucene
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
it "should have a to_s method" do
|
|
14
|
+
t = Lucene::Transaction.new
|
|
15
|
+
t.to_s.should match(/Transaction \[commited=false, rollback=false, indexes=0, object_id=/)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
it "should reuse Index instance in the same transaction" do
|
|
19
|
+
# given
|
|
20
|
+
index = nil
|
|
21
|
+
Lucene::Transaction.run do
|
|
22
|
+
index1 = Index.new('var/index/foo')
|
|
23
|
+
index2 = Index.new('var/index/foo')
|
|
24
|
+
index1.object_id.should == index2.object_id
|
|
25
|
+
end # when it commits&
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
it "should create a new instance of Index if running in a new transaction" do
|
|
29
|
+
# given
|
|
30
|
+
index1 = nil
|
|
31
|
+
index2 = nil
|
|
32
|
+
Lucene::Transaction.run do
|
|
33
|
+
index1 = Index.new('var/index/foo')
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
Lucene::Transaction.run do
|
|
37
|
+
index2 = Index.new('var/index/foo')
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
index1.object_id.should_not == index2.object_id
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
it "should update all indexes when it commits" do
|
|
44
|
+
# given
|
|
45
|
+
index = nil
|
|
46
|
+
Lucene::Transaction.run do
|
|
47
|
+
index = Index.new('var/index/foo')
|
|
48
|
+
index << {:id => '1', :name => 'andreas'}
|
|
49
|
+
end # when it commits&
|
|
50
|
+
|
|
51
|
+
# then
|
|
52
|
+
result = index.find('name' => 'andreas')
|
|
53
|
+
result.size.should == 1
|
|
54
|
+
result[0][:id].should == '1'
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
it "should not index docuements when transaction has rolled back" do
|
|
58
|
+
# given
|
|
59
|
+
index = nil
|
|
60
|
+
Lucene::Transaction.run do |t|
|
|
61
|
+
index = Index.new('var/index/foo')
|
|
62
|
+
index << {:id => '1', :name => 'andreas'}
|
|
63
|
+
t.failure
|
|
64
|
+
end # when it commits
|
|
65
|
+
|
|
66
|
+
# then
|
|
67
|
+
result = index.find('name' => 'andreas')
|
|
68
|
+
result.size.should == 0
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
it "should not find uncommited documents for a different thread" do
|
|
73
|
+
# given
|
|
74
|
+
t1 = Thread.start do
|
|
75
|
+
Lucene::Transaction.new
|
|
76
|
+
index = Index.new('var/index/foo')
|
|
77
|
+
index << {:id => '1', :name => 'andreas'}
|
|
78
|
+
index = Index.new('var/index/foo')
|
|
79
|
+
index.uncommited['1'].should_not be_nil
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
t1.join
|
|
83
|
+
index = Index.new('var/index/foo')
|
|
84
|
+
index.uncommited['1'].should be_nil
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
it "should update an index from several threads" do
|
|
88
|
+
threads = []
|
|
89
|
+
for i in 1..10 do
|
|
90
|
+
for k in 1..5 do
|
|
91
|
+
threads << Thread.start(i,k) do |ii,kk|
|
|
92
|
+
Lucene::Transaction.run do |t|
|
|
93
|
+
index = Index.new('var/index/foo')
|
|
94
|
+
id = (ii*10 + kk).to_s
|
|
95
|
+
value = "thread#{ii}#{kk}"
|
|
96
|
+
index << {:id => id, :name => value}
|
|
97
|
+
end # when it commits&
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
threads.each {|t| t.join}
|
|
104
|
+
|
|
105
|
+
# make sure we can find those
|
|
106
|
+
index = Index.new 'var/index/foo'
|
|
107
|
+
for i in 1..10 do
|
|
108
|
+
for k in 1..5 do
|
|
109
|
+
value = "thread#{i}#{k}"
|
|
110
|
+
result = index.find(:name => value)
|
|
111
|
+
result.size.should == 1
|
|
112
|
+
result[0][:id].should == (i*10 +k).to_s
|
|
113
|
+
end
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
end
|
|
118
|
+
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
Feature: The font size can be increased and decreased within bounds
|
|
2
|
+
|
|
3
|
+
Background:
|
|
4
|
+
Given I open a new edit tab
|
|
5
|
+
And I replace the contents with "Hello! Hello! Hello!"
|
|
6
|
+
|
|
7
|
+
Scenario: The font size can be increased until it reaches maximum size
|
|
8
|
+
When I set the font size to 14
|
|
9
|
+
Then the font size should be 14
|
|
10
|
+
And I increase the font size
|
|
11
|
+
Then the font size should be 15
|
|
12
|
+
When I set the font size to maximum
|
|
13
|
+
And I increase the font size
|
|
14
|
+
And I increase the font size
|
|
15
|
+
Then the font size should be maximum
|
|
16
|
+
|
|
17
|
+
Scenario: The font size can be decreased until it reaches minimum size
|
|
18
|
+
When I set the font size to 21
|
|
19
|
+
Then the font size should be 21
|
|
20
|
+
And I decrease the font size
|
|
21
|
+
Then the font size should be 20
|
|
22
|
+
When I set the font size to minimum
|
|
23
|
+
And I decrease the font size
|
|
24
|
+
And I decrease the font size
|
|
25
|
+
Then the font size should be minimum
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
When /^I set the font size to (\d+|maximum|minimum)$/ do |arg1|
|
|
2
|
+
if arg1 =~ /\d+/
|
|
3
|
+
size = arg1.to_i
|
|
4
|
+
elsif arg1 == 'maximum'
|
|
5
|
+
size = Redcar::EditView::MAX_FONT_SIZE
|
|
6
|
+
else
|
|
7
|
+
size = Redcar::EditView::MIN_FONT_SIZE
|
|
8
|
+
end
|
|
9
|
+
Given "I would type \"#{size}\" in an input box"
|
|
10
|
+
When "I set the font size"
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
When /^I (de|in)crease the font size$/ do |direction|
|
|
14
|
+
if direction == 'in'
|
|
15
|
+
Redcar::Top::IncreaseFontSize.new.run
|
|
16
|
+
else
|
|
17
|
+
Redcar::Top::DecreaseFontSize.new.run
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
When /^I set the font size$/ do
|
|
22
|
+
Redcar::Top::SelectFontSize.new.run
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
Then /^the font size should be (\d+|maximum|minimum)$/ do |size|
|
|
26
|
+
current = Redcar::EditView.font_size
|
|
27
|
+
if size =~ /\d+/
|
|
28
|
+
current.should == size.to_i
|
|
29
|
+
elsif size == 'maximum'
|
|
30
|
+
current.should == Redcar::EditView::MAX_FONT_SIZE
|
|
31
|
+
else
|
|
32
|
+
current.should == Redcar::EditView::MIN_FONT_SIZE
|
|
33
|
+
end
|
|
34
|
+
end
|
data/plugins/redcar/redcar.rb
CHANGED
|
@@ -16,11 +16,13 @@ module Redcar
|
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
def self.update_gui
|
|
19
|
+
result = nil
|
|
19
20
|
Swt.sync_exec do
|
|
20
21
|
safely do
|
|
21
|
-
yield
|
|
22
|
+
result = yield
|
|
22
23
|
end
|
|
23
24
|
end
|
|
25
|
+
result
|
|
24
26
|
end
|
|
25
27
|
|
|
26
28
|
class TimeoutError < StandardError; end
|
|
@@ -95,12 +97,12 @@ module Redcar
|
|
|
95
97
|
end
|
|
96
98
|
|
|
97
99
|
class NewNotebookCommand < Command
|
|
98
|
-
sensitize :single_notebook
|
|
100
|
+
# sensitize :single_notebook
|
|
99
101
|
|
|
100
102
|
def execute
|
|
101
|
-
unless win.notebooks.length > 1
|
|
103
|
+
#unless win.notebooks.length > 1
|
|
102
104
|
win.create_notebook
|
|
103
|
-
|
|
105
|
+
# end
|
|
104
106
|
end
|
|
105
107
|
end
|
|
106
108
|
|
|
@@ -263,12 +265,57 @@ module Redcar
|
|
|
263
265
|
|
|
264
266
|
def execute
|
|
265
267
|
current_notebook = tab.notebook
|
|
266
|
-
|
|
268
|
+
i = win.notebooks.index current_notebook
|
|
269
|
+
|
|
270
|
+
target_notebook = win.notebooks[ (i + 1) % win.notebooks.length ]
|
|
267
271
|
target_notebook.grab_tab_from(current_notebook, tab)
|
|
268
272
|
tab.focus
|
|
269
273
|
end
|
|
270
274
|
end
|
|
271
275
|
|
|
276
|
+
class OpenTreeFinderCommand < TreeCommand
|
|
277
|
+
|
|
278
|
+
def execute
|
|
279
|
+
if win = Redcar.app.focussed_window
|
|
280
|
+
if trees = win.treebook.trees and trees.any?
|
|
281
|
+
titles = []
|
|
282
|
+
trees.each {|t| titles << t.tree_mirror.title}
|
|
283
|
+
dialog = TreeFuzzyFilter.new(win,titles)
|
|
284
|
+
dialog.open
|
|
285
|
+
end
|
|
286
|
+
end
|
|
287
|
+
end
|
|
288
|
+
|
|
289
|
+
class TreeFuzzyFilter < FilterListDialog
|
|
290
|
+
|
|
291
|
+
def initialize(win,titles)
|
|
292
|
+
super()
|
|
293
|
+
@win = win
|
|
294
|
+
@titles = titles
|
|
295
|
+
end
|
|
296
|
+
|
|
297
|
+
def selected(text,ix)
|
|
298
|
+
if tree = @win.treebook.trees.detect do |tree|
|
|
299
|
+
tree.tree_mirror.title == text
|
|
300
|
+
end
|
|
301
|
+
if @win.treebook.focussed_tree == tree
|
|
302
|
+
@win.set_trees_visible(true) if not @win.trees_visible?
|
|
303
|
+
else
|
|
304
|
+
@win.treebook.focus_tree(tree)
|
|
305
|
+
end
|
|
306
|
+
tree.focus
|
|
307
|
+
close
|
|
308
|
+
end
|
|
309
|
+
end
|
|
310
|
+
|
|
311
|
+
def update_list(filter)
|
|
312
|
+
@titles.select do |t|
|
|
313
|
+
t.downcase.include?(filter.downcase)
|
|
314
|
+
end
|
|
315
|
+
end
|
|
316
|
+
end
|
|
317
|
+
end
|
|
318
|
+
|
|
272
319
|
class CloseTreeCommand < TreeCommand
|
|
273
320
|
def execute
|
|
274
321
|
win = Redcar.app.focussed_window
|
|
@@ -302,9 +349,9 @@ Ruby Version: #{RUBY_VERSION}
|
|
|
302
349
|
Jruby version: #{JRUBY_VERSION}
|
|
303
350
|
Redcar.environment: #{Redcar.environment}
|
|
304
351
|
TXT
|
|
305
|
-
new_tab.title= 'About'
|
|
306
352
|
new_tab.edit_view.reset_undo
|
|
307
353
|
new_tab.document.set_modified(false)
|
|
354
|
+
new_tab.title= 'About'
|
|
308
355
|
end
|
|
309
356
|
end
|
|
310
357
|
|
|
@@ -312,9 +359,9 @@ Redcar.environment: #{Redcar.environment}
|
|
|
312
359
|
def execute
|
|
313
360
|
new_tab = Top::NewCommand.new.run
|
|
314
361
|
new_tab.document.text = File.read(File.join(File.dirname(__FILE__), "..", "..", "CHANGES"))
|
|
315
|
-
new_tab.title = 'Changes'
|
|
316
362
|
new_tab.edit_view.reset_undo
|
|
317
363
|
new_tab.edit_view.document.set_modified(false)
|
|
364
|
+
new_tab.title = 'Changes'
|
|
318
365
|
end
|
|
319
366
|
end
|
|
320
367
|
|
|
@@ -342,6 +389,7 @@ Redcar.environment: #{Redcar.environment}
|
|
|
342
389
|
def execute
|
|
343
390
|
if tab.is_a?(EditTab)
|
|
344
391
|
if tab.edit_view.document.modified?
|
|
392
|
+
tab.focus
|
|
345
393
|
result = Application::Dialog.message_box(
|
|
346
394
|
"This tab has unsaved changes. \n\nSave before closing?",
|
|
347
395
|
:buttons => :yes_no_cancel
|
|
@@ -359,6 +407,7 @@ Redcar.environment: #{Redcar.environment}
|
|
|
359
407
|
end
|
|
360
408
|
elsif tab.is_a?(HtmlTab)
|
|
361
409
|
if tab.html_view.controller and message = tab.html_view.controller.ask_before_closing
|
|
410
|
+
tab.focus
|
|
362
411
|
result = Application::Dialog.message_box(
|
|
363
412
|
message,
|
|
364
413
|
:buttons => :yes_no_cancel
|
|
@@ -391,6 +440,45 @@ Redcar.environment: #{Redcar.environment}
|
|
|
391
440
|
end
|
|
392
441
|
end
|
|
393
442
|
|
|
443
|
+
class CloseAll < Redcar::Command
|
|
444
|
+
def execute
|
|
445
|
+
window = Redcar.app.focussed_window
|
|
446
|
+
tabs = window.all_tabs
|
|
447
|
+
tabs.each do |t|
|
|
448
|
+
Redcar::Top::CloseTabCommand.new(t).run
|
|
449
|
+
end
|
|
450
|
+
end
|
|
451
|
+
end
|
|
452
|
+
|
|
453
|
+
class CloseOthers < Redcar::Command
|
|
454
|
+
def execute
|
|
455
|
+
window = Redcar.app.focussed_window
|
|
456
|
+
current_tab = Redcar.app.focussed_notebook_tab
|
|
457
|
+
tabs = window.all_tabs
|
|
458
|
+
tabs.each do |t|
|
|
459
|
+
unless t == current_tab
|
|
460
|
+
Redcar::Top::CloseTabCommand.new(t).run
|
|
461
|
+
end
|
|
462
|
+
end
|
|
463
|
+
end
|
|
464
|
+
end
|
|
465
|
+
|
|
466
|
+
class SwitchTreeDownCommand < TreeCommand
|
|
467
|
+
|
|
468
|
+
def execute
|
|
469
|
+
win = Redcar.app.focussed_window
|
|
470
|
+
win.treebook.switch_down
|
|
471
|
+
end
|
|
472
|
+
end
|
|
473
|
+
|
|
474
|
+
class SwitchTreeUpCommand < TreeCommand
|
|
475
|
+
|
|
476
|
+
def execute
|
|
477
|
+
win = Redcar.app.focussed_window
|
|
478
|
+
win.treebook.switch_up
|
|
479
|
+
end
|
|
480
|
+
end
|
|
481
|
+
|
|
394
482
|
class SwitchTabDownCommand < TabCommand
|
|
395
483
|
|
|
396
484
|
def execute
|
|
@@ -438,6 +526,10 @@ Redcar.environment: #{Redcar.environment}
|
|
|
438
526
|
class MoveHomeCommand < DocumentCommand
|
|
439
527
|
|
|
440
528
|
def execute
|
|
529
|
+
if doc.mirror.is_a?(Redcar::REPL::ReplMirror)
|
|
530
|
+
# do not do the default home command on a line with a prompt
|
|
531
|
+
return unless tab.go_to_home?
|
|
532
|
+
end
|
|
441
533
|
line_ix = doc.line_at_offset(doc.cursor_offset)
|
|
442
534
|
line = doc.get_line(line_ix)
|
|
443
535
|
prefix = line[0...doc.cursor_line_offset]
|
|
@@ -759,6 +851,53 @@ Redcar.environment: #{Redcar.environment}
|
|
|
759
851
|
end
|
|
760
852
|
end
|
|
761
853
|
|
|
854
|
+
class TreebookWidthCommand < Command
|
|
855
|
+
sensitize :open_trees
|
|
856
|
+
|
|
857
|
+
def increment
|
|
858
|
+
raise "Please implement me!"
|
|
859
|
+
end
|
|
860
|
+
|
|
861
|
+
def execute
|
|
862
|
+
if win = Redcar.app.focussed_window
|
|
863
|
+
if increment > 0
|
|
864
|
+
win.adjust_treebook_width(true)
|
|
865
|
+
else
|
|
866
|
+
win.adjust_treebook_width(false)
|
|
867
|
+
end
|
|
868
|
+
end
|
|
869
|
+
end
|
|
870
|
+
end
|
|
871
|
+
|
|
872
|
+
["In","De"].each do |prefix|
|
|
873
|
+
const_set("#{prefix}creaseTreebookWidthCommand", Class.new(TreebookWidthCommand)).class_eval do
|
|
874
|
+
define_method :increment do
|
|
875
|
+
prefix == "In" ? 1 : -1
|
|
876
|
+
end
|
|
877
|
+
end
|
|
878
|
+
end
|
|
879
|
+
|
|
880
|
+
class EnlargeNotebookCommand < Command
|
|
881
|
+
sensitize :multiple_notebooks
|
|
882
|
+
def index
|
|
883
|
+
raise "Please define me!"
|
|
884
|
+
end
|
|
885
|
+
|
|
886
|
+
def execute
|
|
887
|
+
if win = Redcar.app.focussed_window
|
|
888
|
+
win.enlarge_notebook(index)
|
|
889
|
+
end
|
|
890
|
+
end
|
|
891
|
+
end
|
|
892
|
+
|
|
893
|
+
["First","Second"].each do |book|
|
|
894
|
+
const_set("Enlarge#{book}NotebookCommand", Class.new(EnlargeNotebookCommand)).class_eval do
|
|
895
|
+
define_method :index do
|
|
896
|
+
book == "First" ? 0 : 1
|
|
897
|
+
end
|
|
898
|
+
end
|
|
899
|
+
end
|
|
900
|
+
|
|
762
901
|
# define commands from SelectTab1Command to SelectTab9Command
|
|
763
902
|
(1..9).each do |tab_num|
|
|
764
903
|
const_set("SelectTab#{tab_num}Command", Class.new(Redcar::TabCommand)).class_eval do
|
|
@@ -769,6 +908,16 @@ Redcar.environment: #{Redcar.environment}
|
|
|
769
908
|
end
|
|
770
909
|
end
|
|
771
910
|
|
|
911
|
+
class ResetNotebookWidthsCommand < Command
|
|
912
|
+
sensitize :multiple_notebooks
|
|
913
|
+
|
|
914
|
+
def execute
|
|
915
|
+
if win = Redcar.app.focussed_window
|
|
916
|
+
win.reset_notebook_widths
|
|
917
|
+
end
|
|
918
|
+
end
|
|
919
|
+
end
|
|
920
|
+
|
|
772
921
|
class ToggleFullscreen < Command
|
|
773
922
|
def execute
|
|
774
923
|
Redcar.app.focussed_window.fullscreen = !Redcar.app.focussed_window.fullscreen
|
|
@@ -795,13 +944,13 @@ Redcar.environment: #{Redcar.environment}
|
|
|
795
944
|
end
|
|
796
945
|
end
|
|
797
946
|
|
|
798
|
-
class SelectNewFont <
|
|
947
|
+
class SelectNewFont < EditTabCommand
|
|
799
948
|
def execute
|
|
800
949
|
Redcar::EditView::SelectFontDialog.new.open
|
|
801
950
|
end
|
|
802
951
|
end
|
|
803
952
|
|
|
804
|
-
class SelectTheme <
|
|
953
|
+
class SelectTheme < EditTabCommand
|
|
805
954
|
def execute
|
|
806
955
|
Redcar::EditView::SelectThemeDialog.new.open
|
|
807
956
|
end
|
|
@@ -818,16 +967,39 @@ Redcar.environment: #{Redcar.environment}
|
|
|
818
967
|
def execute; end
|
|
819
968
|
end
|
|
820
969
|
|
|
821
|
-
class SelectFontSize <
|
|
970
|
+
class SelectFontSize < EditTabCommand
|
|
822
971
|
def execute
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
972
|
+
max = Redcar::EditView::MAX_FONT_SIZE
|
|
973
|
+
min = Redcar::EditView::MIN_FONT_SIZE
|
|
974
|
+
result = Application::Dialog.input(
|
|
975
|
+
"Font Size",
|
|
976
|
+
"Please enter new font size",
|
|
977
|
+
Redcar::EditView.font_size.to_s)
|
|
978
|
+
if result[:button] == :ok
|
|
979
|
+
value = result[:value].to_i
|
|
980
|
+
if value >= min and value <= max
|
|
981
|
+
Redcar::EditView.font_size = value
|
|
826
982
|
else
|
|
827
|
-
|
|
983
|
+
Application::Dialog.message_box(
|
|
984
|
+
"The font size must be between #{min} and #{max}")
|
|
828
985
|
end
|
|
829
|
-
|
|
830
|
-
|
|
986
|
+
end
|
|
987
|
+
end
|
|
988
|
+
end
|
|
989
|
+
|
|
990
|
+
class IncreaseFontSize < EditTabCommand
|
|
991
|
+
def execute
|
|
992
|
+
unless (current = Redcar::EditView.font_size) >= Redcar::EditView::MAX_FONT_SIZE
|
|
993
|
+
Redcar::EditView.font_size = current+1
|
|
994
|
+
end
|
|
995
|
+
end
|
|
996
|
+
end
|
|
997
|
+
|
|
998
|
+
class DecreaseFontSize < EditTabCommand
|
|
999
|
+
def execute
|
|
1000
|
+
unless (current = Redcar::EditView.font_size) <= Redcar::EditView::MIN_FONT_SIZE
|
|
1001
|
+
Redcar::EditView.font_size = current-1
|
|
1002
|
+
end
|
|
831
1003
|
end
|
|
832
1004
|
end
|
|
833
1005
|
|
|
@@ -844,11 +1016,12 @@ Redcar.environment: #{Redcar.environment}
|
|
|
844
1016
|
link "Cmd+Shift+S", Project::FileSaveAsCommand
|
|
845
1017
|
link "Cmd+W", CloseTabCommand
|
|
846
1018
|
link "Cmd+Shift+W", CloseWindowCommand
|
|
1019
|
+
link "Alt+Shift+W", CloseTreeCommand
|
|
847
1020
|
link "Cmd+Q", QuitCommand
|
|
848
1021
|
|
|
849
1022
|
#link "Cmd+Return", MoveNextLineCommand
|
|
850
1023
|
|
|
851
|
-
link "
|
|
1024
|
+
link "Ctrl+Shift+E", EditView::InfoSpeedbarCommand
|
|
852
1025
|
link "Cmd+Z", UndoCommand
|
|
853
1026
|
link "Cmd+Shift+Z", RedoCommand
|
|
854
1027
|
link "Cmd+X", CutCommand
|
|
@@ -865,16 +1038,14 @@ Redcar.environment: #{Redcar.environment}
|
|
|
865
1038
|
link "Cmd+]", IncreaseIndentCommand
|
|
866
1039
|
link "Cmd+Shift+I", AutoIndenter::IndentCommand
|
|
867
1040
|
link "Cmd+L", GotoLineCommand
|
|
868
|
-
link "Cmd+F", DocumentSearch::SearchForwardCommand
|
|
869
|
-
link "Cmd+H", DocumentSearch::SearchAndReplaceCommand
|
|
870
|
-
#link "Cmd+Shift+F", DocumentSearch::RepeatPreviousSearchForwardCommand
|
|
871
|
-
link "Cmd+Ctrl+F", DocumentSearch::SearchAndReplaceCommand
|
|
872
|
-
link "Cmd+Shift+F", Redcar::FindInProject::OpenSearch
|
|
873
1041
|
link "Cmd+A", SelectAllCommand
|
|
874
1042
|
link "Ctrl+W", SelectWordCommand
|
|
1043
|
+
link "Ctrl+L", SelectLineCommand
|
|
875
1044
|
link "Cmd+B", ToggleBlockSelectionCommand
|
|
876
|
-
|
|
877
|
-
link "Ctrl+Escape",
|
|
1045
|
+
link "Escape", AutoCompleter::AutoCompleteCommand
|
|
1046
|
+
link "Ctrl+Escape", AutoCompleter::MenuAutoCompleterCommand
|
|
1047
|
+
link "Ctrl+Space", AutoCompleter::AutoCompleteCommand
|
|
1048
|
+
link "Ctrl+Shift+Space", AutoCompleter::MenuAutoCompleterCommand
|
|
878
1049
|
|
|
879
1050
|
link "Ctrl+U", EditView::UpcaseTextCommand
|
|
880
1051
|
link "Ctrl+Shift+U", EditView::DowncaseTextCommand
|
|
@@ -882,23 +1053,35 @@ Redcar.environment: #{Redcar.environment}
|
|
|
882
1053
|
link "Ctrl+G", EditView::OppositeCaseTextCommand
|
|
883
1054
|
link "Ctrl+_", EditView::CamelSnakePascalRotateTextCommand
|
|
884
1055
|
link "Ctrl+=", EditView::AlignAssignmentCommand
|
|
1056
|
+
link "Ctrl+Shift+^", SortLinesCommand
|
|
885
1057
|
|
|
1058
|
+
link "Cmd+Shift+F", Redcar::FindInProject::OpenSearch
|
|
886
1059
|
link "Cmd+T", Project::FindFileCommand
|
|
887
1060
|
link "Cmd+Shift+Alt+O", MoveTabToOtherNotebookCommand
|
|
888
1061
|
link "Cmd+Alt+O", SwitchNotebookCommand
|
|
1062
|
+
link "Alt+Shift+[", SwitchTreeUpCommand
|
|
1063
|
+
link "Alt+Shift+]", SwitchTreeDownCommand
|
|
889
1064
|
link "Cmd+Shift+[", SwitchTabDownCommand
|
|
890
1065
|
link "Cmd+Shift+]", SwitchTabUpCommand
|
|
891
1066
|
link "Ctrl+Shift+[", MoveTabDownCommand
|
|
892
1067
|
link "Ctrl+Shift+]", MoveTabUpCommand
|
|
893
|
-
link "
|
|
1068
|
+
link "Cmd+Shift++", ToggleFullscreen
|
|
1069
|
+
link "Cmd+Shift+T", OpenTreeFinderCommand
|
|
1070
|
+
link "Alt+Shift+J", IncreaseTreebookWidthCommand
|
|
1071
|
+
link "Alt+Shift+H", DecreaseTreebookWidthCommand
|
|
1072
|
+
link "Cmd+Shift+>", EnlargeFirstNotebookCommand
|
|
1073
|
+
link "Cmd+Shift+<", EnlargeSecondNotebookCommand
|
|
1074
|
+
link "Cmd+Shift+L", ResetNotebookWidthsCommand
|
|
1075
|
+
link "Cmd+Shift+:", RotateNotebooksCommand
|
|
1076
|
+
link "Alt+Shift+N", CloseNotebookCommand
|
|
894
1077
|
link "Cmd+Alt+I", ToggleInvisibles
|
|
895
|
-
link "
|
|
896
|
-
link "Cmd
|
|
1078
|
+
link "Cmd++", IncreaseFontSize
|
|
1079
|
+
link "Cmd+-", DecreaseFontSize
|
|
897
1080
|
|
|
898
1081
|
link "Ctrl+Shift+P", PrintScopeCommand
|
|
899
1082
|
link "Cmd+Shift+H", ToggleTreesCommand
|
|
900
1083
|
|
|
901
|
-
link "Cmd+Shift+R", PluginManagerUi::ReloadLastReloadedCommand
|
|
1084
|
+
# link "Cmd+Shift+R", PluginManagerUi::ReloadLastReloadedCommand
|
|
902
1085
|
|
|
903
1086
|
link "Cmd+Alt+S", Snippets::OpenSnippetExplorer
|
|
904
1087
|
#Textmate.attach_keybindings(self, :osx)
|
|
@@ -921,6 +1104,7 @@ Redcar.environment: #{Redcar.environment}
|
|
|
921
1104
|
link "Ctrl+Shift+S", Project::FileSaveAsCommand
|
|
922
1105
|
link "Ctrl+W", CloseTabCommand
|
|
923
1106
|
link "Ctrl+Shift+W", CloseWindowCommand
|
|
1107
|
+
link "Alt+Shift+W", CloseTreeCommand
|
|
924
1108
|
link "Ctrl+Q", QuitCommand
|
|
925
1109
|
|
|
926
1110
|
link "Ctrl+Enter", MoveNextLineCommand
|
|
@@ -935,47 +1119,59 @@ Redcar.environment: #{Redcar.environment}
|
|
|
935
1119
|
|
|
936
1120
|
link "Ctrl+Home", MoveTopCommand
|
|
937
1121
|
link "Home", MoveHomeCommand
|
|
1122
|
+
link "Ctrl+Alt+A", MoveHomeCommand
|
|
938
1123
|
link "End", MoveEndCommand
|
|
1124
|
+
link "Ctrl+Alt+E", MoveEndCommand
|
|
939
1125
|
link "Ctrl+End", MoveBottomCommand
|
|
940
1126
|
|
|
941
1127
|
link "Ctrl+[", DecreaseIndentCommand
|
|
942
1128
|
link "Ctrl+]", IncreaseIndentCommand
|
|
943
1129
|
link "Ctrl+Shift+[", AutoIndenter::IndentCommand
|
|
944
1130
|
link "Ctrl+L", GotoLineCommand
|
|
945
|
-
link "Ctrl+
|
|
946
|
-
link "Ctrl+H", DocumentSearch::SearchAndReplaceCommand
|
|
947
|
-
link "F3", DocumentSearch::RepeatPreviousSearchForwardCommand
|
|
948
|
-
link "Ctrl+Shift+F", Redcar::FindInProject::OpenSearch
|
|
949
|
-
link "Ctrl+A", SelectAllCommand
|
|
1131
|
+
link "Ctrl+A", SelectAllCommand
|
|
950
1132
|
link "Ctrl+Alt+W", SelectWordCommand
|
|
1133
|
+
link "Ctrl+Alt+L", SelectLineCommand
|
|
951
1134
|
link "Ctrl+B", ToggleBlockSelectionCommand
|
|
952
|
-
link "
|
|
1135
|
+
link "Escape", AutoCompleter::AutoCompleteCommand
|
|
1136
|
+
link "Ctrl+Escape", AutoCompleter::MenuAutoCompleterCommand
|
|
1137
|
+
link "Ctrl+Space", AutoCompleter::AutoCompleteCommand
|
|
953
1138
|
link "Ctrl+Shift+Space", AutoCompleter::MenuAutoCompleterCommand
|
|
954
1139
|
|
|
955
1140
|
link "Ctrl+U", EditView::UpcaseTextCommand
|
|
956
1141
|
link "Ctrl+Shift+U", EditView::DowncaseTextCommand
|
|
957
1142
|
link "Ctrl+Alt+U", EditView::TitlizeTextCommand
|
|
958
|
-
link "Ctrl+
|
|
1143
|
+
link "Ctrl+Alt+Shift+U", EditView::OppositeCaseTextCommand
|
|
959
1144
|
link "Ctrl+_", EditView::CamelSnakePascalRotateTextCommand
|
|
960
1145
|
link "Ctrl+=", EditView::AlignAssignmentCommand
|
|
1146
|
+
link "Ctrl+Shift+^", SortLinesCommand
|
|
961
1147
|
|
|
1148
|
+
link "Ctrl+Shift+F", Redcar::FindInProject::OpenSearch
|
|
962
1149
|
link "Ctrl+T", Project::FindFileCommand
|
|
963
1150
|
link "Ctrl+Shift+Alt+O", MoveTabToOtherNotebookCommand
|
|
964
1151
|
|
|
965
|
-
link "Ctrl+R", Runnables::RunEditTabCommand
|
|
966
|
-
|
|
967
1152
|
link "Ctrl+Shift+P", PrintScopeCommand
|
|
968
1153
|
|
|
969
1154
|
link "Ctrl+Alt+O", SwitchNotebookCommand
|
|
970
1155
|
link "Ctrl+Shift+H", ToggleTreesCommand
|
|
1156
|
+
link "Alt+Page Up", SwitchTreeUpCommand
|
|
1157
|
+
link "Alt+Page Down", SwitchTreeDownCommand
|
|
971
1158
|
link "Ctrl+Page Up", SwitchTabDownCommand
|
|
972
1159
|
link "Ctrl+Page Down", SwitchTabUpCommand
|
|
973
1160
|
link "Ctrl+Shift+Page Up", MoveTabDownCommand
|
|
974
1161
|
link "Ctrl+Shift+Page Down", MoveTabUpCommand
|
|
975
|
-
link "Ctrl+Shift+
|
|
1162
|
+
link "Ctrl+Shift+T", OpenTreeFinderCommand
|
|
1163
|
+
link "Alt+Shift+J", IncreaseTreebookWidthCommand
|
|
1164
|
+
link "Alt+Shift+H", DecreaseTreebookWidthCommand
|
|
1165
|
+
link "Ctrl+Shift+>", EnlargeFirstNotebookCommand
|
|
1166
|
+
link "Ctrl+Shift+<", EnlargeSecondNotebookCommand
|
|
1167
|
+
link "Ctrl+Shift+L", ResetNotebookWidthsCommand
|
|
1168
|
+
link "Ctrl+Shift+:", RotateNotebooksCommand
|
|
1169
|
+
link "Alt+Shift+N", CloseNotebookCommand
|
|
1170
|
+
# link "Ctrl+Shift+R", PluginManagerUi::ReloadLastReloadedCommand
|
|
976
1171
|
link "F11", ToggleFullscreen
|
|
977
1172
|
link "Ctrl+Alt+I", ToggleInvisibles
|
|
978
|
-
link "Ctrl
|
|
1173
|
+
link "Ctrl++", IncreaseFontSize
|
|
1174
|
+
link "Ctrl+-", DecreaseFontSize
|
|
979
1175
|
|
|
980
1176
|
link "Ctrl+Alt+S", Snippets::OpenSnippetExplorer
|
|
981
1177
|
|
|
@@ -1018,6 +1214,8 @@ Redcar.environment: #{Redcar.environment}
|
|
|
1018
1214
|
item "Close Tab", CloseTabCommand
|
|
1019
1215
|
item "Close Tree", CloseTreeCommand
|
|
1020
1216
|
item "Close Window", CloseWindowCommand
|
|
1217
|
+
item "Close Others", CloseOthers
|
|
1218
|
+
item "Close All", CloseAll
|
|
1021
1219
|
end
|
|
1022
1220
|
|
|
1023
1221
|
group(:priority => :last) do
|
|
@@ -1084,17 +1282,28 @@ Redcar.environment: #{Redcar.environment}
|
|
|
1084
1282
|
end
|
|
1085
1283
|
sub_menu "View", :priority => 30 do
|
|
1086
1284
|
sub_menu "Appearance", :priority => 5 do
|
|
1087
|
-
item "
|
|
1088
|
-
|
|
1089
|
-
item "
|
|
1285
|
+
item "Select Theme", SelectTheme
|
|
1286
|
+
separator
|
|
1287
|
+
item "Select Font" , SelectNewFont
|
|
1288
|
+
item "Select Font Size" , SelectFontSize
|
|
1289
|
+
item "Increase Font Size", IncreaseFontSize
|
|
1290
|
+
item "Decrease Font Size", DecreaseFontSize
|
|
1090
1291
|
end
|
|
1091
1292
|
group(:priority => 10) do
|
|
1092
1293
|
separator
|
|
1093
|
-
item "Toggle Tree Visibility", :command => ToggleTreesCommand
|
|
1094
1294
|
item "Toggle Fullscreen", :command => ToggleFullscreen, :type => :check, :active => window ? window.fullscreen : false
|
|
1095
1295
|
end
|
|
1096
1296
|
group(:priority => 15) do
|
|
1097
1297
|
separator
|
|
1298
|
+
sub_menu "Trees" do
|
|
1299
|
+
item "Open Tree Finder", OpenTreeFinderCommand
|
|
1300
|
+
item "Toggle Tree Visibility", ToggleTreesCommand
|
|
1301
|
+
item "Increase Tree Width", IncreaseTreebookWidthCommand
|
|
1302
|
+
item "Decrease Tree Width", DecreaseTreebookWidthCommand
|
|
1303
|
+
separator
|
|
1304
|
+
item "Previous Tree", SwitchTreeUpCommand
|
|
1305
|
+
item "Next Tree", SwitchTreeDownCommand
|
|
1306
|
+
end
|
|
1098
1307
|
lazy_sub_menu "Windows" do
|
|
1099
1308
|
GenerateWindowsMenu.new(self).run
|
|
1100
1309
|
end
|
|
@@ -1104,6 +1313,10 @@ Redcar.environment: #{Redcar.environment}
|
|
|
1104
1313
|
item "Rotate Notebooks", RotateNotebooksCommand
|
|
1105
1314
|
item "Move Tab To Other Notebook", MoveTabToOtherNotebookCommand
|
|
1106
1315
|
item "Switch Notebooks", SwitchNotebookCommand
|
|
1316
|
+
separator
|
|
1317
|
+
item "Enlarge First Notebook", EnlargeFirstNotebookCommand
|
|
1318
|
+
item "Enlarge Second Notebook", EnlargeSecondNotebookCommand
|
|
1319
|
+
item "Reset Notebook Widths", ResetNotebookWidthsCommand
|
|
1107
1320
|
end
|
|
1108
1321
|
sub_menu "Tabs" do
|
|
1109
1322
|
item "Previous Tab", SwitchTabDownCommand
|