redcar-dev 0.12.27dev → 0.13.0dev
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 +10 -1
- data/lib/redcar.rb +2 -2
- data/plugins/application/lib/application.rb +2 -2
- 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 +16 -7
- data/plugins/application/lib/application/updates.rb +20 -3
- data/plugins/application/spec/application/updates_spec.rb +53 -0
- 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/menu.rb +31 -5
- data/plugins/declarations/lib/declarations.rb +31 -65
- data/plugins/declarations/lib/declarations/commands.rb +147 -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/project/lib/project/find_file_dialog.rb +20 -18
- data/plugins/project/lib/project/manager.rb +5 -3
- data/plugins/redcar/plugin.rb +1 -2
- data/plugins/redcar/redcar.rb +34 -42
- data/plugins/scm/lib/scm.rb +1 -1
- data/plugins/strip_trailing_spaces/lib/strip_trailing_spaces.rb +2 -2
- data/plugins/syntax_check/lib/syntax_check.rb +2 -2
- metadata +946 -956
- 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
@@ -1,98 +0,0 @@
|
|
1
|
-
module Redcar
|
2
|
-
class EditView
|
3
|
-
class InfoSpeedbar < Speedbar
|
4
|
-
def self.grammar_names
|
5
|
-
bundles = JavaMateView::Bundle.bundles.to_a
|
6
|
-
grammars = bundles.map {|b| b.grammars.to_a}.flatten
|
7
|
-
items = grammars.map {|g| g.name}.sort_by {|name| name.downcase }
|
8
|
-
end
|
9
|
-
|
10
|
-
combo :grammar do |new_grammar|
|
11
|
-
@tab.edit_view.grammar = new_grammar
|
12
|
-
end
|
13
|
-
|
14
|
-
combo :tab_width, TabSettings::TAB_WIDTHS, TabSettings::DEFAULT_TAB_WIDTH do |new_tab_width|
|
15
|
-
@tab.edit_view.tab_width = new_tab_width.to_i
|
16
|
-
end
|
17
|
-
|
18
|
-
toggle :soft_tabs, "Soft Tabs", nil, true do |new_value|
|
19
|
-
@tab.edit_view.soft_tabs = new_value
|
20
|
-
end
|
21
|
-
|
22
|
-
toggle :word_wrap, "Word Wrap", nil, false do |new_value|
|
23
|
-
@tab.edit_view.word_wrap = new_value
|
24
|
-
end
|
25
|
-
|
26
|
-
label :margin_column_label, "Margin:"
|
27
|
-
|
28
|
-
toggle :show_margin, "", nil, TabSettings::DEFAULT_MARGIN_PRESENT do |new_value|
|
29
|
-
@tab.edit_view.show_margin = new_value
|
30
|
-
end
|
31
|
-
|
32
|
-
textbox :margin_column, TabSettings::DEFAULT_MARGIN_COLUMN.to_s do |new_value|
|
33
|
-
@tab.edit_view.margin_column = [new_value.to_i, 5].max
|
34
|
-
end
|
35
|
-
|
36
|
-
def initialize(command, tab)
|
37
|
-
@command = command
|
38
|
-
tab_changed(tab)
|
39
|
-
end
|
40
|
-
|
41
|
-
def tab_changed(new_tab)
|
42
|
-
if @tab
|
43
|
-
remove_handlers
|
44
|
-
end
|
45
|
-
if new_tab.is_a?(EditTab)
|
46
|
-
@tab = new_tab
|
47
|
-
grammar.items = InfoSpeedbar.grammar_names
|
48
|
-
grammar.value = @tab.edit_view.grammar
|
49
|
-
tab_width.value = @tab.edit_view.tab_width.to_s
|
50
|
-
soft_tabs.value = @tab.edit_view.soft_tabs?
|
51
|
-
word_wrap.value = @tab.edit_view.word_wrap?
|
52
|
-
show_margin.value = @tab.edit_view.show_margin?
|
53
|
-
margin_column.value = @tab.edit_view.margin_column.to_s
|
54
|
-
@width_handler = @tab.edit_view.add_listener(:tab_width_changed) do |new_value|
|
55
|
-
tab_width.value = new_value.to_s
|
56
|
-
end
|
57
|
-
@margin_column_handler = @tab.edit_view.add_listener(:margin_column_changed) do |new_value|
|
58
|
-
margin_column.value = new_value.to_s
|
59
|
-
end
|
60
|
-
@softness_handler = @tab.edit_view.add_listener(:softness_changed) do |new_value|
|
61
|
-
soft_tabs.value = new_value
|
62
|
-
end
|
63
|
-
@word_wrap_handler = @tab.edit_view.add_listener(:word_wrap_changed) do |new_value|
|
64
|
-
word_wrap.value = new_value
|
65
|
-
end
|
66
|
-
@grammar_handler = @tab.edit_view.add_listener(:grammar_changed) do |new_grammar|
|
67
|
-
grammar.value = new_grammar
|
68
|
-
end
|
69
|
-
@show_margin_handler = @tab.edit_view.add_listener(:show_margin_changed) do |new_value|
|
70
|
-
show_margin.value = new_value
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
def remove_handlers
|
76
|
-
@tab.edit_view.remove_listener(@width_handler)
|
77
|
-
@tab.edit_view.remove_listener(@grammar_handler)
|
78
|
-
@tab.edit_view.remove_listener(@softness_handler)
|
79
|
-
@tab.edit_view.remove_listener(@word_wrap_handler)
|
80
|
-
@tab.edit_view.remove_listener(@margin_column_handler)
|
81
|
-
@tab.edit_view.remove_listener(@show_margin_handler)
|
82
|
-
end
|
83
|
-
|
84
|
-
def close
|
85
|
-
if @tab
|
86
|
-
remove_handlers
|
87
|
-
end
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
|
-
class InfoSpeedbarCommand < Redcar::EditTabCommand
|
92
|
-
def execute
|
93
|
-
@speedbar = InfoSpeedbar.new(self, tab)
|
94
|
-
win.open_speedbar(@speedbar)
|
95
|
-
end
|
96
|
-
end
|
97
|
-
end
|
98
|
-
end
|
@@ -1,79 +0,0 @@
|
|
1
|
-
Feature: Outline View
|
2
|
-
|
3
|
-
Background:
|
4
|
-
Given I will choose "plugins/outline_view/spec/fixtures/some_project" from the "open_directory" dialog
|
5
|
-
When I open a directory
|
6
|
-
|
7
|
-
Scenario: Outline View without anything to see
|
8
|
-
Given I have opened "plugins/outline_view/spec/fixtures/some_project/nothing_to_see.rb"
|
9
|
-
And I run the command Redcar::OutlineView::OpenOutlineViewCommand
|
10
|
-
Then there should be an outline view open
|
11
|
-
And the outline view should have no entries
|
12
|
-
|
13
|
-
Scenario: Outline View with something small
|
14
|
-
Given I have opened "plugins/outline_view/spec/fixtures/some_project/one_lonely_class.rb"
|
15
|
-
And I run the command Redcar::OutlineView::OpenOutlineViewCommand
|
16
|
-
Then there should be an outline view open
|
17
|
-
And the outline view should have 1 entry
|
18
|
-
And I should see "IAmAllAlone" at 0 with the "class" icon in the outline view
|
19
|
-
When I select the outline view
|
20
|
-
Then the selected text should be "class IAmAllAlone"
|
21
|
-
|
22
|
-
Scenario: Ruby methods with trailing space
|
23
|
-
Given I have opened "plugins/outline_view/spec/fixtures/some_project/trailing_space.rb"
|
24
|
-
And I run the command Redcar::OutlineView::OpenOutlineViewCommand
|
25
|
-
Then there should be an outline view open
|
26
|
-
And the outline view should have 2 entries
|
27
|
-
And I should see "trailing_space" at 1 with the "method" icon in the outline view
|
28
|
-
|
29
|
-
Scenario: Something fancier
|
30
|
-
Given I have opened "plugins/outline_view/spec/fixtures/some_project/something_fancy.rb"
|
31
|
-
And I run the command Redcar::OutlineView::OpenOutlineViewCommand
|
32
|
-
Then there should be an outline view open
|
33
|
-
And the outline view should have 88 entries
|
34
|
-
And I should see "Redcar" at 0 with the "class" icon in the outline view
|
35
|
-
When I set the outline filter to "delim"
|
36
|
-
And I wait "2" seconds
|
37
|
-
Then the outline view should have 2 entries
|
38
|
-
And I should see "delim" at 1 with the "alias" icon in the outline view
|
39
|
-
And I should see "line_delimiter" at 0 with the "method" icon in the outline view
|
40
|
-
When I set the outline filter to "selected"
|
41
|
-
And I wait "2" seconds
|
42
|
-
Then the outline view should have 2 entries
|
43
|
-
And I should see "selection_range_changed" at 0 with the "method" icon in the outline view
|
44
|
-
And I should see "selected_text" at 1 with the "method" icon in the outline view
|
45
|
-
And I select the outline view
|
46
|
-
Then the selected text should be " def selection_range_changed(start_offset, end_offset)\n"
|
47
|
-
|
48
|
-
Scenario: Matching kinda similar names
|
49
|
-
Given I have opened "plugins/outline_view/spec/fixtures/some_project/similar_names.rb"
|
50
|
-
And I run the command Redcar::OutlineView::OpenOutlineViewCommand
|
51
|
-
Then there should be an outline view open
|
52
|
-
And the outline view should have 6 entries
|
53
|
-
And I should see "SimilarNames" at 0 with the "class" icon in the outline view
|
54
|
-
And I should see "file" at 1 with the "method" icon in the outline view
|
55
|
-
And I should see "file_name" at 2 with the "method" icon in the outline view
|
56
|
-
And I should see "file_type" at 3 with the "method" icon in the outline view
|
57
|
-
And I should see "file_handle" at 4 with the "method" icon in the outline view
|
58
|
-
And I should see "file" at 5 with the "method" icon in the outline view
|
59
|
-
When I set the outline filter to "file"
|
60
|
-
And I wait "2" seconds
|
61
|
-
Then the outline view should have 5 entries
|
62
|
-
|
63
|
-
Scenario: Simple Javascript
|
64
|
-
Given I have opened "plugins/outline_view/spec/fixtures/some_project/javascript.js"
|
65
|
-
And I run the command Redcar::OutlineView::OpenOutlineViewCommand
|
66
|
-
Then there should be an outline view open
|
67
|
-
And the outline view should have 3 entries
|
68
|
-
And I should see "SomeConstructor" at 0 with the "class" icon in the outline view
|
69
|
-
When I set the outline filter to "some"
|
70
|
-
And I wait "2" seconds
|
71
|
-
Then the outline view should have 2 entries
|
72
|
-
And I should see "someMethod" at 1 with the "method" icon in the outline view
|
73
|
-
And I should see "SomeConstructor" at 0 with the "class" icon in the outline view
|
74
|
-
When I set the outline filter to "another"
|
75
|
-
And I wait "2" seconds
|
76
|
-
Then the outline view should have 1 entry
|
77
|
-
And I should see "anotherMethod" at 0 with the "method" icon in the outline view
|
78
|
-
And I select the outline view
|
79
|
-
Then the selected text should be "function anotherMethod(a,b,c)"
|
@@ -1,23 +0,0 @@
|
|
1
|
-
Feature: Project-wide Outline View
|
2
|
-
|
3
|
-
Background:
|
4
|
-
Given I will choose "plugins/outline_view/spec/fixtures/some_project" from the "open_directory" dialog
|
5
|
-
When I open a directory
|
6
|
-
|
7
|
-
Scenario: Outline View shows all available declarations
|
8
|
-
When I run the command Redcar::OutlineView::OpenProjectOutlineViewCommand
|
9
|
-
Then there should be an outline view open
|
10
|
-
And the outline view should have some entries
|
11
|
-
And I should see "IAmAllAlone" at 0 with the "class" icon in the outline view
|
12
|
-
And I should see "trailing_space" at 1 with the "method" icon in the outline view
|
13
|
-
|
14
|
-
Scenario: Narrow results using the filter
|
15
|
-
When I run the command Redcar::OutlineView::OpenProjectOutlineViewCommand
|
16
|
-
Then there should be an outline view open
|
17
|
-
When I set the outline filter to "selected"
|
18
|
-
And I wait 2 seconds
|
19
|
-
Then the outline view should have 2 entries
|
20
|
-
And I should see "selection_range_changed" at 0 with the "method" icon in the outline view
|
21
|
-
And I should see "selected_text" at 1 with the "method" icon in the outline view
|
22
|
-
And I select the outline view
|
23
|
-
Then the selected text should be " def selection_range_changed(start_offset, end_offset)\n"
|
@@ -1,61 +0,0 @@
|
|
1
|
-
def outline_view
|
2
|
-
dialog(Redcar::OutlineViewSWT::OutlineViewDialogSWT)
|
3
|
-
end
|
4
|
-
|
5
|
-
def outline_view_items
|
6
|
-
Swt.sync_exec do
|
7
|
-
outline_view.list.get_items.to_a
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
Then /^I open an outline view$/ do
|
12
|
-
Swt.sync_exec do
|
13
|
-
Redcar::OutlineView::OutlineViewDialog.new(Redcar.app.focussed_window.focussed_notebook_tab.document).open
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
Then /^there should be an outline view open$/ do
|
18
|
-
Swt.sync_exec do
|
19
|
-
outline_view.should_not be_nil
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
Then /^there should be no outline view open$/ do
|
24
|
-
Swt.sync_exec do
|
25
|
-
outline_view.should be_nil
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
When /^I set the outline filter to "(.*)"$/ do |text|
|
30
|
-
Swt.sync_exec do
|
31
|
-
outline_view.text.set_text(text)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
When /^I select the outline view$/ do
|
36
|
-
Swt.sync_exec do
|
37
|
-
outline_view.controller.selected
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
Then /^the outline view should have (no|some|\d+) entr(?:y|ies)$/ do |num|
|
42
|
-
Swt.sync_exec do
|
43
|
-
if num == "some"
|
44
|
-
outline_view_items.length.should > 0
|
45
|
-
else
|
46
|
-
num = (num == "no" ? 0 : num.to_i)
|
47
|
-
outline_view_items.length.should == num
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
Then /^I should see "(.*)" at (\d+)(?: with the "(.*)" icon )in the outline view$/ do |text, pos, icon|
|
53
|
-
Swt.sync_exec do
|
54
|
-
pos = pos.to_i
|
55
|
-
outline_view_items[pos].text.should == text
|
56
|
-
icon = Redcar::OutlineViewSWT::ICONS[icon.to_sym]
|
57
|
-
item = outline_view_items[pos]
|
58
|
-
item.get_image.should == icon
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
@@ -1,97 +0,0 @@
|
|
1
|
-
require "outline_view/commands"
|
2
|
-
|
3
|
-
module Redcar
|
4
|
-
class OutlineView
|
5
|
-
|
6
|
-
def self.menus
|
7
|
-
Menu::Builder.build do
|
8
|
-
sub_menu "View" do
|
9
|
-
item "Current Document Outline", :command => OutlineView::OpenOutlineViewCommand, :priority => :first
|
10
|
-
item "Project Outline", :command => OutlineView::OpenProjectOutlineViewCommand, :priority => :first
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
def self.keymaps
|
16
|
-
linwin = Keymap.build("main", [:linux, :windows]) do
|
17
|
-
link "Ctrl+I", OutlineView::OpenOutlineViewCommand
|
18
|
-
link "Ctrl+Shift+I", OutlineView::OpenProjectOutlineViewCommand
|
19
|
-
end
|
20
|
-
osx = Keymap.build("main", [:osx]) do
|
21
|
-
link "Cmd+I", OutlineView::OpenOutlineViewCommand
|
22
|
-
link "Cmd+Shift+I", OutlineView::OpenProjectOutlineViewCommand
|
23
|
-
end
|
24
|
-
[linwin, osx]
|
25
|
-
end
|
26
|
-
|
27
|
-
class OutlineViewDialog < FilterListDialog
|
28
|
-
include Redcar::Model
|
29
|
-
include Redcar::Observable
|
30
|
-
|
31
|
-
attr_accessor :document
|
32
|
-
attr_accessor :last_list
|
33
|
-
|
34
|
-
def initialize(document)
|
35
|
-
self.controller = Redcar::OutlineViewSWT.new(self)
|
36
|
-
@document = document
|
37
|
-
@last_list = {}
|
38
|
-
end
|
39
|
-
|
40
|
-
def close
|
41
|
-
super
|
42
|
-
end
|
43
|
-
|
44
|
-
def paths_map
|
45
|
-
@paths_map ||= {}
|
46
|
-
end
|
47
|
-
|
48
|
-
def get_paths
|
49
|
-
[@document.path]
|
50
|
-
end
|
51
|
-
|
52
|
-
def update_list(filter)
|
53
|
-
paths = get_paths
|
54
|
-
file = Declarations::File.new(paths.first)
|
55
|
-
file.add_tags_for_paths(paths)
|
56
|
-
re = make_regex(filter)
|
57
|
-
@last_list.clear
|
58
|
-
result = {}
|
59
|
-
file.tags.each do |name, path, match|
|
60
|
-
if name =~ re
|
61
|
-
@last_list[match] = name
|
62
|
-
paths_map[match] = path
|
63
|
-
result[match] = {:name => name, :kind => Declarations.match_kind(path, match)}
|
64
|
-
end
|
65
|
-
end
|
66
|
-
result
|
67
|
-
end
|
68
|
-
|
69
|
-
def selected(match, closing=true)
|
70
|
-
if @last_list
|
71
|
-
if path = paths_map[match] and File.exists? path
|
72
|
-
close if closing
|
73
|
-
Redcar::Project::Manager.open_file(path)
|
74
|
-
Redcar.app.navigation_history.save(@document) if @document
|
75
|
-
DocumentSearch::FindNextRegex.new(Regexp.new(Regexp.quote(match)), true).run_in_focussed_tab_edit_view
|
76
|
-
Redcar.app.navigation_history.save(@document) if @document
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
class ProjectOutlineViewDialog < OutlineViewDialog
|
83
|
-
def initialize(project)
|
84
|
-
@project = project
|
85
|
-
if tab = Redcar.app.focussed_notebook_tab and tab.is_a? Redcar::EditTab
|
86
|
-
@document = tab.edit_view.document
|
87
|
-
end
|
88
|
-
self.controller = Redcar::OutlineViewSWT.new(self)
|
89
|
-
@last_list = {}
|
90
|
-
end
|
91
|
-
|
92
|
-
def get_paths
|
93
|
-
@project.all_files
|
94
|
-
end
|
95
|
-
end
|
96
|
-
end
|
97
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
module Redcar
|
2
|
-
class OutlineView
|
3
|
-
class OpenOutlineViewCommand < Redcar::EditTabCommand
|
4
|
-
|
5
|
-
def execute
|
6
|
-
cur_doc = Redcar.app.focussed_window.focussed_notebook_tab.document
|
7
|
-
if cur_doc
|
8
|
-
OutlineView::OutlineViewDialog.new(cur_doc).open
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
class OpenProjectOutlineViewCommand < Redcar::ProjectCommand
|
14
|
-
def execute
|
15
|
-
OutlineView::ProjectOutlineViewDialog.new(project).open if project
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
@@ -1,79 +0,0 @@
|
|
1
|
-
module Redcar
|
2
|
-
class OutlineViewSWT < Redcar::ApplicationSWT::FilterListDialogController
|
3
|
-
include Redcar::Controller
|
4
|
-
|
5
|
-
ICONS = {
|
6
|
-
:method => ApplicationSWT::Icon.swt_image(:node_insert),
|
7
|
-
:class => ApplicationSWT::Icon.swt_image(:open_source_flipped),
|
8
|
-
:attribute => ApplicationSWT::Icon.swt_image(:status),
|
9
|
-
:alias => ApplicationSWT::Icon.swt_image(:arrow_branch),
|
10
|
-
:assignment => ApplicationSWT::Icon.swt_image(:arrow),
|
11
|
-
:interface => ApplicationSWT::Icon.swt_image(:information),
|
12
|
-
:closure => ApplicationSWT::Icon.swt_image(:node_magnifier),
|
13
|
-
:none => nil
|
14
|
-
}
|
15
|
-
|
16
|
-
class OutlineViewDialogSWT < Redcar::ApplicationSWT::FilterListDialogController::FilterListDialog
|
17
|
-
attr_reader :list, :text
|
18
|
-
attr_accessor :controller
|
19
|
-
|
20
|
-
def createDialogArea(parent)
|
21
|
-
composite = Swt::Widgets::Composite.new(parent, Swt::SWT::NONE)
|
22
|
-
layout = Swt::Layout::RowLayout.new(Swt::SWT::VERTICAL)
|
23
|
-
composite.setLayout(layout)
|
24
|
-
@text = Swt::Widgets::Text.new(composite, Swt::SWT::SINGLE | Swt::SWT::LEFT | Swt::SWT::ICON_CANCEL | Swt::SWT::SEARCH)
|
25
|
-
@text.set_layout_data(Swt::Layout::RowData.new(400, 20))
|
26
|
-
@list = Swt::Widgets::Table.new(composite, Swt::SWT::V_SCROLL | Swt::SWT::H_SCROLL | Swt::SWT::MULTI)
|
27
|
-
@list.set_layout_data(Swt::Layout::RowData.new(400, 200))
|
28
|
-
controller.attach_listeners
|
29
|
-
controller.update_list_sync
|
30
|
-
get_shell.add_shell_listener(Redcar::ApplicationSWT::FilterListDialogController::ShellListener.new(controller))
|
31
|
-
Redcar::ApplicationSWT.register_shell(get_shell)
|
32
|
-
Redcar::ApplicationSWT.register_dialog(get_shell, self)
|
33
|
-
@list.set_selection(0)
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
def initialize(model)
|
38
|
-
@model = model
|
39
|
-
@dialog = OutlineViewDialogSWT.new(Redcar.app.focussed_window.controller.shell)
|
40
|
-
@dialog.controller = self
|
41
|
-
if Redcar::ApplicationSWT::FilterListDialogController.test_mode?
|
42
|
-
@dialog.setBlockOnOpen(false)
|
43
|
-
@dialog.setShellStyle(Swt::SWT::DIALOG_TRIM)
|
44
|
-
end
|
45
|
-
attach_model_listeners
|
46
|
-
@associations = {}
|
47
|
-
end
|
48
|
-
|
49
|
-
def update_list_sync
|
50
|
-
if @dialog
|
51
|
-
s = Time.now
|
52
|
-
hash = @model.update_list(@dialog.text.get_text)
|
53
|
-
populate_table(hash)
|
54
|
-
@dialog.list.set_selection(0)
|
55
|
-
text_focus
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
def selected
|
60
|
-
@model.selected(@associations[@dialog.list.get_selection.first])
|
61
|
-
end
|
62
|
-
|
63
|
-
private
|
64
|
-
|
65
|
-
def populate_table(hash = {})
|
66
|
-
@dialog.list.removeAll; @associations.clear
|
67
|
-
hash.each do |match, props|
|
68
|
-
props = {:kind => :none, :name => ""}.merge(props)
|
69
|
-
item = Swt::Widgets::TableItem.new(@dialog.list, Swt::SWT::NONE)
|
70
|
-
@associations[item] = match
|
71
|
-
item.text = props[:name]
|
72
|
-
image = ICONS[props[:kind].to_sym] if props[:kind]
|
73
|
-
if image
|
74
|
-
item.image = image
|
75
|
-
end
|
76
|
-
end
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|