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
@@ -1,25 +1,25 @@
|
|
1
1
|
require File.join(File.dirname(__FILE__), "..", "spec_helper")
|
2
2
|
|
3
3
|
describe Redcar::Treebook do
|
4
|
-
|
4
|
+
|
5
5
|
describe "a new treebook" do
|
6
6
|
before do
|
7
7
|
@treebook = Redcar::Treebook.new
|
8
8
|
end
|
9
|
-
|
9
|
+
|
10
10
|
it "has no trees" do
|
11
11
|
@treebook.trees.length.should == 0
|
12
12
|
end
|
13
|
-
|
13
|
+
|
14
14
|
it "accepts a tree and notifies listeners" do
|
15
|
-
tree = "mock tree"
|
15
|
+
tree = MockTree.new("mock tree")
|
16
16
|
tree_added = false
|
17
17
|
@treebook.add_listener(:tree_added) do |tree|
|
18
18
|
tree_added = tree
|
19
19
|
end
|
20
|
-
|
20
|
+
|
21
21
|
@treebook.add_tree(tree)
|
22
|
-
|
22
|
+
|
23
23
|
tree_added.should == tree
|
24
24
|
@treebook.trees.should == [tree]
|
25
25
|
end
|
@@ -9,6 +9,10 @@ require "application_swt/dialogs/no_buttons_dialog"
|
|
9
9
|
require "application_swt/dialogs/text_and_file_dialog"
|
10
10
|
require "application_swt/dialogs/filter_list_dialog_controller"
|
11
11
|
require "application_swt/dialogs/input_dialog"
|
12
|
+
require "application_swt/dialogs/modeless_dialog"
|
13
|
+
require "application_swt/dialogs/modeless_html_dialog"
|
14
|
+
require "application_swt/dialogs/modeless_list_dialog_controller"
|
15
|
+
require "application_swt/gradient"
|
12
16
|
require "application_swt/html_tab"
|
13
17
|
require "application_swt/icon"
|
14
18
|
require "application_swt/menu"
|
@@ -35,13 +39,31 @@ module Redcar
|
|
35
39
|
def self.start
|
36
40
|
if Redcar.gui
|
37
41
|
Redcar.gui.register_controllers(
|
38
|
-
Redcar::Tab
|
39
|
-
Redcar::HtmlTab
|
40
|
-
Redcar::FilterListDialog
|
42
|
+
Redcar::Tab => ApplicationSWT::Tab,
|
43
|
+
Redcar::HtmlTab => ApplicationSWT::HtmlTab,
|
44
|
+
Redcar::FilterListDialog => ApplicationSWT::FilterListDialogController,
|
45
|
+
Redcar::ModelessListDialog => ApplicationSWT::ModelessListDialogController
|
41
46
|
)
|
42
47
|
Redcar.gui.register_dialog_adapter(ApplicationSWT::DialogAdapter.new)
|
43
48
|
end
|
44
49
|
end
|
50
|
+
|
51
|
+
def self.selected_tab_background
|
52
|
+
Gradient.new(Redcar::ApplicationSWT.storage['selected_tab_background'])
|
53
|
+
end
|
54
|
+
|
55
|
+
def self.unselected_tab_background
|
56
|
+
Gradient.new(Redcar::ApplicationSWT.storage['unselected_tab_background'])
|
57
|
+
end
|
58
|
+
|
59
|
+
def self.storage
|
60
|
+
@storage ||= begin
|
61
|
+
storage = Plugin::Storage.new('application_swt')
|
62
|
+
storage.set_default('selected_tab_background', {0 => "#FEFEFE", 100 => "#EEEEEE"})
|
63
|
+
storage.set_default('unselected_tab_background', {0 => "#E5E5E5", 100 => "#D0D0D0"})
|
64
|
+
storage
|
65
|
+
end
|
66
|
+
end
|
45
67
|
|
46
68
|
def self.add_debug_key_filters
|
47
69
|
display.add_filter(Swt::SWT::KeyDown) do |a|
|
@@ -4,15 +4,15 @@ module Redcar
|
|
4
4
|
def open_file(options)
|
5
5
|
file_dialog(Swt::SWT::OPEN, options)
|
6
6
|
end
|
7
|
-
|
7
|
+
|
8
8
|
def open_directory(options)
|
9
9
|
directory_dialog(options)
|
10
10
|
end
|
11
|
-
|
11
|
+
|
12
12
|
def save_file(options)
|
13
13
|
file_dialog(Swt::SWT::SAVE, options)
|
14
14
|
end
|
15
|
-
|
15
|
+
|
16
16
|
MESSAGE_BOX_TYPES = {
|
17
17
|
:info => Swt::SWT::ICON_INFORMATION,
|
18
18
|
:error => Swt::SWT::ICON_ERROR,
|
@@ -20,7 +20,7 @@ module Redcar
|
|
20
20
|
:warning => Swt::SWT::ICON_WARNING,
|
21
21
|
:working => Swt::SWT::ICON_WORKING
|
22
22
|
}
|
23
|
-
|
23
|
+
|
24
24
|
BUTTONS = {
|
25
25
|
:yes => Swt::SWT::YES,
|
26
26
|
:no => Swt::SWT::NO,
|
@@ -30,16 +30,16 @@ module Redcar
|
|
30
30
|
:abort => Swt::SWT::ABORT,
|
31
31
|
:ignore => Swt::SWT::IGNORE
|
32
32
|
}
|
33
|
-
|
33
|
+
|
34
34
|
MESSAGE_BOX_BUTTON_COMBOS = {
|
35
35
|
:ok => [:ok],
|
36
36
|
:ok_cancel => [:ok, :cancel],
|
37
|
-
:yes_no => [:yes, :no],
|
37
|
+
:yes_no => [:yes, :no],
|
38
38
|
:yes_no_cancel => [:yes, :no, :cancel],
|
39
39
|
:retry_cancel => [:retry, :cancel],
|
40
40
|
:abort_retry_ignore => [:abort, :retry, :ignore]
|
41
41
|
}
|
42
|
-
|
42
|
+
|
43
43
|
def message_box(text, options)
|
44
44
|
styles = 0
|
45
45
|
styles = styles | MESSAGE_BOX_TYPES[options[:type]] if options[:type]
|
@@ -55,19 +55,19 @@ module Redcar
|
|
55
55
|
end
|
56
56
|
BUTTONS.invert[result]
|
57
57
|
end
|
58
|
-
|
58
|
+
|
59
59
|
def buttons
|
60
60
|
BUTTONS.keys
|
61
61
|
end
|
62
|
-
|
62
|
+
|
63
63
|
def available_message_box_types
|
64
64
|
MESSAGE_BOX_TYPES.keys
|
65
65
|
end
|
66
|
-
|
66
|
+
|
67
67
|
def available_message_box_button_combos
|
68
68
|
MESSAGE_BOX_BUTTON_COMBOS.keys
|
69
69
|
end
|
70
|
-
|
70
|
+
|
71
71
|
def input(title, message, initial_value, &block)
|
72
72
|
dialog = Dialogs::InputDialog.new(
|
73
73
|
parent_shell,
|
@@ -78,52 +78,73 @@ module Redcar
|
|
78
78
|
button = (code == 0 ? :ok : :cancel)
|
79
79
|
{:button => button, :value => dialog.value}
|
80
80
|
end
|
81
|
-
|
81
|
+
|
82
82
|
def password_input(title, message)
|
83
83
|
dialog = Dialogs::InputDialog.new(parent_shell, title, message, :password => true)
|
84
84
|
code = dialog.open
|
85
85
|
button = (code == 0 ? :ok : :cancel)
|
86
86
|
{:button => button, :value => dialog.value}
|
87
87
|
end
|
88
|
-
|
88
|
+
|
89
89
|
def tool_tip(message, location)
|
90
90
|
tool_tip = Swt::Widgets::ToolTip.new(parent_shell, Swt::SWT::ICON_INFORMATION)
|
91
91
|
tool_tip.set_message(message)
|
92
92
|
tool_tip.set_location(*get_coordinates(location))
|
93
93
|
tool_tip.set_visible(true)
|
94
94
|
end
|
95
|
-
|
95
|
+
|
96
96
|
def popup_menu(menu, location)
|
97
97
|
window = Redcar.app.focussed_window
|
98
98
|
menu = ApplicationSWT::Menu.new(window.controller, menu, nil, Swt::SWT::POP_UP)
|
99
99
|
menu.move(*get_coordinates(location))
|
100
100
|
menu.show
|
101
101
|
end
|
102
|
-
|
102
|
+
|
103
|
+
def popup_text(title, message, location,dimensions=nil)
|
104
|
+
if dimensions
|
105
|
+
box = ApplicationSWT::ModelessDialog.new(title,message,dimensions[0],dimensions[1])
|
106
|
+
else
|
107
|
+
box = ApplicationSWT::ModelessDialog.new(title,message)
|
108
|
+
end
|
109
|
+
box.open(parent_shell,*get_coordinates(location))
|
110
|
+
end
|
111
|
+
|
112
|
+
def popup_html(text,location,dimensions=nil)
|
113
|
+
if dimensions
|
114
|
+
box = ApplicationSWT::ModelessHtmlDialog.new(text,dimensions[0],dimensions[1])
|
115
|
+
else
|
116
|
+
box = ApplicationSWT::ModelessHtmlDialog.new(text)
|
117
|
+
end
|
118
|
+
box.open(parent_shell,*get_coordinates(location))
|
119
|
+
end
|
120
|
+
|
103
121
|
private
|
104
|
-
|
122
|
+
|
105
123
|
def get_coordinates(location)
|
106
124
|
edit_view = EditView.focussed_tab_edit_view
|
107
|
-
if location == :cursor and not edit_view
|
125
|
+
if (location == :cursor or location.to_s =~ /^(\d+)$/) and not edit_view
|
108
126
|
location = :pointer
|
109
127
|
end
|
110
128
|
case location
|
111
129
|
when :cursor
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
x += widget_offset.x
|
116
|
-
y += widget_offset.y
|
130
|
+
x, y = Swt::GraphicsUtils.pixel_location_at_offset(edit_view.cursor_offset)
|
131
|
+
when :below_cursor
|
132
|
+
x, y = Swt::GraphicsUtils.below_pixel_location_at_offset(edit_view.cursor_offset)
|
117
133
|
when :pointer
|
118
134
|
location = ApplicationSWT.display.get_cursor_location
|
119
135
|
x, y = location.x, location.y
|
136
|
+
else
|
137
|
+
if location.to_s =~ /^(\d+)$/
|
138
|
+
x, y = Swt::GraphicsUtils.pixel_location_at_offset($1.to_i)
|
139
|
+
end
|
120
140
|
end
|
121
141
|
[x, y]
|
122
142
|
end
|
123
|
-
|
143
|
+
|
124
144
|
def file_dialog(type, options)
|
125
145
|
dialog = Swt::Widgets::FileDialog.new(parent_shell, type)
|
126
|
-
dialog.setText("Save File")
|
146
|
+
dialog.setText("Save File")
|
147
|
+
dialog.setOverwrite(true)
|
127
148
|
if options[:filter_path]
|
128
149
|
dialog.setText("Save File As") if type == Swt::SWT::SAVE
|
129
150
|
dialog.setText("Open File") if type == Swt::SWT::OPEN
|
@@ -133,7 +154,7 @@ module Redcar
|
|
133
154
|
dialog.open
|
134
155
|
end
|
135
156
|
end
|
136
|
-
|
157
|
+
|
137
158
|
def directory_dialog(options)
|
138
159
|
dialog = Swt::Widgets::DirectoryDialog.new(parent_shell)
|
139
160
|
dialog.setText("Open Directory")
|
@@ -144,7 +165,7 @@ module Redcar
|
|
144
165
|
dialog.open
|
145
166
|
end
|
146
167
|
end
|
147
|
-
|
168
|
+
|
148
169
|
def parent_shell
|
149
170
|
if focussed_window = Redcar.app.focussed_window
|
150
171
|
focussed_window.controller.shell
|
@@ -154,4 +175,4 @@ module Redcar
|
|
154
175
|
end
|
155
176
|
end
|
156
177
|
end
|
157
|
-
end
|
178
|
+
end
|
@@ -58,7 +58,7 @@ module Redcar
|
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
|
-
attr_reader :model
|
61
|
+
attr_reader :model, :dialog
|
62
62
|
|
63
63
|
def initialize(model)
|
64
64
|
@model = model
|
@@ -145,12 +145,23 @@ module Redcar
|
|
145
145
|
def update_list_sync
|
146
146
|
if @dialog
|
147
147
|
s = Time.now
|
148
|
-
|
149
|
-
|
148
|
+
dialog = @dialog
|
149
|
+
this = self
|
150
|
+
Thread.new(@dialog.text.get_text) do |text|
|
151
|
+
begin
|
152
|
+
list = @model.update_list(text)
|
153
|
+
Redcar.update_gui do
|
154
|
+
this.populate_list(list)
|
155
|
+
if this.dialog
|
156
|
+
this.dialog.list.set_selection(0)
|
157
|
+
this.text_focus
|
158
|
+
end
|
159
|
+
end
|
160
|
+
rescue => e
|
161
|
+
puts e.message
|
162
|
+
puts e.backtrace
|
163
|
+
end
|
150
164
|
end
|
151
|
-
populate_list(@update_thread.value)
|
152
|
-
@dialog.list.set_selection(0)
|
153
|
-
text_focus
|
154
165
|
end
|
155
166
|
end
|
156
167
|
|
@@ -209,12 +220,12 @@ module Redcar
|
|
209
220
|
widget_selected
|
210
221
|
end
|
211
222
|
|
212
|
-
private
|
213
|
-
|
214
223
|
def populate_list(contents)
|
215
|
-
@dialog
|
216
|
-
|
217
|
-
|
224
|
+
if @dialog
|
225
|
+
@dialog.list.removeAll
|
226
|
+
contents.each do |text|
|
227
|
+
@dialog.list.add(text)
|
228
|
+
end
|
218
229
|
end
|
219
230
|
end
|
220
231
|
end
|
@@ -0,0 +1,113 @@
|
|
1
|
+
|
2
|
+
module Redcar
|
3
|
+
class ApplicationSWT
|
4
|
+
class ModelessDialog
|
5
|
+
|
6
|
+
DEFAULT_WIDTH = 300
|
7
|
+
DEFAULT_HEIGHT_IN_ROWS = 4
|
8
|
+
|
9
|
+
def initialize(title,message,width=DEFAULT_WIDTH,height=DEFAULT_HEIGHT_IN_ROWS)
|
10
|
+
@title = title
|
11
|
+
@message = message
|
12
|
+
@width = width
|
13
|
+
@height = height
|
14
|
+
end
|
15
|
+
|
16
|
+
def close
|
17
|
+
@text.remove_key_listener(@key_listener)
|
18
|
+
@text.remove_focus_listener(@focus_listener)
|
19
|
+
@shell.dispose
|
20
|
+
end
|
21
|
+
|
22
|
+
def open(parent,*location)
|
23
|
+
createDialogArea(parent)
|
24
|
+
@shell.set_location(*location)
|
25
|
+
@shell.open
|
26
|
+
end
|
27
|
+
|
28
|
+
def inspect
|
29
|
+
"#<Redcar::ModelessDialog width=#{@width}, height=#{@height}, location=#{@shell.get_location}>"
|
30
|
+
end
|
31
|
+
|
32
|
+
class KeyListener
|
33
|
+
|
34
|
+
def initialize(text)
|
35
|
+
@text = text
|
36
|
+
end
|
37
|
+
|
38
|
+
def key_pressed(e)
|
39
|
+
end
|
40
|
+
|
41
|
+
def key_released(e)
|
42
|
+
if e.stateMask == Swt::SWT::CTRL
|
43
|
+
case e.keyCode
|
44
|
+
when 97
|
45
|
+
e.widget.select_all
|
46
|
+
when 99
|
47
|
+
e.widget.copy
|
48
|
+
end
|
49
|
+
elsif e.stateMask == Swt::SWT::ALT
|
50
|
+
else
|
51
|
+
case e.keyCode
|
52
|
+
when Swt::SWT::ESC
|
53
|
+
@text.close
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
class FocusListener
|
60
|
+
def initialize(text)
|
61
|
+
@text = text
|
62
|
+
end
|
63
|
+
|
64
|
+
def focus_gained(e)
|
65
|
+
end
|
66
|
+
|
67
|
+
def focus_lost(e)
|
68
|
+
@text.close
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
private
|
73
|
+
|
74
|
+
def createDialogArea(parent)
|
75
|
+
display = ApplicationSWT.display
|
76
|
+
shell = Swt::Widgets::Shell.new(parent, Swt::SWT::MODELESS)
|
77
|
+
layout = Swt::Layout::GridLayout.new
|
78
|
+
layout.marginHeight = 0
|
79
|
+
layout.marginWidth = 0
|
80
|
+
layout.verticalSpacing = 0
|
81
|
+
shell.setLayout(layout)
|
82
|
+
|
83
|
+
text = Swt::Custom::StyledText.new(shell, Swt::SWT::WRAP|Swt::SWT::V_SCROLL)
|
84
|
+
text.setLayoutData(Swt::Layout::GridData.new(Swt::Layout::GridData::FILL_BOTH))
|
85
|
+
text.set_editable false
|
86
|
+
new_line = "\n"
|
87
|
+
new_line = "\r\n" if Redcar.platform == :windows
|
88
|
+
text.set_text(@title + new_line + @message)
|
89
|
+
style1 = Swt::Custom::StyleRange.new
|
90
|
+
style1.start = 0
|
91
|
+
style1.length = @title.split(//).length
|
92
|
+
style1.fontStyle = Swt::SWT::BOLD
|
93
|
+
style1.foreground = display.getSystemColor(Swt::SWT::COLOR_WHITE)
|
94
|
+
text.setStyleRange(style1)
|
95
|
+
text.set_margins(2,2,2,2)
|
96
|
+
text.setBackground(Swt::Graphics::Color.new(display, 230, 240, 255))
|
97
|
+
text.setLineBackground(0, 1, Swt::Graphics::Color.new(display, 135, 178, 247))
|
98
|
+
@key_listener = KeyListener.new(self)
|
99
|
+
@focus_listener = FocusListener.new(self)
|
100
|
+
text.add_key_listener(@key_listener)
|
101
|
+
text.add_focus_listener(@focus_listener)
|
102
|
+
ApplicationSWT.register_shell(shell)
|
103
|
+
@text = text
|
104
|
+
@shell = shell
|
105
|
+
shell.set_size(@width,convert_to_pixels(@height))
|
106
|
+
end
|
107
|
+
|
108
|
+
def convert_to_pixels(rows)
|
109
|
+
@text.get_line_height * rows
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
|
2
|
+
module Redcar
|
3
|
+
class ApplicationSWT
|
4
|
+
class ModelessHtmlDialog
|
5
|
+
attr_reader :width, :height
|
6
|
+
|
7
|
+
DEFAULT_WIDTH = 300
|
8
|
+
DEFAULT_HEIGHT = 100
|
9
|
+
|
10
|
+
def initialize(text,width=DEFAULT_WIDTH,height=DEFAULT_HEIGHT)
|
11
|
+
@text = text
|
12
|
+
@width = width
|
13
|
+
@height = height
|
14
|
+
end
|
15
|
+
|
16
|
+
# Close and dispose of the dialog
|
17
|
+
def close
|
18
|
+
# @browser.remove_focus_listener(@focus_listener)
|
19
|
+
@browser.remove_key_listener(@key_listener)
|
20
|
+
@browser.dispose
|
21
|
+
@shell.dispose
|
22
|
+
end
|
23
|
+
|
24
|
+
# Opens the dialog.
|
25
|
+
#
|
26
|
+
# @returns the dialog
|
27
|
+
def open(parent,*location)
|
28
|
+
createDialogArea(parent)
|
29
|
+
@shell.set_location(*location)
|
30
|
+
@shell.open
|
31
|
+
# getting browser focus events does not work - SWT #84532
|
32
|
+
# @focus_listener = ModelessDialog::FocusListener.new(self)
|
33
|
+
# @browser.add_focus_listener(@focus_listener)
|
34
|
+
# @browser.set_focus
|
35
|
+
self
|
36
|
+
end
|
37
|
+
|
38
|
+
# Set the text to be rendered by the dialog
|
39
|
+
def text=(text)
|
40
|
+
@browser.set_text text
|
41
|
+
end
|
42
|
+
|
43
|
+
# Set the dialog to render a given URL
|
44
|
+
def url=(url)
|
45
|
+
@browser.set_url url
|
46
|
+
end
|
47
|
+
|
48
|
+
# Change the dialog size
|
49
|
+
def set_size(width,height)
|
50
|
+
@width = width
|
51
|
+
@height = height
|
52
|
+
@shell.set_size(@width, @height)
|
53
|
+
end
|
54
|
+
|
55
|
+
# Refresh the rendered content
|
56
|
+
def refresh
|
57
|
+
@browser.refresh
|
58
|
+
end
|
59
|
+
|
60
|
+
def inspect
|
61
|
+
"#<Redcar::ModelessHtmlDialog width=#{@width}, height=#{@height}, location=#{@shell.get_location}>"
|
62
|
+
end
|
63
|
+
|
64
|
+
private
|
65
|
+
|
66
|
+
def createDialogArea(parent)
|
67
|
+
display = ApplicationSWT.display
|
68
|
+
@shell = Swt::Widgets::Shell.new(parent, Swt::SWT::MODELESS)
|
69
|
+
layout = Swt::Layout::GridLayout.new
|
70
|
+
layout.marginHeight = 0
|
71
|
+
layout.marginWidth = 0
|
72
|
+
layout.verticalSpacing = 0
|
73
|
+
@shell.set_layout(layout)
|
74
|
+
@browser = Swt::Browser.new(@shell, Swt::SWT::MOZILLA)
|
75
|
+
@browser.set_layout_data(Swt::Layout::GridData.new(Swt::Layout::GridData::FILL_BOTH))
|
76
|
+
@shell.set_size(@width, @height)
|
77
|
+
|
78
|
+
@key_listener = ModelessDialog::KeyListener.new(self)
|
79
|
+
@browser.add_key_listener(@key_listener)
|
80
|
+
@browser.set_text(@text)
|
81
|
+
ApplicationSWT.register_shell(@shell)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|