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
|
@@ -3,10 +3,15 @@ Then /^the window should have title "([^\"]*)"$/ do |expected_title|
|
|
|
3
3
|
active_shell.get_text.should == expected_title
|
|
4
4
|
end
|
|
5
5
|
|
|
6
|
-
When /^I
|
|
7
|
-
if w
|
|
8
|
-
|
|
6
|
+
When /^I set the treebook width to (the default|only a few pixels|the minimum width|\d+ pixels)$/ do |w|
|
|
7
|
+
if w == "only a few pixels"
|
|
8
|
+
width = 10
|
|
9
|
+
elsif w == "the minimum width"
|
|
10
|
+
width = Redcar::ApplicationSWT::Window::MINIMUM_TREEBOOK_WIDTH
|
|
11
|
+
elsif w == "the default"
|
|
12
|
+
width = default_treebook_width
|
|
9
13
|
else
|
|
10
|
-
|
|
14
|
+
width = w.split(" ")[0].to_i
|
|
11
15
|
end
|
|
16
|
+
focussed_window.controller.send(:set_sash_widths, width)
|
|
12
17
|
end
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
require File.expand_path("../fake_event", __FILE__)
|
|
2
|
+
|
|
1
3
|
class TestingError < StandardError
|
|
2
4
|
end
|
|
3
5
|
|
|
@@ -20,10 +22,22 @@ module SwtHelper
|
|
|
20
22
|
def focussed_window
|
|
21
23
|
Redcar.app.focussed_window
|
|
22
24
|
end
|
|
25
|
+
|
|
26
|
+
def focussed_treebook_width
|
|
27
|
+
Redcar.app.focussed_window.controller.treebook_width
|
|
28
|
+
end
|
|
23
29
|
|
|
24
30
|
def focussed_tree
|
|
25
31
|
focussed_window.treebook.focussed_tree
|
|
26
32
|
end
|
|
33
|
+
|
|
34
|
+
def default_treebook_width
|
|
35
|
+
Redcar.app.focussed_window.controller.default_treebook_width
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def tree_with_title(title)
|
|
39
|
+
focussed_window.treebook.trees.detect {|t| t.tree_mirror.title == title }
|
|
40
|
+
end
|
|
27
41
|
|
|
28
42
|
def dialog(type)
|
|
29
43
|
dialogs.detect {|d| d.is_a?(type) }
|
|
@@ -56,6 +70,11 @@ module SwtHelper
|
|
|
56
70
|
find_node_with_text(all_children, node_text) unless all_children.empty?
|
|
57
71
|
end
|
|
58
72
|
|
|
73
|
+
def swt_label_for_item(vtabitem)
|
|
74
|
+
vtablabel = vtabitem.instance_variable_get "@label"
|
|
75
|
+
vtablabel.instance_variable_get "@label"
|
|
76
|
+
end
|
|
77
|
+
|
|
59
78
|
module TreeHelpers
|
|
60
79
|
def items
|
|
61
80
|
getItems.to_a
|
|
@@ -141,7 +160,7 @@ end
|
|
|
141
160
|
|
|
142
161
|
World(SwtHelper)
|
|
143
162
|
|
|
144
|
-
def close_everything
|
|
163
|
+
def close_everything
|
|
145
164
|
Redcar.app.task_queue.cancel_all
|
|
146
165
|
Swt.sync_exec do
|
|
147
166
|
dialogs.each {|d| d.controller.model.close }
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
require 'ostruct'
|
|
2
|
+
|
|
3
|
+
class FakeEvent
|
|
4
|
+
def initialize(event_type, widget, options = {})
|
|
5
|
+
untyped_event = Swt::Widgets::Event.new.tap do |e|
|
|
6
|
+
e.display = Swt.display
|
|
7
|
+
e.widget = widget
|
|
8
|
+
e.x = options[:x] || 0
|
|
9
|
+
e.y = options[:y] || 0
|
|
10
|
+
e.button = options[:button] if options[:button]
|
|
11
|
+
end
|
|
12
|
+
widget.notify_listeners(event_type, untyped_event)
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -57,6 +57,24 @@ module Redcar
|
|
|
57
57
|
win.focussed_notebook.focussed_tab
|
|
58
58
|
end
|
|
59
59
|
end,
|
|
60
|
+
Sensitivity.new(:open_htmltab, Redcar.app, false, [:focussed_window, :tab_focussed]) do |tab|
|
|
61
|
+
if win = Redcar.app.focussed_window and
|
|
62
|
+
tab = win.focussed_notebook.focussed_tab
|
|
63
|
+
tab.is_a?(HtmlTab)
|
|
64
|
+
end
|
|
65
|
+
end,
|
|
66
|
+
Sensitivity.new(:open_trees, Redcar.app, false, [:focussed_window, :tree_added, :tree_removed]) do |tree|
|
|
67
|
+
if win = Redcar.app.focussed_window
|
|
68
|
+
trees = win.treebook.trees
|
|
69
|
+
trees and trees.length > 0
|
|
70
|
+
end
|
|
71
|
+
end,
|
|
72
|
+
Sensitivity.new(:focussed_committed_mirror, Redcar.app, false,
|
|
73
|
+
[:focussed_window, :notebook_change, :mirror_committed, :tab_focussed]) do
|
|
74
|
+
if win = Redcar.app.focussed_window and tab = win.focussed_notebook.focussed_tab
|
|
75
|
+
begin;tab.edit_view.document.mirror.path;rescue;false;end
|
|
76
|
+
end
|
|
77
|
+
end,
|
|
60
78
|
Sensitivity.new(:single_notebook, Redcar.app, true, [:focussed_window, :notebook_change]) do
|
|
61
79
|
if win = Redcar.app.focussed_window
|
|
62
80
|
win.notebooks.length == 1
|
|
@@ -72,7 +90,8 @@ module Redcar
|
|
|
72
90
|
if win = Redcar.app.focussed_window and notebook = win.nonfocussed_notebook
|
|
73
91
|
notebook.tabs.any?
|
|
74
92
|
end
|
|
75
|
-
end
|
|
93
|
+
end,
|
|
94
|
+
Sensitivity.new(:always_disabled, Redcar.app, false,[]) do; false; end
|
|
76
95
|
]
|
|
77
96
|
end
|
|
78
97
|
|
|
@@ -86,13 +105,6 @@ module Redcar
|
|
|
86
105
|
create_history
|
|
87
106
|
@event_spewer = EventSpewer.new
|
|
88
107
|
@task_queue = TaskQueue.new
|
|
89
|
-
|
|
90
|
-
# Don't show the toolbar by default on Mac OS X
|
|
91
|
-
if Redcar.platform == :osx
|
|
92
|
-
Application.storage['show_toolbar'] = false
|
|
93
|
-
end
|
|
94
|
-
|
|
95
|
-
# Otherwise, use previous setting
|
|
96
108
|
@show_toolbar = !!Application.storage['show_toolbar']
|
|
97
109
|
end
|
|
98
110
|
|
|
@@ -149,10 +161,15 @@ module Redcar
|
|
|
149
161
|
|
|
150
162
|
def self.storage
|
|
151
163
|
@storage ||= begin
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
164
|
+
storage = Plugin::Storage.new('application_plugin')
|
|
165
|
+
storage.set_default('stay_resident_after_last_window_closed', false)
|
|
166
|
+
# Don't show the toolbar by default on Mac OS X
|
|
167
|
+
if Redcar.platform == :osx
|
|
168
|
+
storage.set_default('show_toolbar', false)
|
|
169
|
+
else
|
|
170
|
+
storage.set_default('show_toolbar', true)
|
|
171
|
+
end
|
|
172
|
+
storage
|
|
156
173
|
end
|
|
157
174
|
end
|
|
158
175
|
|
|
@@ -42,6 +42,14 @@ module Redcar
|
|
|
42
42
|
puts "Hooray! You selected #{text} at index #{ix}"
|
|
43
43
|
end
|
|
44
44
|
|
|
45
|
+
# Called by the controller when the user moves through the list.
|
|
46
|
+
#
|
|
47
|
+
# @param [String] the list row text that is now highlighted
|
|
48
|
+
# @param [Integer] the index of the row that is now highlighted
|
|
49
|
+
def moved_to(text, ix)
|
|
50
|
+
# Override with the code you wish you had
|
|
51
|
+
end
|
|
52
|
+
|
|
45
53
|
# Helper method for fuzzily filtering a list
|
|
46
54
|
#
|
|
47
55
|
# @param [Array<A>] list the list to filter
|
|
@@ -83,6 +91,17 @@ module Redcar
|
|
|
83
91
|
score_match_pairs.map {|a| a.last }
|
|
84
92
|
end
|
|
85
93
|
|
|
94
|
+
# The time interval in seconds in which moved_to events are ignored
|
|
95
|
+
# Override to select different interval
|
|
96
|
+
def step_time
|
|
97
|
+
1
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
def step?
|
|
101
|
+
@last_step ||= Time.now - step_time
|
|
102
|
+
@last_step + step_time <= Time.now
|
|
103
|
+
end
|
|
104
|
+
|
|
86
105
|
private
|
|
87
106
|
|
|
88
107
|
def make_regex(text)
|
|
@@ -2,14 +2,15 @@
|
|
|
2
2
|
module Redcar
|
|
3
3
|
class Speedbar
|
|
4
4
|
include Redcar::Model
|
|
5
|
-
|
|
5
|
+
|
|
6
6
|
LabelItem = ObservableStruct.new(:name, :text)
|
|
7
7
|
ToggleItem = ObservableStruct.new(:name, :text, :key, :listener, :value)
|
|
8
8
|
TextBoxItem = ObservableStruct.new(:name, :listener, :value, :edit_view)
|
|
9
9
|
ButtonItem = ObservableStruct.new(:name, :text, :key, :listener)
|
|
10
10
|
ComboItem = ObservableStruct.new(:name, :items, :value, :listener)
|
|
11
|
+
SliderItem = ObservableStruct.new(:name, :value, :minimum, :maximum, :increment, :enabled, :listener)
|
|
11
12
|
KeyItem = ObservableStruct.new(:key, :listener)
|
|
12
|
-
|
|
13
|
+
|
|
13
14
|
def self.items
|
|
14
15
|
@items ||= []
|
|
15
16
|
end
|
|
@@ -18,11 +19,11 @@ module Redcar
|
|
|
18
19
|
return if items.detect {|i| i.respond_to?(:name) and i.name == item.name }
|
|
19
20
|
items << item
|
|
20
21
|
end
|
|
21
|
-
|
|
22
|
+
|
|
22
23
|
def self.close_image_path
|
|
23
|
-
File.join(Redcar
|
|
24
|
+
File.join(Redcar::ICONS_DIRECTORY, "/close.png")
|
|
24
25
|
end
|
|
25
|
-
|
|
26
|
+
|
|
26
27
|
def self.define_item_finder(name)
|
|
27
28
|
self.class_eval %Q{
|
|
28
29
|
def #{name}
|
|
@@ -30,9 +31,9 @@ module Redcar
|
|
|
30
31
|
end
|
|
31
32
|
}
|
|
32
33
|
end
|
|
33
|
-
|
|
34
|
+
|
|
34
35
|
def __get_item(name)
|
|
35
|
-
item = __items.detect do |i|
|
|
36
|
+
item = __items.detect do |i|
|
|
36
37
|
i.respond_to?(:name) and
|
|
37
38
|
i.name.to_s == name
|
|
38
39
|
end
|
|
@@ -41,15 +42,15 @@ module Redcar
|
|
|
41
42
|
end
|
|
42
43
|
item
|
|
43
44
|
end
|
|
44
|
-
|
|
45
|
+
|
|
45
46
|
def __items
|
|
46
47
|
@__items ||= self.class.items.map {|i| i.clone }
|
|
47
48
|
end
|
|
48
|
-
|
|
49
|
+
|
|
49
50
|
def __get_item_by_text_or_name(name)
|
|
50
51
|
__items.detect {|i| (i.respond_to?(:text) and i.text == name) or i.name.to_s == name.to_s }
|
|
51
52
|
end
|
|
52
|
-
|
|
53
|
+
|
|
53
54
|
def __get_item_by_label(name)
|
|
54
55
|
label = __items.detect {|i| i.is_a?(LabelItem) and (i.text == name or i.name.to_s == name.to_s)}
|
|
55
56
|
if label
|
|
@@ -57,36 +58,41 @@ module Redcar
|
|
|
57
58
|
__items[index_of_label + 1]
|
|
58
59
|
end
|
|
59
60
|
end
|
|
60
|
-
|
|
61
|
+
|
|
61
62
|
def self.label(name, text)
|
|
62
63
|
append_item LabelItem.new(name, text)
|
|
63
64
|
define_item_finder(name)
|
|
64
65
|
end
|
|
65
|
-
|
|
66
|
+
|
|
66
67
|
def self.toggle(name, text, key, value=false, &block)
|
|
67
68
|
append_item ToggleItem.new(name, text, key, block, value)
|
|
68
69
|
define_item_finder(name)
|
|
69
70
|
end
|
|
70
|
-
|
|
71
|
+
|
|
71
72
|
def self.textbox(name, value="", &block)
|
|
72
73
|
append_item TextBoxItem.new(name, block, value)
|
|
73
74
|
define_item_finder(name)
|
|
74
75
|
end
|
|
75
|
-
|
|
76
|
+
|
|
76
77
|
def self.button(name, text, key, &block)
|
|
77
78
|
append_item ButtonItem.new(name, text, key, block)
|
|
78
79
|
define_item_finder(name)
|
|
79
80
|
end
|
|
80
|
-
|
|
81
|
+
|
|
81
82
|
def self.combo(name, items=[], value=nil, &block)
|
|
82
83
|
append_item ComboItem.new(name, items, value, block)
|
|
83
84
|
define_item_finder(name)
|
|
84
85
|
end
|
|
85
|
-
|
|
86
|
+
|
|
87
|
+
def self.slider(name, value = 50, minimum = 0, maximum = 100, increment = 1, &block)
|
|
88
|
+
append_item SliderItem.new(name, value, minimum, maximum, increment, true, block)
|
|
89
|
+
define_item_finder(name)
|
|
90
|
+
end
|
|
91
|
+
|
|
86
92
|
def self.key(key, &block)
|
|
87
93
|
append_item KeyItem.new(key, block)
|
|
88
94
|
end
|
|
89
|
-
|
|
95
|
+
|
|
90
96
|
def inspect
|
|
91
97
|
"#<Speedbar #{__items.inspect}"
|
|
92
98
|
end
|
|
@@ -2,16 +2,21 @@ module Redcar
|
|
|
2
2
|
class Tab
|
|
3
3
|
include Redcar::Model
|
|
4
4
|
include Redcar::Observable
|
|
5
|
-
|
|
6
|
-
DEFAULT_ICON
|
|
7
|
-
|
|
5
|
+
|
|
6
|
+
DEFAULT_ICON = :file
|
|
7
|
+
NO_WRITE_ICON = :exclamation_red
|
|
8
|
+
MISSING_ICON = :exclamation
|
|
9
|
+
CONFIG_ICON = :hammer_screwdriver
|
|
10
|
+
HELP_ICON = :question
|
|
11
|
+
WEB_ICON = :globe
|
|
12
|
+
|
|
8
13
|
attr_reader :notebook
|
|
9
|
-
|
|
14
|
+
|
|
10
15
|
def initialize(notebook)
|
|
11
16
|
@notebook = notebook
|
|
12
17
|
@title = "unknown"
|
|
13
18
|
end
|
|
14
|
-
|
|
19
|
+
|
|
15
20
|
# Close the tab (remove it from the Notebook).
|
|
16
21
|
#
|
|
17
22
|
# Events: close
|
|
@@ -20,8 +25,8 @@ module Redcar
|
|
|
20
25
|
notify_listeners(:close)
|
|
21
26
|
end
|
|
22
27
|
end
|
|
23
|
-
|
|
24
|
-
# Focus the tab within the notebook, and gives the keyboard focus to the
|
|
28
|
+
|
|
29
|
+
# Focus the tab within the notebook, and gives the keyboard focus to the
|
|
25
30
|
# contents of the tab, if appropriate.
|
|
26
31
|
#
|
|
27
32
|
# Events: focus
|
|
@@ -39,11 +44,11 @@ module Redcar
|
|
|
39
44
|
@title = title
|
|
40
45
|
notify_listeners(:changed_title, title)
|
|
41
46
|
end
|
|
42
|
-
|
|
47
|
+
|
|
43
48
|
def icon
|
|
44
49
|
@icon || DEFAULT_ICON
|
|
45
50
|
end
|
|
46
|
-
|
|
51
|
+
|
|
47
52
|
def icon=(value)
|
|
48
53
|
@icon = value
|
|
49
54
|
notify_listeners(:changed_icon, icon)
|
|
@@ -58,30 +63,30 @@ module Redcar
|
|
|
58
63
|
@notebook = notebook
|
|
59
64
|
end
|
|
60
65
|
|
|
61
|
-
# Moves the tab to a new position in the notebook, if said position
|
|
66
|
+
# Moves the tab to a new position in the notebook, if said position
|
|
62
67
|
# is currently occupied. Defaults to the first position, if none
|
|
63
68
|
# is passed.
|
|
64
|
-
#
|
|
69
|
+
#
|
|
65
70
|
# Events: moved (position)
|
|
66
71
|
def move_to_position(position = 0)
|
|
67
72
|
if (0..@notebook.tabs.size - 1).include?(position)
|
|
68
73
|
notify_listeners(:moved, position)
|
|
69
74
|
end
|
|
70
75
|
end
|
|
71
|
-
|
|
76
|
+
|
|
72
77
|
def edit_tab?
|
|
73
78
|
is_a?(EditTab)
|
|
74
79
|
end
|
|
75
|
-
|
|
80
|
+
|
|
76
81
|
# Helper method to get the edit_view's document, if applicable.
|
|
77
82
|
def document
|
|
78
83
|
edit_view.document if edit_tab?
|
|
79
84
|
end
|
|
80
|
-
|
|
85
|
+
|
|
81
86
|
# Helper method to get this tab's Mirror object for the current
|
|
82
87
|
# document, if applicable.
|
|
83
88
|
def document_mirror
|
|
84
89
|
document.mirror if document
|
|
85
|
-
end
|
|
90
|
+
end
|
|
86
91
|
end
|
|
87
92
|
end
|
|
@@ -2,14 +2,14 @@ module Redcar
|
|
|
2
2
|
class Treebook
|
|
3
3
|
include Redcar::Observable
|
|
4
4
|
include Redcar::Model
|
|
5
|
-
|
|
5
|
+
|
|
6
6
|
attr_reader :trees, :focussed_tree
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
def initialize
|
|
9
9
|
@trees = []
|
|
10
10
|
@focussed_tree = nil
|
|
11
11
|
end
|
|
12
|
-
|
|
12
|
+
|
|
13
13
|
# Add a tree to this treebook
|
|
14
14
|
#
|
|
15
15
|
# @param [Redcar::Tree]
|
|
@@ -17,16 +17,18 @@ module Redcar
|
|
|
17
17
|
@trees << tree
|
|
18
18
|
@focussed_tree = tree
|
|
19
19
|
notify_listeners(:tree_added, tree)
|
|
20
|
+
Redcar.app.repeat_event(:tree_added) if Redcar.app
|
|
20
21
|
end
|
|
21
|
-
|
|
22
|
+
|
|
22
23
|
# Bring the tree to the front
|
|
23
24
|
#
|
|
24
25
|
# @param [Redcar::Tree]
|
|
25
26
|
def focus_tree(tree)
|
|
27
|
+
return if @focussed_tree == tree
|
|
26
28
|
@focussed_tree = tree
|
|
27
29
|
notify_listeners(:tree_focussed, tree)
|
|
28
30
|
end
|
|
29
|
-
|
|
31
|
+
|
|
30
32
|
# Remove a tree from this treebook
|
|
31
33
|
#
|
|
32
34
|
# @param [Redcar::Tree]
|
|
@@ -37,11 +39,12 @@ module Redcar
|
|
|
37
39
|
if tree == focussed_tree
|
|
38
40
|
focus_tree(trees.first) if trees.any?
|
|
39
41
|
end
|
|
42
|
+
Redcar.app.repeat_event(:tree_removed) if Redcar.app
|
|
40
43
|
end
|
|
41
44
|
end
|
|
42
|
-
|
|
45
|
+
|
|
43
46
|
private
|
|
44
|
-
|
|
47
|
+
|
|
45
48
|
# Tell the Treebook that this tree has been focussed in the GUI.
|
|
46
49
|
def set_focussed_tree(tree)
|
|
47
50
|
@focussed_tree = tree
|