redcar 0.12.1 → 0.13
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 +18 -0
- data/bin/redcar +1 -0
- data/lib/redcar.rb +4 -5
- data/lib/redcar/usage.rb +0 -1
- data/lib/redcar_quick_start.rb +3 -1
- data/plugins/application/lib/application.rb +1 -0
- data/plugins/application/lib/application/commands/treebook_commands.rb +11 -18
- data/plugins/application/lib/application/dialog.rb +1 -1
- data/plugins/application/lib/application/dialogs/filter_list_dialog.rb +13 -5
- data/plugins/application/lib/application/global_state.rb +21 -0
- data/plugins/application/lib/application/menu/item.rb +37 -11
- data/plugins/application/lib/application/notebook.rb +12 -0
- data/plugins/application/lib/application/tree/mirror.rb +0 -11
- data/plugins/application/lib/application/window.rb +32 -7
- data/plugins/application_swt/lib/application_swt.rb +1 -1
- data/plugins/application_swt/lib/application_swt/dialogs/filter_list_dialog_controller.rb +35 -10
- data/plugins/application_swt/lib/application_swt/icon.rb +1 -1
- data/plugins/application_swt/lib/application_swt/menu.rb +47 -15
- data/plugins/application_swt/lib/application_swt/notebook.rb +11 -2
- data/plugins/application_swt/lib/application_swt/window.rb +37 -34
- data/plugins/auto_indenter/lib/auto_indenter/analyzer.rb +1 -1
- data/plugins/auto_indenter/spec/auto_indenter/analyzer_spec.rb +9 -0
- data/plugins/declarations/lib/declarations.rb +31 -66
- data/plugins/declarations/lib/declarations/commands.rb +142 -0
- data/plugins/declarations/lib/declarations/file.rb +1 -1
- data/plugins/{outline_view → declarations}/spec/fixtures/some_project/javascript.js +0 -0
- data/plugins/{outline_view → declarations}/spec/fixtures/some_project/nothing_to_see.rb +0 -0
- data/plugins/{outline_view → declarations}/spec/fixtures/some_project/one_lonely_class.rb +0 -0
- data/plugins/{outline_view → declarations}/spec/fixtures/some_project/similar_names.rb +0 -0
- data/plugins/{outline_view → declarations}/spec/fixtures/some_project/something_fancy.rb +0 -0
- data/plugins/{outline_view → declarations}/spec/fixtures/some_project/trailing_space.rb +0 -0
- data/plugins/edit_view/lib/edit_view.rb +35 -2
- data/plugins/edit_view/lib/edit_view/commands/change_language_command.rb +31 -0
- data/plugins/edit_view/lib/edit_view/commands/language_settings_commands.rb +45 -0
- data/plugins/edit_view/lib/edit_view/document/command.rb +1 -1
- data/plugins/edit_view/lib/edit_view/edit_tab.rb +11 -13
- data/plugins/key_bindings/lib/key_bindings.rb +6 -2
- data/plugins/project/lib/project.rb +27 -32
- data/plugins/project/lib/project/commands.rb +3 -88
- data/plugins/project/lib/project/dir_controller.rb +12 -18
- data/plugins/project/lib/project/dir_mirror.rb +20 -25
- data/plugins/project/lib/project/file_mirror.rb +10 -10
- data/plugins/project/lib/project/find_file_dialog.rb +20 -18
- data/plugins/project/lib/project/find_recent_dialog.rb +6 -3
- data/plugins/project/lib/project/{adapters/local.rb → local_filesystem.rb} +35 -35
- data/plugins/project/lib/project/manager.rb +21 -75
- data/plugins/project/lib/project/sub_project.rb +3 -3
- data/plugins/project/plugin.rb +0 -1
- data/plugins/project_search/lib/project_search/lucene_refresh.rb +0 -1
- data/plugins/redcar/plugin.rb +2 -2
- data/plugins/redcar/redcar.rb +34 -42
- data/plugins/ruby/lib/ruby/syntax_checker.rb +27 -7
- data/plugins/scm/lib/scm.rb +1 -12
- data/plugins/sessions/lib/sessions.rb +22 -0
- data/plugins/sessions/lib/sessions/cursor_saver.rb +162 -0
- data/plugins/sessions/lib/sessions/loader.rb +99 -0
- data/plugins/sessions/lib/sessions/memory.rb +59 -0
- data/plugins/sessions/plugin.rb +8 -0
- data/plugins/strip_trailing_spaces/lib/strip_trailing_spaces.rb +2 -2
- data/plugins/syntax_check/lib/syntax_check.rb +2 -2
- data/plugins/tree_view_swt/lib/tree_view_swt.rb +1 -3
- data/redcar.gemspec +1 -1
- metadata +195 -291
- data/plugins/connection_manager/lib/connection_manager.rb +0 -57
- data/plugins/connection_manager/lib/connection_manager/commands.rb +0 -14
- data/plugins/connection_manager/lib/connection_manager/connection_store.rb +0 -87
- data/plugins/connection_manager/lib/connection_manager/controller.rb +0 -100
- data/plugins/connection_manager/lib/connection_manager/filter_dialog.rb +0 -38
- data/plugins/connection_manager/lib/connection_manager/private_key_store.rb +0 -93
- data/plugins/connection_manager/plugin.rb +0 -12
- data/plugins/connection_manager/views/index.html.erb +0 -284
- data/plugins/edit_view/lib/edit_view/info_speedbar.rb +0 -98
- data/plugins/outline_view/features/outline_view.feature +0 -79
- data/plugins/outline_view/features/project_outline.feature +0 -23
- data/plugins/outline_view/features/step_definitions/outline_steps.rb +0 -61
- data/plugins/outline_view/lib/outline_view.rb +0 -97
- data/plugins/outline_view/lib/outline_view/commands.rb +0 -19
- data/plugins/outline_view/plugin.rb +0 -10
- data/plugins/outline_view_swt/lib/outline_view_swt.rb +0 -79
- data/plugins/outline_view_swt/plugin.rb +0 -7
- data/plugins/project/lib/project/adapters/remote.rb +0 -96
- data/plugins/project/lib/project/adapters/remote_protocols/ftp.rb +0 -93
- data/plugins/project/lib/project/adapters/remote_protocols/protocol.rb +0 -94
- data/plugins/project/lib/project/adapters/remote_protocols/sftp.rb +0 -181
data/CHANGES
CHANGED
@@ -1,3 +1,21 @@
|
|
1
|
+
Version 0.13 (21st January 2012)
|
2
|
+
================================
|
3
|
+
|
4
|
+
* Move all language settings options into the Edit menu, for easier discoverability.(Dan Lucraft)
|
5
|
+
* Move the change tab language command into the Edit menu, and make it a filter list. (Dan Lucraft)
|
6
|
+
* extended the FilterListDialog class to support icons, by merging in the outline_view plugin (Dan Lucraft)
|
7
|
+
* implemented project-wide Find declaration (Project/Find declaration) (Dan Lucraft)
|
8
|
+
* Don't use Bundler when running as a gem (Dan Lucraft)
|
9
|
+
* Parse Ruby with 1.9 syntax instead of 1.8 (Dan Lucraft)
|
10
|
+
* Made the auto indenter ignore blank lines when deciding on indentation. (Dan Lucraft)
|
11
|
+
* New API for tab context menus (Dan Lucraft)
|
12
|
+
* Copy path of file to clipboard tab context menu item (Dan Lucraft)
|
13
|
+
* New APIs on Window to get and set window location, size and tree width (Dan Lucraft)
|
14
|
+
* Remember project window location and size, and tree width between sessions (Markus Kahl)
|
15
|
+
* Remember open files between sessions (Christopher Wade)
|
16
|
+
* Remember cursor location and selection between sessions (Christopher Wade)
|
17
|
+
* Remove broken remote project support, and clean up Project classes. (Dan Lucraft)
|
18
|
+
|
1
19
|
Version 0.12 (7th January 2012)
|
2
20
|
===============================
|
3
21
|
|
data/bin/redcar
CHANGED
@@ -9,6 +9,7 @@ file = File.readlink(file) while File.symlink?(file)
|
|
9
9
|
$LOAD_PATH.unshift File.expand_path('../../lib', file)
|
10
10
|
|
11
11
|
require "redcar_quick_start"
|
12
|
+
|
12
13
|
if ARGV.include? '--silent'
|
13
14
|
# reopen the standard pipes to nothingness if we were forked as part of jruby
|
14
15
|
STDIN.reopen Redcar.null_device
|
data/lib/redcar.rb
CHANGED
@@ -23,8 +23,7 @@ entries_in_gem_home = Dir[prospective_gem_home + "/*"].map {|path| File.basenam
|
|
23
23
|
if (["cache", "gems"] - entries_in_gem_home).length == 0
|
24
24
|
ENV["GEM_HOME"] = prospective_gem_home
|
25
25
|
else
|
26
|
-
require 'bundler'
|
27
|
-
Bundler.require(:default)
|
26
|
+
require 'bundler/setup'
|
28
27
|
end
|
29
28
|
|
30
29
|
require 'redcar-icons'
|
@@ -70,10 +69,10 @@ end
|
|
70
69
|
#
|
71
70
|
# and so on.
|
72
71
|
module Redcar
|
73
|
-
VERSION = '0.
|
72
|
+
VERSION = '0.13' # also change in the gemspec!
|
74
73
|
VERSION_MAJOR = 0
|
75
|
-
VERSION_MINOR =
|
76
|
-
VERSION_RELEASE =
|
74
|
+
VERSION_MINOR = 13
|
75
|
+
VERSION_RELEASE = 0
|
77
76
|
|
78
77
|
ENVIRONMENTS = [:user, :debug, :test]
|
79
78
|
|
data/lib/redcar/usage.rb
CHANGED
data/lib/redcar_quick_start.rb
CHANGED
@@ -33,7 +33,9 @@ module Redcar
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def self.try_to_load_via_drb
|
36
|
-
|
36
|
+
if ARGV.find {|arg| arg == "--multiple-instance" || arg == '--help' || arg == '-h' || arg == "-v"}
|
37
|
+
return false
|
38
|
+
end
|
37
39
|
begin
|
38
40
|
begin
|
39
41
|
TCPSocket.new('127.0.0.1', drb_port).close
|
@@ -12,6 +12,7 @@ require 'application/dialog'
|
|
12
12
|
require 'application/dialogs/filter_list_dialog'
|
13
13
|
require 'application/dialogs/modeless_list_dialog'
|
14
14
|
require 'application/event_spewer'
|
15
|
+
require 'application/global_state'
|
15
16
|
require 'application/keymap'
|
16
17
|
require 'application/keymap/builder'
|
17
18
|
require 'application/toolbar'
|
@@ -42,32 +42,25 @@ module Redcar
|
|
42
42
|
end
|
43
43
|
|
44
44
|
class TreebookWidthCommand < Command
|
45
|
+
MINIMUM_TREEBOOK_WIDTH = 0
|
46
|
+
WIDTH_INCREMENT = 5
|
45
47
|
sensitize :open_trees
|
46
|
-
|
47
|
-
def increment
|
48
|
-
raise "Please implement me!"
|
49
|
-
end
|
50
|
-
|
51
|
-
def execute
|
52
|
-
if win = Redcar.app.focussed_window
|
53
|
-
if increment > 0
|
54
|
-
win.adjust_treebook_width(true)
|
55
|
-
else
|
56
|
-
win.adjust_treebook_width(false)
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
48
|
end
|
61
49
|
|
62
50
|
class IncreaseTreebookWidthCommand < TreebookWidthCommand
|
63
|
-
def
|
64
|
-
|
51
|
+
def execute
|
52
|
+
win = Redcar.app.focussed_window
|
53
|
+
win.treebook_width = win.treebook_width + WIDTH_INCREMENT
|
65
54
|
end
|
66
55
|
end
|
67
56
|
|
68
57
|
class DecreaseTreebookWidthCommand < TreebookWidthCommand
|
69
|
-
def
|
70
|
-
|
58
|
+
def execute
|
59
|
+
win = Redcar.app.focussed_window
|
60
|
+
new_width = win.treebook_width - WIDTH_INCREMENT
|
61
|
+
unless new_width < MINIMUM_TREEBOOK_WIDTH
|
62
|
+
win.treebook_width = new_width
|
63
|
+
end
|
71
64
|
end
|
72
65
|
end
|
73
66
|
|
@@ -84,7 +84,7 @@ module Redcar
|
|
84
84
|
#
|
85
85
|
# The return value is a hash containing :button and :value.
|
86
86
|
def self.input(title, message, initial_value="", &validator)
|
87
|
-
in_dialog { Redcar.gui.dialog_adapter.input(title, message, initial_value, &validator) }
|
87
|
+
in_dialog { Redcar.gui.dialog_adapter.input(title.to_s, message.to_s, initial_value.to_s, &validator) }
|
88
88
|
end
|
89
89
|
|
90
90
|
# Show a dialog containing a password entry box to the user, and blocks
|
@@ -20,10 +20,18 @@ module Redcar
|
|
20
20
|
notify_listeners(:close)
|
21
21
|
end
|
22
22
|
|
23
|
-
# Called by the controller when the user changes the filter.
|
23
|
+
# Called by the controller when the user changes the filter.
|
24
|
+
#
|
25
|
+
# Should return either a list of strings, or a list of hashes, which must have at least
|
26
|
+
# the key :name set, and may also have the key :image.
|
27
|
+
#
|
28
|
+
# E.g. it returns ["feed.rb", "application_controller.rb"]
|
29
|
+
# or it returns [{:name => "feed.rb"}, {:name => "application_controller.rb"}]
|
30
|
+
#
|
31
|
+
# The methods selected and moved_to will be called with items from this list.
|
24
32
|
#
|
25
33
|
# @param [String] the filter entered by the user
|
26
|
-
# @return [Array<String>] the new list to display
|
34
|
+
# @return [Array<String> or Array<Hash>] the new list to display
|
27
35
|
def update_list(filter)
|
28
36
|
if filter == ""
|
29
37
|
%w(foo bar baz qux quux corge)
|
@@ -36,9 +44,9 @@ module Redcar
|
|
36
44
|
|
37
45
|
# Called by the controller when the user selects a row in the list.
|
38
46
|
#
|
39
|
-
# @param [String] the
|
47
|
+
# @param [String or Hash] the item selected by the user
|
40
48
|
# @param [Integer] the index of the row in the list selected by the user
|
41
|
-
def selected(
|
49
|
+
def selected(item, ix)
|
42
50
|
puts "Hooray! You selected #{text} at index #{ix}"
|
43
51
|
end
|
44
52
|
|
@@ -46,7 +54,7 @@ module Redcar
|
|
46
54
|
#
|
47
55
|
# @param [String] the list row text that is now highlighted
|
48
56
|
# @param [Integer] the index of the row that is now highlighted
|
49
|
-
def moved_to(
|
57
|
+
def moved_to(item, ix)
|
50
58
|
# Override with the code you wish you had
|
51
59
|
end
|
52
60
|
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Redcar
|
2
|
+
class Application
|
3
|
+
class GlobalState
|
4
|
+
def app
|
5
|
+
Redcar.app
|
6
|
+
end
|
7
|
+
|
8
|
+
def win
|
9
|
+
app and app.focussed_window
|
10
|
+
end
|
11
|
+
|
12
|
+
def project
|
13
|
+
win and Project.in_window(win)
|
14
|
+
end
|
15
|
+
|
16
|
+
def tab
|
17
|
+
win and win.focussed_notebook_tab
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -12,26 +12,38 @@ module Redcar
|
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
|
-
attr_reader :command, :priority, :value, :type
|
15
|
+
attr_reader :command, :priority, :value, :type
|
16
16
|
|
17
17
|
# Create a new Item, with the given text to display in the menu, and
|
18
18
|
# either:
|
19
19
|
# the Redcar::Command that is run when the item is selected.
|
20
20
|
# or a block to run when the item is selected
|
21
|
-
|
21
|
+
#
|
22
|
+
# Instead of a command, a hash of options may be passed:
|
23
|
+
# :command - specify a command class
|
24
|
+
# :priority - Integer, higher means lower in menus
|
25
|
+
# :value - if passed, the command class with be instantiation like:
|
26
|
+
# Command.new(:value => value)
|
27
|
+
# :enabled - if set to false, this menu item will be permanently disabled
|
28
|
+
# :type - can be set to :check or :radio
|
29
|
+
# :checked - if type is check or radio, a block that will be run when
|
30
|
+
# the menu is displayed to determine whether this item is checked
|
31
|
+
def initialize(text, command_or_options={}, &block)
|
22
32
|
@text = text
|
23
33
|
|
24
|
-
if
|
34
|
+
if command_or_options.respond_to?('[]')
|
35
|
+
options = command_or_options
|
25
36
|
@command = options[:command] || block
|
26
37
|
@priority = options[:priority]
|
27
38
|
@value = options[:value]
|
28
39
|
@type = options[:type]
|
29
|
-
@
|
30
|
-
|
31
|
-
|
32
|
-
|
40
|
+
@enabled = (options.key?(:enabled) ? options[:enabled] : true)
|
41
|
+
if [:check, :radio].include?(@type)
|
42
|
+
@checked = options[:checked]
|
43
|
+
end
|
33
44
|
else
|
34
|
-
@
|
45
|
+
@enabled = true
|
46
|
+
@command = command_or_options || block
|
35
47
|
end
|
36
48
|
|
37
49
|
@priority ||= Menu::DEFAULT_PRIORITY
|
@@ -42,7 +54,7 @@ module Redcar
|
|
42
54
|
if @value
|
43
55
|
@command.new.run(:value => @value)
|
44
56
|
else
|
45
|
-
@command.new.run
|
57
|
+
@command.new.run
|
46
58
|
end
|
47
59
|
end
|
48
60
|
|
@@ -55,11 +67,13 @@ module Redcar
|
|
55
67
|
end
|
56
68
|
|
57
69
|
def text
|
58
|
-
@text.
|
70
|
+
@text.respond_to?(:call) ?
|
71
|
+
Redcar::Application::GlobalState.new.instance_eval(&@text) :
|
72
|
+
@text
|
59
73
|
end
|
60
74
|
|
61
75
|
def lazy_text?
|
62
|
-
@text.
|
76
|
+
@text.respond_to?(:call)
|
63
77
|
end
|
64
78
|
|
65
79
|
def merge(other)
|
@@ -74,6 +88,18 @@ module Redcar
|
|
74
88
|
def is_unique?
|
75
89
|
false
|
76
90
|
end
|
91
|
+
|
92
|
+
def enabled?
|
93
|
+
@enabled
|
94
|
+
end
|
95
|
+
|
96
|
+
def checked?
|
97
|
+
@checked and (
|
98
|
+
@checked.respond_to?(:call) ?
|
99
|
+
Redcar::Application::GlobalState.new.instance_eval(&@checked) :
|
100
|
+
@checked
|
101
|
+
)
|
102
|
+
end
|
77
103
|
end
|
78
104
|
end
|
79
105
|
end
|
@@ -132,6 +132,18 @@ module Redcar
|
|
132
132
|
end
|
133
133
|
index
|
134
134
|
end
|
135
|
+
|
136
|
+
# Triggers the display of the tab context menu at the current
|
137
|
+
# cursor location.
|
138
|
+
def right_click_on_tab(tab)
|
139
|
+
menu = Menu.new
|
140
|
+
Redcar.plugin_manager.objects_implementing(:tab_context_menu).each do |object|
|
141
|
+
menu.merge(object.tab_context_menu(tab))
|
142
|
+
end
|
143
|
+
|
144
|
+
Application::Dialog.popup_menu(menu, :pointer)
|
145
|
+
end
|
146
|
+
|
135
147
|
|
136
148
|
def inspect
|
137
149
|
"#<Redcar::Notebook #{object_id}>"
|
@@ -78,17 +78,6 @@ module Redcar
|
|
78
78
|
raise "not implemented"
|
79
79
|
end
|
80
80
|
|
81
|
-
# Called when the whole tree needs to be refreshed. Implementations
|
82
|
-
# should do whatever they need to do to fetch full tree data, and then
|
83
|
-
# yield.
|
84
|
-
#
|
85
|
-
# The purpose is so that a refresh operation can run against some cached
|
86
|
-
# data, but then at the end of the method the mirror can discard the cache.
|
87
|
-
# Because refreshes typically generate large numbers of queries.
|
88
|
-
def refresh_operation(tree)
|
89
|
-
yield
|
90
|
-
end
|
91
|
-
|
92
81
|
# This is the required interface of a ROW in a TreeView.
|
93
82
|
module NodeMirror
|
94
83
|
include Redcar::Observable
|
@@ -63,7 +63,7 @@ module Redcar
|
|
63
63
|
def fullscreen=(value)
|
64
64
|
controller.fullscreen = value
|
65
65
|
end
|
66
|
-
|
66
|
+
|
67
67
|
# Create a new notebook in this window.
|
68
68
|
#
|
69
69
|
# @events [(:new_notebook, notebook)]
|
@@ -82,14 +82,39 @@ module Redcar
|
|
82
82
|
notify_listeners(:enlarge_notebook,index)
|
83
83
|
end
|
84
84
|
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
85
|
+
# The width of a treebook in this window. (Even if there is none
|
86
|
+
# this is the width it would be.)
|
87
|
+
def treebook_width
|
88
|
+
if controller
|
89
|
+
controller.treebook_open_width
|
90
90
|
end
|
91
91
|
end
|
92
|
-
|
92
|
+
|
93
|
+
# Set treebook width (does not reopen a hidden tree)
|
94
|
+
def treebook_width=(size)
|
95
|
+
if controller
|
96
|
+
controller.set_treebook_open_width(size)
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
# Get dimensions and location of this window
|
101
|
+
#
|
102
|
+
# Returns: [x, y, width, height]
|
103
|
+
def bounds
|
104
|
+
if controller
|
105
|
+
controller.bounds
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
# Set bounds of this window
|
110
|
+
#
|
111
|
+
# @dimensions [x, y, width, height]
|
112
|
+
def bounds=(new_bounds)
|
113
|
+
if controller
|
114
|
+
controller.set_bounds(new_bounds)
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
93
118
|
def reset_notebook_widths
|
94
119
|
notify_listeners(:reset_notebook_widths)
|
95
120
|
end
|
@@ -13,8 +13,8 @@ require "application_swt/dialogs/modeless_dialog"
|
|
13
13
|
require "application_swt/dialogs/modeless_html_dialog"
|
14
14
|
require "application_swt/dialogs/modeless_list_dialog_controller"
|
15
15
|
require "application_swt/gradient"
|
16
|
-
require "application_swt/html_tab"
|
17
16
|
require "application_swt/icon"
|
17
|
+
require "application_swt/html_tab"
|
18
18
|
require "application_swt/listener_helpers"
|
19
19
|
require "application_swt/menu"
|
20
20
|
require "application_swt/menu/binding_translator"
|
@@ -14,20 +14,33 @@ module Redcar
|
|
14
14
|
attr_accessor :controller
|
15
15
|
|
16
16
|
def createDialogArea(parent)
|
17
|
+
# composite = Swt::Widgets::Composite.new(parent, Swt::SWT::NONE)
|
18
|
+
# layout = Swt::Layout::RowLayout.new(Swt::SWT::VERTICAL)
|
19
|
+
# composite.setLayout(layout)
|
20
|
+
#
|
21
|
+
# @text = Swt::Widgets::Text.new(composite, Swt::SWT::SINGLE | Swt::SWT::LEFT | Swt::SWT::ICON_CANCEL | Swt::SWT::SEARCH)
|
22
|
+
# @text.set_layout_data(Swt::Layout::RowData.new(400, 20))
|
23
|
+
# @list = Swt::Widgets::List.new(composite, Swt::SWT::V_SCROLL | Swt::SWT::H_SCROLL | Swt::SWT::SINGLE)
|
24
|
+
# @list.set_layout_data(Swt::Layout::RowData.new(400, 200))
|
25
|
+
# controller.attach_listeners
|
26
|
+
# controller.update_list_sync
|
27
|
+
# get_shell.add_shell_listener(ShellListener.new(controller))
|
28
|
+
# ApplicationSWT.register_shell(get_shell)
|
29
|
+
# ApplicationSWT.register_dialog(get_shell, self)
|
30
|
+
#
|
31
|
+
# @list.set_selection(0)
|
17
32
|
composite = Swt::Widgets::Composite.new(parent, Swt::SWT::NONE)
|
18
33
|
layout = Swt::Layout::RowLayout.new(Swt::SWT::VERTICAL)
|
19
34
|
composite.setLayout(layout)
|
20
|
-
|
21
35
|
@text = Swt::Widgets::Text.new(composite, Swt::SWT::SINGLE | Swt::SWT::LEFT | Swt::SWT::ICON_CANCEL | Swt::SWT::SEARCH)
|
22
36
|
@text.set_layout_data(Swt::Layout::RowData.new(400, 20))
|
23
|
-
@list = Swt::Widgets::
|
37
|
+
@list = Swt::Widgets::Table.new(composite, Swt::SWT::V_SCROLL | Swt::SWT::H_SCROLL | Swt::SWT::MULTI)
|
24
38
|
@list.set_layout_data(Swt::Layout::RowData.new(400, 200))
|
25
39
|
controller.attach_listeners
|
26
40
|
controller.update_list_sync
|
27
41
|
get_shell.add_shell_listener(ShellListener.new(controller))
|
28
|
-
ApplicationSWT.register_shell(get_shell)
|
29
|
-
ApplicationSWT.register_dialog(get_shell, self)
|
30
|
-
|
42
|
+
Redcar::ApplicationSWT.register_shell(get_shell)
|
43
|
+
Redcar::ApplicationSWT.register_dialog(get_shell, self)
|
31
44
|
@list.set_selection(0)
|
32
45
|
end
|
33
46
|
end
|
@@ -167,7 +180,8 @@ module Redcar
|
|
167
180
|
|
168
181
|
def widget_selected
|
169
182
|
if @model.step?
|
170
|
-
|
183
|
+
ix = @dialog.list.get_selection_index
|
184
|
+
@model.moved_to(@list[ix], ix)
|
171
185
|
end
|
172
186
|
end
|
173
187
|
|
@@ -185,7 +199,8 @@ module Redcar
|
|
185
199
|
|
186
200
|
def selected
|
187
201
|
wait_for_search if select_closest_match?
|
188
|
-
|
202
|
+
ix = @dialog.list.get_selection_index
|
203
|
+
@model.selected(@list[ix], ix)
|
189
204
|
end
|
190
205
|
|
191
206
|
def key_pressed(key_event)
|
@@ -221,10 +236,20 @@ module Redcar
|
|
221
236
|
end
|
222
237
|
|
223
238
|
def populate_list(contents)
|
239
|
+
@list = contents
|
224
240
|
if @dialog
|
225
|
-
@dialog.list.
|
226
|
-
contents.each do |
|
227
|
-
|
241
|
+
@dialog.list.remove_all
|
242
|
+
contents.each do |props|
|
243
|
+
if props.is_a?(String)
|
244
|
+
props = {:name => props}
|
245
|
+
end
|
246
|
+
props = {:name => ""}.merge(props)
|
247
|
+
item = Swt::Widgets::TableItem.new(@dialog.list, Swt::SWT::NONE)
|
248
|
+
item.text = props[:name]
|
249
|
+
image = ApplicationSWT::Icon.swt_image(props[:icon]) if props[:icon]
|
250
|
+
if image
|
251
|
+
item.image = image
|
252
|
+
end
|
228
253
|
end
|
229
254
|
end
|
230
255
|
end
|