redcar 0.8.1 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -89,8 +89,8 @@ module Redcar
|
|
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
|
-
tool_tip.set_visible(true)
|
93
92
|
tool_tip.set_location(*get_coordinates(location))
|
93
|
+
tool_tip.set_visible(true)
|
94
94
|
end
|
95
95
|
|
96
96
|
def popup_menu(menu, location)
|
@@ -125,8 +125,8 @@ module Redcar
|
|
125
125
|
dialog = Swt::Widgets::FileDialog.new(parent_shell, type)
|
126
126
|
dialog.setText("Save File");
|
127
127
|
if options[:filter_path]
|
128
|
-
|
129
|
-
|
128
|
+
dialog.setText("Save File As") if type == Swt::SWT::SAVE
|
129
|
+
dialog.setText("Open File") if type == Swt::SWT::OPEN
|
130
130
|
dialog.set_filter_path(options[:filter_path])
|
131
131
|
end
|
132
132
|
Redcar.app.protect_application_focus do
|
@@ -136,7 +136,7 @@ module Redcar
|
|
136
136
|
|
137
137
|
def directory_dialog(options)
|
138
138
|
dialog = Swt::Widgets::DirectoryDialog.new(parent_shell)
|
139
|
-
|
139
|
+
dialog.setText("Open Directory")
|
140
140
|
if options[:filter_path]
|
141
141
|
dialog.set_filter_path(options[:filter_path])
|
142
142
|
end
|
@@ -110,6 +110,7 @@ module Redcar
|
|
110
110
|
|
111
111
|
def widgetSelected(e)
|
112
112
|
@controller.text_focus
|
113
|
+
@controller.widget_selected
|
113
114
|
end
|
114
115
|
end
|
115
116
|
|
@@ -153,6 +154,12 @@ module Redcar
|
|
153
154
|
end
|
154
155
|
end
|
155
156
|
|
157
|
+
def widget_selected
|
158
|
+
if @model.step?
|
159
|
+
@model.moved_to(@dialog.list.get_selection.first, @dialog.list.get_selection_index)
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
156
163
|
def text_focus
|
157
164
|
@dialog.text.set_focus
|
158
165
|
end
|
@@ -187,15 +194,19 @@ module Redcar
|
|
187
194
|
end
|
188
195
|
|
189
196
|
def move_down
|
190
|
-
|
191
|
-
new_ix = [curr_ix + 1, @dialog.list.get_item_count - 1].min
|
192
|
-
@dialog.list.set_selection(new_ix)
|
197
|
+
move_selection(1, @dialog.list.get_item_count - 1)
|
193
198
|
end
|
194
199
|
|
195
200
|
def move_up
|
201
|
+
move_selection(-1, 0)
|
202
|
+
end
|
203
|
+
|
204
|
+
def move_selection(step, border)
|
196
205
|
curr_ix = @dialog.list.get_selection_index
|
197
|
-
new_ix =
|
206
|
+
new_ix = curr_ix + step
|
207
|
+
new_ix = border if (new_ix <=> border) == step
|
198
208
|
@dialog.list.set_selection(new_ix)
|
209
|
+
widget_selected
|
199
210
|
end
|
200
211
|
|
201
212
|
private
|
@@ -9,7 +9,7 @@ module Redcar
|
|
9
9
|
when :file
|
10
10
|
file_image
|
11
11
|
when Symbol
|
12
|
-
image(File.expand_path(File.join(Redcar::ICONS_DIRECTORY, icon.to_s + ".png")))
|
12
|
+
image(File.expand_path(File.join(Redcar::ICONS_DIRECTORY, icon.to_s.gsub(/_/, "-") + ".png")))
|
13
13
|
when String
|
14
14
|
image(icon)
|
15
15
|
end
|
@@ -24,13 +24,11 @@ module Redcar
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def self.dir_image
|
27
|
-
|
28
|
-
image(path)
|
27
|
+
swt_image(:darwin_folder)
|
29
28
|
end
|
30
29
|
|
31
30
|
def self.file_image
|
32
|
-
|
33
|
-
image(path)
|
31
|
+
swt_image(:darwin_file)
|
34
32
|
end
|
35
33
|
end
|
36
34
|
end
|
@@ -8,9 +8,9 @@ module Redcar
|
|
8
8
|
# A TabPaintListener allows clients to draw
|
9
9
|
# indicators next to a tab in the tab folder
|
10
10
|
class TabPaintListener
|
11
|
-
include org.eclipse.swt.events.PaintListener
|
11
|
+
include org.eclipse.swt.events.PaintListener
|
12
12
|
attr_writer :item, :indicate_front
|
13
|
-
|
13
|
+
|
14
14
|
def paintControl(event)
|
15
15
|
event.gc.background = ApplicationSWT.display.system_color Swt::SWT::COLOR_DARK_GRAY
|
16
16
|
if @item && @item.bounds
|
@@ -100,10 +100,10 @@ module Redcar
|
|
100
100
|
tab_controller.move_tab_widget_to_position(position)
|
101
101
|
end
|
102
102
|
|
103
|
-
# Find the CTabItem targeted by a given event
|
103
|
+
# Find the CTabItem targeted by a given event
|
104
104
|
def event_to_tab_widget(event)
|
105
105
|
if tab_folder.item_count > 0
|
106
|
-
tab_folder.item(tab_folder.to_control(event.x, event.y)) or
|
106
|
+
tab_folder.item(tab_folder.to_control(event.x, event.y)) or
|
107
107
|
tab_folder.items[tab_folder.item_count - 1]
|
108
108
|
end
|
109
109
|
end
|
@@ -4,22 +4,22 @@ module Redcar
|
|
4
4
|
class TabTransfer < Swt::DND::ByteArrayTransfer
|
5
5
|
|
6
6
|
class TabType
|
7
|
-
# Empty class for now, until we figure out which
|
7
|
+
# Empty class for now, until we figure out which
|
8
8
|
# information we want to attach to the transfer.
|
9
9
|
# This _will_ be needed to DnD tabs between windows
|
10
10
|
end
|
11
|
-
|
11
|
+
|
12
12
|
TAB_TYPE = "TabType"
|
13
13
|
TAB_TYPE_ID = register_type(TAB_TYPE)
|
14
14
|
@@instance = nil
|
15
|
-
|
15
|
+
|
16
16
|
def self.get_instance
|
17
17
|
@@instance || TabTransfer.new
|
18
18
|
end
|
19
19
|
|
20
20
|
def javaToNative(types, transfer_data)
|
21
21
|
return if (types.nil? || types.empty? || (types.first.class != TabType))
|
22
|
-
|
22
|
+
|
23
23
|
begin
|
24
24
|
# write data to a byte array and then ask super to convert to
|
25
25
|
out = java.io.ByteArrayOutputStream.new
|
@@ -40,7 +40,7 @@ module Redcar
|
|
40
40
|
if (is_supported_type(transfer_data))
|
41
41
|
buffer = super
|
42
42
|
return nil unless buffer
|
43
|
-
|
43
|
+
|
44
44
|
data = []
|
45
45
|
begin
|
46
46
|
input = java.io.ByteArrayInputStream.new(buffer)
|
@@ -1,10 +1,17 @@
|
|
1
|
+
require 'application_swt/speedbar/button_item'
|
2
|
+
require 'application_swt/speedbar/combo_item'
|
3
|
+
require 'application_swt/speedbar/label_item'
|
4
|
+
require 'application_swt/speedbar/slider_item'
|
5
|
+
require 'application_swt/speedbar/text_box_item'
|
6
|
+
require 'application_swt/speedbar/toggle_item'
|
7
|
+
|
1
8
|
module Redcar
|
2
9
|
class ApplicationSWT
|
3
10
|
class Speedbar
|
4
11
|
include Redcar::ReentryHelpers
|
5
|
-
|
12
|
+
|
6
13
|
attr_reader :widget
|
7
|
-
|
14
|
+
|
8
15
|
def initialize(window, parent, model)
|
9
16
|
@window_model = window
|
10
17
|
@parent = parent
|
@@ -19,12 +26,12 @@ module Redcar
|
|
19
26
|
@parent.layout
|
20
27
|
@model.after_draw if @model.respond_to?(:after_draw)
|
21
28
|
end
|
22
|
-
|
29
|
+
|
23
30
|
def close
|
24
31
|
@composite.dispose
|
25
32
|
@parent.layout
|
26
33
|
end
|
27
|
-
|
34
|
+
|
28
35
|
def disable_menu_items
|
29
36
|
key_strings = []
|
30
37
|
@model.__items.each do |i|
|
@@ -36,34 +43,34 @@ module Redcar
|
|
36
43
|
ApplicationSWT::Menu.disable_items(key_string)
|
37
44
|
end
|
38
45
|
end
|
39
|
-
|
46
|
+
|
40
47
|
def num_columns
|
41
48
|
@model.__items.select {|i| !i.is_a?(Redcar::Speedbar::KeyItem) }.length
|
42
49
|
end
|
43
|
-
|
50
|
+
|
44
51
|
def key_items
|
45
52
|
@model.__items.select {|i| i.respond_to?(:key) and i.key }
|
46
53
|
end
|
47
|
-
|
54
|
+
|
48
55
|
def keyable_widgets
|
49
56
|
@keyable_widgets ||= []
|
50
57
|
end
|
51
|
-
|
58
|
+
|
52
59
|
def focussable_widgets
|
53
60
|
@focussable_widgets ||= []
|
54
61
|
end
|
55
|
-
|
62
|
+
|
56
63
|
def create_widgets
|
57
64
|
create_bar_widget
|
58
65
|
create_item_widgets
|
59
66
|
end
|
60
|
-
|
67
|
+
|
61
68
|
def create_bar_widget
|
62
69
|
@composite = Swt::Widgets::Composite.new(@parent, Swt::SWT::NONE)
|
63
70
|
grid_data = Swt::Layout::GridData.new
|
64
71
|
grid_data.grabExcessHorizontalSpace = true
|
65
72
|
grid_data.horizontalAlignment = Swt::Layout::GridData::FILL
|
66
|
-
|
73
|
+
@composite.setLayoutData(grid_data)
|
67
74
|
layout = Swt::Layout::GridLayout.new(num_columns + 1, false)
|
68
75
|
layout.verticalSpacing = 0
|
69
76
|
layout.marginHeight = 0
|
@@ -75,7 +82,7 @@ module Redcar
|
|
75
82
|
|
76
83
|
label.add_mouse_listener(MouseListener.new(self))
|
77
84
|
end
|
78
|
-
|
85
|
+
|
79
86
|
def execute_listener_in_model(item, *args)
|
80
87
|
if item.listener
|
81
88
|
begin
|
@@ -85,144 +92,51 @@ module Redcar
|
|
85
92
|
end
|
86
93
|
end
|
87
94
|
end
|
88
|
-
|
95
|
+
|
89
96
|
def create_item_widgets
|
90
97
|
@model.__items.each do |item|
|
91
|
-
|
92
|
-
|
93
|
-
label = Swt::Widgets::Label.new(@composite, 0)
|
94
|
-
label.set_text(item.text)
|
95
|
-
item.add_listener(:changed_text) do |new_text|
|
96
|
-
label.set_text(item.text)
|
97
|
-
end
|
98
|
-
when Redcar::Speedbar::TextBoxItem
|
99
|
-
edit_view = EditView.new
|
100
|
-
item.edit_view = edit_view
|
101
|
-
edit_view_swt = EditViewSWT.new(edit_view, @composite, :single_line => true)
|
102
|
-
mate_text = edit_view_swt.mate_text
|
103
|
-
mate_text.set_font(EditView.font, EditView.font_size)
|
104
|
-
mate_text.getControl.set_text(item.value)
|
105
|
-
mate_text.set_grammar_by_name "Ruby"
|
106
|
-
mate_text.set_theme_by_name(EditView.theme)
|
107
|
-
mate_text.set_root_scope_by_content_name("Ruby", "string.regexp.classic.ruby")
|
108
|
-
gridData = Swt::Layout::GridData.new
|
109
|
-
gridData.grabExcessHorizontalSpace = true
|
110
|
-
gridData.horizontalAlignment = Swt::Layout::GridData::FILL
|
111
|
-
mate_text.getControl.set_layout_data(gridData)
|
112
|
-
edit_view.document.add_listener(:changed) do
|
113
|
-
ignore(item.name) do
|
114
|
-
item.value = edit_view.document.to_s
|
115
|
-
execute_listener_in_model(item, item.value)
|
116
|
-
end
|
117
|
-
end
|
118
|
-
item.add_listener(:changed_value) do |new_value|
|
119
|
-
ignore(item.name) do
|
120
|
-
mate_text.getControl.set_text(new_value)
|
121
|
-
end
|
122
|
-
end
|
123
|
-
keyable_widgets << mate_text.getControl
|
124
|
-
focussable_widgets << mate_text.getControl
|
125
|
-
when Redcar::Speedbar::ButtonItem
|
126
|
-
button = Swt::Widgets::Button.new(@composite, 0)
|
127
|
-
button.set_text(item.text)
|
128
|
-
button.add_selection_listener do
|
129
|
-
execute_listener_in_model(item)
|
130
|
-
end
|
131
|
-
item.add_listener(:changed_text) do |new_text|
|
132
|
-
button.set_text(item.text)
|
133
|
-
end
|
134
|
-
keyable_widgets << button
|
135
|
-
focussable_widgets << button
|
136
|
-
when Redcar::Speedbar::ComboItem
|
137
|
-
combo = Swt::Widgets::Combo.new(@composite, Swt::SWT::READ_ONLY)
|
138
|
-
combo.items = item.items.to_java(:string)
|
139
|
-
if item.value
|
140
|
-
combo.select(item.items.index(item.value))
|
141
|
-
end
|
142
|
-
combo.add_selection_listener do
|
143
|
-
ignore(item.name) do
|
144
|
-
item.value = combo.text
|
145
|
-
execute_listener_in_model(item, item.value)
|
146
|
-
end
|
147
|
-
end
|
148
|
-
item.add_listener(:changed_items) do |new_items|
|
149
|
-
rescue_speedbar_errors do
|
150
|
-
ignore(item.name) do
|
151
|
-
combo.items = item.items.to_java(:string)
|
152
|
-
item.value = nil
|
153
|
-
end
|
154
|
-
end
|
155
|
-
end
|
156
|
-
item.add_listener(:changed_value) do |new_value|
|
157
|
-
rescue_speedbar_errors do
|
158
|
-
ignore(item.name) do
|
159
|
-
combo.select(item.items.index(item.value))
|
160
|
-
end
|
161
|
-
end
|
162
|
-
end
|
163
|
-
keyable_widgets << combo
|
164
|
-
focussable_widgets << combo
|
165
|
-
when Redcar::Speedbar::ToggleItem
|
166
|
-
button = Swt::Widgets::Button.new(@composite, Swt::SWT::CHECK)
|
167
|
-
button.set_text(item.text)
|
168
|
-
button.set_selection(!!item.value)
|
169
|
-
button.add_selection_listener do
|
170
|
-
item.value = button.get_selection
|
171
|
-
execute_listener_in_model(item, item.value)
|
172
|
-
end
|
173
|
-
item.add_listener(:changed_text) do |new_text|
|
174
|
-
rescue_speedbar_errors do
|
175
|
-
button.set_text = new_text
|
176
|
-
end
|
177
|
-
end
|
178
|
-
item.add_listener(:changed_value) do |new_value|
|
179
|
-
rescue_speedbar_errors do
|
180
|
-
button.set_selection(!!new_value)
|
181
|
-
end
|
182
|
-
end
|
183
|
-
keyable_widgets << button
|
184
|
-
focussable_widgets << button
|
185
|
-
end
|
98
|
+
swt_klass = self.class.const_get(item.class.to_s.split("::").last)
|
99
|
+
swt_klass.new(self, @composite, item)
|
186
100
|
end
|
187
101
|
end
|
188
|
-
|
102
|
+
|
189
103
|
class KeyListener
|
190
104
|
def initialize(speedbar)
|
191
105
|
@speedbar = speedbar
|
192
106
|
end
|
193
|
-
|
107
|
+
|
194
108
|
def key_pressed(e)
|
195
109
|
@speedbar.key_press(e)
|
196
110
|
end
|
197
|
-
|
111
|
+
|
198
112
|
def key_released(e)
|
199
113
|
end
|
200
114
|
end
|
201
|
-
|
115
|
+
|
202
116
|
class MouseListener
|
203
117
|
def initialize(speedbar)
|
204
118
|
@speedbar = speedbar
|
205
119
|
end
|
206
|
-
|
120
|
+
|
207
121
|
def mouse_down(*_); end
|
208
|
-
|
122
|
+
|
209
123
|
def mouse_up(*_)
|
210
124
|
@speedbar.close_pressed
|
211
125
|
end
|
212
|
-
|
126
|
+
|
213
127
|
def mouse_double_click(*_); end
|
214
128
|
end
|
215
|
-
|
129
|
+
|
216
130
|
def attach_key_listeners
|
217
131
|
keyable_widgets.each do |widget|
|
218
132
|
widget.add_key_listener(KeyListener.new(self))
|
219
133
|
end
|
220
134
|
end
|
221
|
-
|
135
|
+
|
222
136
|
def close_pressed
|
223
137
|
@window_model.close_speedbar
|
224
138
|
end
|
225
|
-
|
139
|
+
|
226
140
|
def key_press(e)
|
227
141
|
return if Application::Dialog.in_dialog?
|
228
142
|
key_string = Menu::BindingTranslator.key_string(e)
|
@@ -241,7 +155,7 @@ module Redcar
|
|
241
155
|
end
|
242
156
|
end
|
243
157
|
end
|
244
|
-
|
158
|
+
|
245
159
|
def rescue_speedbar_errors
|
246
160
|
begin
|
247
161
|
yield
|
@@ -255,7 +169,7 @@ module Redcar
|
|
255
169
|
end
|
256
170
|
end
|
257
171
|
end
|
258
|
-
|
172
|
+
|
259
173
|
def error_in_listener(e)
|
260
174
|
if e.class.name == "TestingError"
|
261
175
|
raise e
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Redcar
|
2
|
+
class ApplicationSWT
|
3
|
+
class Speedbar
|
4
|
+
class ButtonItem
|
5
|
+
def initialize(speedbar, composite, item)
|
6
|
+
button = Swt::Widgets::Button.new(composite, 0)
|
7
|
+
button.set_text(item.text)
|
8
|
+
button.add_selection_listener do
|
9
|
+
speedbar.execute_listener_in_model(item)
|
10
|
+
end
|
11
|
+
item.add_listener(:changed_text) do |new_text|
|
12
|
+
button.set_text(item.text)
|
13
|
+
end
|
14
|
+
speedbar.keyable_widgets << button
|
15
|
+
speedbar.focussable_widgets << button
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|