redcar 0.3.5 → 0.3.6
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +28 -0
- data/README.md +7 -0
- data/ROADMAP.md +11 -1
- data/Rakefile +61 -2
- data/bin/redcar +2 -1
- data/lib/redcar.rb +4 -3
- data/lib/redcar/installer.rb +3 -1
- data/lib/redcar/runner.rb +1 -1
- data/lib/redcar/usage.rb +4 -7
- data/lib/redcar_quick_start.rb +39 -5
- data/plugins/application/features/step_definitions/tree_steps.rb +6 -0
- data/plugins/application/features/support/env.rb +2 -6
- data/plugins/application/icons/redcar_icon_beta_dev.png +0 -0
- data/plugins/application/lib/application/command/executor.rb +8 -0
- data/plugins/application/lib/application/dialog.rb +25 -2
- data/plugins/application/lib/application/notebook.rb +4 -0
- data/plugins/application/lib/application/window.rb +4 -0
- data/plugins/application_swt/lib/application_swt.rb +2 -0
- data/plugins/application_swt/lib/application_swt/dialog_adapter.rb +28 -1
- data/plugins/application_swt/lib/application_swt/menu.rb +4 -0
- data/plugins/application_swt/lib/application_swt/menu/binding_translator.rb +4 -0
- data/plugins/application_swt/lib/application_swt/notebook.rb +22 -1
- data/plugins/application_swt/lib/application_swt/notebook/tab_drag_and_drop_listener.rb +124 -0
- data/plugins/application_swt/lib/application_swt/notebook/tab_transfer.rb +83 -0
- data/plugins/application_swt/lib/application_swt/swt_wrapper.rb +14 -0
- data/plugins/application_swt/lib/application_swt/tab.rb +28 -6
- data/plugins/application_swt/lib/application_swt/window.rb +88 -43
- data/plugins/application_swt/spec/application_swt/menu/binding_translator_spec.rb +11 -0
- data/plugins/application_swt/spec/spec_helper.rb +1 -1
- data/plugins/auto_completer/lib/auto_completer.rb +3 -20
- data/plugins/auto_pairer/lib/auto_pairer/document_controller.rb +1 -1
- data/plugins/declarations/lib/declarations/parser.rb +2 -2
- data/plugins/declarations/spec/spec_helper.rb +1 -0
- data/plugins/edit_view/features/step_definitions/notebook_steps.rb +3 -3
- data/plugins/edit_view/features/step_definitions/window_steps.rb +24 -9
- data/plugins/edit_view/features/support/env.rb +11 -9
- data/plugins/edit_view/lib/edit_view.rb +106 -6
- data/plugins/edit_view/lib/edit_view/info_speedbar.rb +32 -3
- data/plugins/edit_view/lib/edit_view/select_font_dialog.rb +39 -0
- data/plugins/edit_view/lib/edit_view/select_theme_dialog.rb +34 -0
- data/plugins/edit_view/lib/edit_view/tab_settings.rb +103 -8
- data/plugins/edit_view_swt/lib/edit_view_swt.rb +40 -3
- data/plugins/edit_view_swt/lib/edit_view_swt/edit_tab.rb +1 -1
- data/plugins/execute_current_tab/lib/execute_current_tab.rb +15 -6
- data/plugins/project/features/open_directory_tree.feature +10 -0
- data/plugins/project/lib/project.rb +10 -8
- data/plugins/project/lib/project/dir_mirror.rb +6 -5
- data/plugins/project/lib/project/drb_service.rb +16 -0
- data/plugins/project/lib/project/manager.rb +31 -5
- data/plugins/redcar/redcar.rb +115 -19
- data/plugins/tree_view_swt/lib/tree_view_swt.rb +15 -0
- data/textmate/Bundles/Cucumber.tmbundle/Preferences/Cucumber_Plain_Text_Feature_Completions.tmPreferences +3 -3
- data/textmate/Bundles/Cucumber.tmbundle/Preferences/Symbol_list___Scenario.tmPreferences +1 -1
- data/textmate/Bundles/Cucumber.tmbundle/Syntaxes/Cucumber_Plain_Text_Feature.tmLanguage +18 -76
- data/textmate/Bundles/Cucumber.tmbundle/Syntaxes/Cucumber_Steps.tmLanguage +1 -1
- data/textmate/Bundles/Palm-WebOS-Development.tmbundle/Snippets/Animation_animateStyle.tmSnippet +23 -0
- data/textmate/Bundles/Palm-WebOS-Development.tmbundle/Snippets/Event_listen.tmSnippet +16 -0
- data/textmate/Bundles/{Cucumber.tmbundle/Snippets/When_Step_Plaintext.tmSnippet → Palm-WebOS-Development.tmbundle/Snippets/Event_stop.tmSnippet} +5 -5
- data/textmate/Bundles/{Cucumber.tmbundle/Snippets/Then_Step.tmSnippet → Palm-WebOS-Development.tmbundle/Snippets/Event_stopListening.tmSnippet} +5 -9
- data/textmate/Bundles/{Cucumber.tmbundle/Snippets/Cucumber_Multiline_Steps.tmSnippet → Palm-WebOS-Development.tmbundle/Snippets/List_Model.tmSnippet} +10 -7
- data/textmate/Bundles/Palm-WebOS-Development.tmbundle/Snippets/Log_addLoggingMethodsToPrototype.tmSnippet +16 -0
- data/textmate/Bundles/{Cucumber.tmbundle/Snippets/Then_Step_Plaintext.tmSnippet → Palm-WebOS-Development.tmbundle/Snippets/Log_info.tmSnippet} +5 -5
- data/textmate/Bundles/{Cucumber.tmbundle/Snippets/Scenario___heading_only__.tmSnippet → Palm-WebOS-Development.tmbundle/Snippets/Log_logProperties.tmSnippet} +5 -7
- data/textmate/Bundles/{Cucumber.tmbundle/Snippets/When_Step.tmSnippet → Palm-WebOS-Development.tmbundle/Snippets/Model.tmSnippet} +7 -9
- data/textmate/Bundles/Palm-WebOS-Development.tmbundle/Snippets/__L____.tmSnippet +16 -0
- data/textmate/Bundles/Palm-WebOS-Development.tmbundle/Snippets/_insert____.tmSnippet +16 -0
- data/textmate/Bundles/Palm-WebOS-Development.tmbundle/Snippets/_update____.tmSnippet +16 -0
- data/textmate/Bundles/Palm-WebOS-Development.tmbundle/Snippets/controller_get.tmSnippet +16 -0
- data/textmate/Bundles/Palm-WebOS-Development.tmbundle/Snippets/controller_pushScene.tmSnippet +16 -0
- data/textmate/Bundles/Palm-WebOS-Development.tmbundle/Snippets/controller_serviceRequest.tmSnippet +21 -0
- data/textmate/Bundles/{Cucumber.tmbundle/Snippets/Scenario_Outline.tmSnippet → Palm-WebOS-Development.tmbundle/Snippets/controller_setupWidget.tmSnippet} +5 -9
- data/textmate/Bundles/{Cucumber.tmbundle/Snippets/Given_Step.tmSnippet → Palm-WebOS-Development.tmbundle/Snippets/controller_showBanner.tmSnippet} +5 -9
- data/textmate/Bundles/Palm-WebOS-Development.tmbundle/Syntaxes/Mojo.tmLanguage +713 -0
- data/textmate/Bundles/Palm-WebOS-Development.tmbundle/info.plist +188 -0
- data/textmate/Bundles/Smalltalk.tmbundle/Preferences/GNU_Smalltalk.tmPreferences +32 -0
- data/textmate/Bundles/{asciidoc.tmbundle/Preferences/Symbol_List___Heading.tmPreferences → Smalltalk.tmbundle/Preferences/GNU___Symbol_List___Method.tmPreferences} +7 -6
- data/textmate/Bundles/{Cucumber.tmbundle/Preferences/next_Symbol_list___Scenario.tmPreferences → Smalltalk.tmbundle/Preferences/GNU___Symbol_List___Section.tmPreferences} +7 -4
- data/textmate/Bundles/{asciidoc.tmbundle/Snippets/Bold.tmSnippet → Smalltalk.tmbundle/Preferences/MIST_Smalltalk_Format.tmPreferences} +8 -7
- data/textmate/Bundles/Smalltalk.tmbundle/Syntaxes/GNU_Smalltalk.tmLanguage +493 -0
- data/textmate/Bundles/Smalltalk.tmbundle/Syntaxes/GNU_Smalltalk_2.tmLanguage +807 -0
- data/textmate/Bundles/Smalltalk.tmbundle/Syntaxes/MIST_Smalltalk_Format.tmLanguage +645 -0
- data/textmate/Bundles/Smalltalk.tmbundle/info.plist +21 -0
- data/textmate/Themes/Twilight.tmTheme +4 -0
- metadata +2604 -2586
- data/textmate/Bundles/Cucumber.tmbundle/Preferences/next_Cucumber_Plain_Text_Feature_Completions.tmPreferences +0 -30
- data/textmate/Bundles/Cucumber.tmbundle/Syntaxes/next_Cucumber_Plain_Text_Feature.tmLanguage +0 -221
- data/textmate/Bundles/Cucumber.tmbundle/Syntaxes/next_Cucumber_Steps.tmLanguage +0 -424
- data/textmate/Bundles/asciidoc.tmbundle/Preferences/Typing_Pairs___Defaults.tmPreferences +0 -54
- data/textmate/Bundles/asciidoc.tmbundle/Snippets/Anchor.tmSnippet +0 -16
- data/textmate/Bundles/asciidoc.tmbundle/Snippets/Comment_Block.tmSnippet +0 -19
- data/textmate/Bundles/asciidoc.tmbundle/Snippets/Example_Block.tmSnippet +0 -19
- data/textmate/Bundles/asciidoc.tmbundle/Snippets/Italic.tmSnippet +0 -16
- data/textmate/Bundles/asciidoc.tmbundle/Snippets/Listing_Block.tmSnippet +0 -20
- data/textmate/Bundles/asciidoc.tmbundle/Snippets/Literal_Block.tmSnippet +0 -19
- data/textmate/Bundles/asciidoc.tmbundle/Snippets/Passthrough_Block.tmSnippet +0 -19
- data/textmate/Bundles/asciidoc.tmbundle/Snippets/Quote_Block.tmSnippet +0 -19
- data/textmate/Bundles/asciidoc.tmbundle/Snippets/Quoted.tmSnippet +0 -16
- data/textmate/Bundles/asciidoc.tmbundle/Snippets/Sidebar_Block.tmSnippet +0 -19
- data/textmate/Bundles/asciidoc.tmbundle/Snippets/Subscript.tmSnippet +0 -16
- data/textmate/Bundles/asciidoc.tmbundle/Snippets/Superscript.tmSnippet +0 -16
- data/textmate/Bundles/asciidoc.tmbundle/Syntaxes/AsciiDoc.tmLanguage +0 -428
- data/textmate/Bundles/asciidoc.tmbundle/info.plist +0 -91
@@ -0,0 +1,34 @@
|
|
1
|
+
module Redcar
|
2
|
+
class EditView
|
3
|
+
class SelectThemeDialog < FilterListDialog
|
4
|
+
|
5
|
+
def initialize
|
6
|
+
super()
|
7
|
+
@matches = EditView.themes.sort
|
8
|
+
end
|
9
|
+
|
10
|
+
def close
|
11
|
+
super
|
12
|
+
end
|
13
|
+
|
14
|
+
def update_list(filter)
|
15
|
+
@last_list = @matches
|
16
|
+
filtered_list = @last_list
|
17
|
+
if filter.length >= 1
|
18
|
+
filtered_list = filter_and_rank_by(filtered_list, filter, filtered_list.length) do |match|
|
19
|
+
match
|
20
|
+
end
|
21
|
+
end
|
22
|
+
filtered_list
|
23
|
+
end
|
24
|
+
|
25
|
+
def selected(text, ix, closing=false)
|
26
|
+
if @last_list
|
27
|
+
close
|
28
|
+
Redcar::EditView.theme = text
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -3,18 +3,39 @@ module Redcar
|
|
3
3
|
class TabSettings
|
4
4
|
DEFAULT_SOFTNESS = true
|
5
5
|
DEFAULT_TAB_WIDTH = 2
|
6
|
+
DEFAULT_WORD_WRAP = false
|
7
|
+
DEFAULT_SETTING_NAME = "Default"
|
6
8
|
TAB_WIDTHS = %w(2 3 4 5 6 8)
|
7
|
-
|
8
|
-
|
9
|
-
|
9
|
+
DEFAULT_MARGIN_COLUMN = 80
|
10
|
+
DEFAULT_MARGIN_PRESENT = false
|
11
|
+
|
12
|
+
attr_reader :tab_widths, :softnesses, :word_wraps, :margin_columns
|
13
|
+
attr_reader :show_margins
|
14
|
+
attr_reader :show_invisibles, :show_line_numbers, :show_annotations
|
15
|
+
|
10
16
|
def initialize
|
11
|
-
@tab_widths
|
12
|
-
|
13
|
-
|
17
|
+
@tab_widths =
|
18
|
+
{DEFAULT_SETTING_NAME => DEFAULT_TAB_WIDTH}.merge(
|
19
|
+
EditView.storage['tab_widths'] || {})
|
20
|
+
@softnesses =
|
21
|
+
{DEFAULT_SETTING_NAME => DEFAULT_SOFTNESS}.merge(
|
22
|
+
EditView.storage['softnesses'] || {})
|
23
|
+
@word_wraps =
|
24
|
+
{DEFAULT_SETTING_NAME => DEFAULT_WORD_WRAP}.merge(
|
25
|
+
EditView.storage['word_wraps'] || {})
|
26
|
+
@margin_columns =
|
27
|
+
{DEFAULT_SETTING_NAME => DEFAULT_MARGIN_COLUMN}.merge(
|
28
|
+
EditView.storage['margin_columns'] || {})
|
29
|
+
@show_margins =
|
30
|
+
{DEFAULT_SETTING_NAME => DEFAULT_MARGIN_PRESENT}.merge(
|
31
|
+
EditView.storage['show_margins'] || {})
|
32
|
+
@show_invisibles = !!EditView.storage['show_invisibles']
|
33
|
+
@show_line_numbers = !!EditView.storage['show_line_numbers']
|
34
|
+
@show_annotations = !!EditView.storage['show_annotations']
|
14
35
|
end
|
15
36
|
|
16
37
|
def width_for(grammar_name)
|
17
|
-
tab_widths[grammar_name] ||
|
38
|
+
tab_widths[grammar_name] || tab_widths[DEFAULT_SETTING_NAME]
|
18
39
|
end
|
19
40
|
|
20
41
|
def set_width_for(grammar_name, width)
|
@@ -26,7 +47,11 @@ module Redcar
|
|
26
47
|
end
|
27
48
|
|
28
49
|
def softness_for(grammar_name)
|
29
|
-
softnesses[grammar_name] == nil
|
50
|
+
if softnesses[grammar_name] == nil
|
51
|
+
softnesses[DEFAULT_SETTING_NAME]
|
52
|
+
else
|
53
|
+
softnesses[grammar_name]
|
54
|
+
end
|
30
55
|
end
|
31
56
|
|
32
57
|
def set_softness_for(grammar_name, boolean)
|
@@ -37,6 +62,49 @@ module Redcar
|
|
37
62
|
end
|
38
63
|
end
|
39
64
|
|
65
|
+
def word_wrap_for(grammar_name)
|
66
|
+
if word_wraps[grammar_name] == nil
|
67
|
+
word_wraps[DEFAULT_SETTING_NAME]
|
68
|
+
else
|
69
|
+
word_wraps[grammar_name]
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
def set_word_wrap_for(grammar_name, boolean)
|
74
|
+
boolean = !!boolean
|
75
|
+
if word_wraps[grammar_name] != boolean
|
76
|
+
word_wraps[grammar_name] = boolean
|
77
|
+
EditView.storage['word_wraps'] = word_wraps
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
def margin_column_for(grammar_name)
|
82
|
+
margin_columns[grammar_name] || margin_columns[DEFAULT_SETTING_NAME]
|
83
|
+
end
|
84
|
+
|
85
|
+
def set_margin_column_for(grammar_name, column)
|
86
|
+
if margin_columns[grammar_name] != column
|
87
|
+
margin_columns[grammar_name] = column
|
88
|
+
EditView.storage['margin_columns'] = margin_columns
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
def show_margin_for(grammar_name)
|
93
|
+
if show_margins[grammar_name] == nil
|
94
|
+
show_margins[DEFAULT_SETTING_NAME]
|
95
|
+
else
|
96
|
+
show_margins[grammar_name]
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
def set_show_margin_for(grammar_name, boolean)
|
101
|
+
boolean = !!boolean
|
102
|
+
if show_margins[grammar_name] != boolean
|
103
|
+
show_margins[grammar_name] = boolean
|
104
|
+
EditView.storage['show_margins'] = show_margins
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
40
108
|
def show_invisibles?
|
41
109
|
show_invisibles
|
42
110
|
end
|
@@ -45,6 +113,33 @@ module Redcar
|
|
45
113
|
@show_invisibles = bool
|
46
114
|
EditView.storage['show_invisibles'] = bool
|
47
115
|
end
|
116
|
+
|
117
|
+
def show_line_numbers?
|
118
|
+
show_line_numbers
|
119
|
+
end
|
120
|
+
|
121
|
+
def set_show_line_numbers(bool)
|
122
|
+
@show_line_numbers = bool
|
123
|
+
EditView.storage['show_line_numbers'] = bool
|
124
|
+
end
|
125
|
+
|
126
|
+
def show_annotations?
|
127
|
+
show_annotations
|
128
|
+
end
|
129
|
+
|
130
|
+
def set_show_annotations(bool)
|
131
|
+
@show_annotations = bool
|
132
|
+
EditView.storage['show_annotations'] = bool
|
133
|
+
end
|
134
|
+
|
135
|
+
def show_margin?
|
136
|
+
show_margin
|
137
|
+
end
|
138
|
+
|
139
|
+
def set_show_margin(bool)
|
140
|
+
@show_margin = bool
|
141
|
+
EditView.storage['show_margin'] = bool
|
142
|
+
end
|
48
143
|
end
|
49
144
|
end
|
50
145
|
end
|
@@ -20,8 +20,18 @@ module Redcar
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def self.load_textmate_assets
|
23
|
-
|
24
|
-
|
23
|
+
load_textmate_assets_from_dir(Redcar.root + "/textmate/")
|
24
|
+
Redcar.plugin_manager.loaded_plugins.each do |plugin|
|
25
|
+
load_textmate_assets_from_dir(File.dirname(plugin.definition_file) + "/")
|
26
|
+
end
|
27
|
+
load_textmate_assets_from_dir(Redcar.user_dir + "/")
|
28
|
+
|
29
|
+
EditView.themes.unshift(*JavaMateView::ThemeManager.themes.to_a.map {|th| th.name })
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.load_textmate_assets_from_dir(dir)
|
33
|
+
JavaMateView::Bundle.load_bundles(dir)
|
34
|
+
JavaMateView::ThemeManager.load_themes(dir)
|
25
35
|
end
|
26
36
|
|
27
37
|
attr_reader :mate_text, :widget, :model
|
@@ -108,12 +118,39 @@ module Redcar
|
|
108
118
|
h5 = @model.add_listener(:invisibles_changed) do |new_bool|
|
109
119
|
@mate_text.showInvisibles(new_bool)
|
110
120
|
end
|
121
|
+
h6 = @model.add_listener(:word_wrap_changed) do |new_bool|
|
122
|
+
@mate_text.set_word_wrap(new_bool)
|
123
|
+
end
|
124
|
+
h7 = @model.add_listener(:font_changed) do
|
125
|
+
@mate_text.set_font(EditView.font, EditView.font_size)
|
126
|
+
end
|
127
|
+
h8 = @model.add_listener(:theme_changed) do
|
128
|
+
@mate_text.set_theme_by_name(EditView.theme)
|
129
|
+
end
|
130
|
+
h9 = @model.add_listener(:line_number_visibility_changed) do |new_bool|
|
131
|
+
@mate_text.set_line_numbers_visible(new_bool)
|
132
|
+
end
|
133
|
+
h10 = @model.add_listener(:annotations_visibility_changed) do |new_bool|
|
134
|
+
@mate_text.set_annotations_visible(new_bool)
|
135
|
+
end
|
136
|
+
h11 = @model.add_listener(:margin_column_changed) do |new_column|
|
137
|
+
@mate_text.set_margin_column(new_column)
|
138
|
+
end
|
139
|
+
h12 = @model.add_listener(:show_margin_changed) do |new_bool|
|
140
|
+
if new_bool
|
141
|
+
@mate_text.set_margin_column(@model.margin_column)
|
142
|
+
else
|
143
|
+
@mate_text.set_margin_column(-1)
|
144
|
+
end
|
145
|
+
end
|
111
146
|
@mate_text.getTextWidget.addFocusListener(FocusListener.new(self))
|
112
147
|
@mate_text.getTextWidget.addVerifyListener(VerifyListener.new(@model.document, self))
|
113
148
|
@mate_text.getTextWidget.addModifyListener(ModifyListener.new(@model.document, self))
|
114
149
|
@mate_text.get_control.add_verify_key_listener(VerifyKeyListener.new(self))
|
115
150
|
@mate_text.get_control.add_key_listener(KeyListener.new(self))
|
116
|
-
@handlers << [@model.document, h1] << [@model, h2] << [@model, h3] << [@model, h4] <<
|
151
|
+
@handlers << [@model.document, h1] << [@model, h2] << [@model, h3] << [@model, h4] <<
|
152
|
+
[@model, h5] << [@model, h6] << [@model, h7] << [@model, h8] <<
|
153
|
+
[@model, h9] << [@model, h10] << [@model, h11]
|
117
154
|
end
|
118
155
|
|
119
156
|
class VerifyKeyListener
|
@@ -21,6 +21,8 @@ module Redcar
|
|
21
21
|
|
22
22
|
class Execute < EditTabCommand
|
23
23
|
|
24
|
+
TITLE = "Output"
|
25
|
+
|
24
26
|
def execute
|
25
27
|
path = doc.path
|
26
28
|
if path
|
@@ -32,14 +34,21 @@ module Redcar
|
|
32
34
|
FileUtils.rm(path)
|
33
35
|
end
|
34
36
|
end
|
37
|
+
|
38
|
+
def output_tab
|
39
|
+
tabs = win.notebooks.map {|nb| nb.tabs }.flatten
|
40
|
+
tabs.detect {|t| t.title == TITLE} || Top::NewCommand.new.run
|
41
|
+
end
|
35
42
|
|
36
43
|
def execute_file(path)
|
37
|
-
command = "ruby \"#{path}\"
|
38
|
-
output = `#{command}`
|
39
|
-
|
40
|
-
title = "
|
41
|
-
|
42
|
-
|
44
|
+
command = "ruby \"#{path}\""
|
45
|
+
output = `#{command} 2>&1`
|
46
|
+
tab = output_tab
|
47
|
+
title = "[#{DateTime.now}]$ #{command}"
|
48
|
+
tab.document.text = "#{tab.document.to_s}" +
|
49
|
+
"#{"="*title.length}\n#{title}\n#{"="*title.length}\n\n#{output}"
|
50
|
+
tab.title = TITLE
|
51
|
+
tab.focus
|
43
52
|
end
|
44
53
|
end
|
45
54
|
|
@@ -23,3 +23,13 @@ Feature: Open directory tree
|
|
23
23
|
Then the window should have title "myproject"
|
24
24
|
When I close the directory
|
25
25
|
Then the window should have title "Redcar"
|
26
|
+
|
27
|
+
Scenario: Directory keeps the same width if maximized
|
28
|
+
Given I will choose "plugins/project/spec/fixtures/myproject" from the "open_directory" dialog
|
29
|
+
When I open a directory
|
30
|
+
Then the directory tree width should be the default
|
31
|
+
When I maximize the window size
|
32
|
+
Then the directory tree width should be the default
|
33
|
+
When I restore the window size
|
34
|
+
Then the directory tree width should be the default
|
35
|
+
|
@@ -21,17 +21,19 @@ module Redcar
|
|
21
21
|
attr_reader :window, :tree, :path
|
22
22
|
|
23
23
|
def initialize(path)
|
24
|
-
path
|
25
|
-
|
26
|
-
|
24
|
+
@path = File.expand_path(path)
|
25
|
+
dir_mirror = Project::DirMirror.new(path)
|
26
|
+
if dir_mirror.exists?
|
27
|
+
@tree = Tree.new(dir_mirror, Project::DirController.new)
|
28
|
+
@window = nil
|
29
|
+
file_list_resource.compute
|
27
30
|
end
|
28
|
-
@path = path
|
29
|
-
@tree = Tree.new(Project::DirMirror.new(path),
|
30
|
-
Project::DirController.new)
|
31
|
-
@window = nil
|
32
|
-
file_list_resource.compute
|
33
31
|
end
|
34
32
|
|
33
|
+
def ready?
|
34
|
+
@tree && @path
|
35
|
+
end
|
36
|
+
|
35
37
|
def inspect
|
36
38
|
"<Project #{path}>"
|
37
39
|
end
|
@@ -13,7 +13,7 @@ module Redcar
|
|
13
13
|
|
14
14
|
# Does the directory exist?
|
15
15
|
def exists?
|
16
|
-
File.exist?(@path)
|
16
|
+
File.exist?(@path) && File.directory?(@path)
|
17
17
|
end
|
18
18
|
|
19
19
|
# Have the toplevel nodes changed?
|
@@ -32,6 +32,11 @@ module Redcar
|
|
32
32
|
end
|
33
33
|
|
34
34
|
class Node
|
35
|
+
|
36
|
+
include Redcar::Tree::Mirror::NodeMirror
|
37
|
+
|
38
|
+
attr_reader :path
|
39
|
+
|
35
40
|
def self.create_all_from_path(path)
|
36
41
|
Dir[path + "/*"].sort_by do |fn|
|
37
42
|
File.basename(fn).downcase
|
@@ -48,10 +53,6 @@ module Redcar
|
|
48
53
|
@cache ||= {}
|
49
54
|
end
|
50
55
|
|
51
|
-
include Redcar::Tree::Mirror::NodeMirror
|
52
|
-
|
53
|
-
attr_reader :path
|
54
|
-
|
55
56
|
def initialize(path)
|
56
57
|
@path = path
|
57
58
|
end
|
@@ -10,6 +10,22 @@ module Redcar
|
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
|
+
def open_item_untitled(path)
|
14
|
+
begin
|
15
|
+
puts 'drb opening untitled ' + full_path if $VERBOSE
|
16
|
+
if File.file?(path)
|
17
|
+
Redcar::ApplicationSWT.sync_exec do
|
18
|
+
Project::Manager.open_untitled_path(path)
|
19
|
+
Redcar.app.focussed_window.controller.bring_to_front
|
20
|
+
end
|
21
|
+
end
|
22
|
+
'ok'
|
23
|
+
rescue Exception => e
|
24
|
+
puts 'drb got exception:' + e.class + " " + e.message, e.backtrace
|
25
|
+
raise e
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
13
29
|
def open_item_drb(full_path)
|
14
30
|
begin
|
15
31
|
puts 'drb opening ' + full_path if $VERBOSE
|
@@ -111,15 +111,23 @@ module Redcar
|
|
111
111
|
window.focus
|
112
112
|
end
|
113
113
|
|
114
|
+
def self.open_tab_with_content(text)
|
115
|
+
win = Redcar.app.focussed_window || Redcar.app.new_window
|
116
|
+
tab = win.new_tab(Redcar::EditTab)
|
117
|
+
tab.edit_view.document.text = text
|
118
|
+
tab.edit_view.reset_undo
|
119
|
+
tab.focus
|
120
|
+
end
|
121
|
+
|
114
122
|
# Opens a new Tree with a DirMirror and DirController for the given
|
115
123
|
# path, in a new window.
|
116
124
|
#
|
117
125
|
# @param [String] path the path of the directory to view
|
118
126
|
def self.open_project_for_path(path)
|
119
127
|
win = Redcar.app.new_window
|
120
|
-
project = Project.new(path)
|
121
|
-
|
122
|
-
|
128
|
+
project = Project.new(path).tap do |p|
|
129
|
+
p.open(win) if p.ready?
|
130
|
+
end
|
123
131
|
end
|
124
132
|
|
125
133
|
# The currently focussed Project, or nil if none.
|
@@ -154,9 +162,28 @@ module Redcar
|
|
154
162
|
open_file(arg)
|
155
163
|
end
|
156
164
|
end
|
165
|
+
args.each do |arg|
|
166
|
+
if arg =~ /--untitled-file=(.*)/
|
167
|
+
path = $1
|
168
|
+
found_path_args = true
|
169
|
+
open_untitled_path(path)
|
170
|
+
end
|
171
|
+
end
|
157
172
|
found_path_args
|
158
173
|
end
|
159
174
|
|
175
|
+
def self.open_untitled_path(path)
|
176
|
+
begin
|
177
|
+
if File.file?(path) and contents = File.read(path)
|
178
|
+
open_tab_with_content(contents)
|
179
|
+
end
|
180
|
+
rescue => e
|
181
|
+
puts "Error opening untitled file #{path}"
|
182
|
+
puts e.class.to_s + ":" + e.message
|
183
|
+
puts e.backtrace
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
160
187
|
# Attaches a new listener to tab focus change events, so we can
|
161
188
|
# keep the current_files list.
|
162
189
|
def self.init_current_files_hooks
|
@@ -185,7 +212,6 @@ module Redcar
|
|
185
212
|
if path = storage['last_open_dir']
|
186
213
|
s = Time.now
|
187
214
|
open_project_for_path(path)
|
188
|
-
puts "open project took #{Time.now - s}s"
|
189
215
|
end
|
190
216
|
|
191
217
|
if files = storage['files_open_last_session']
|
@@ -207,4 +233,4 @@ module Redcar
|
|
207
233
|
end
|
208
234
|
end
|
209
235
|
end
|
210
|
-
end
|
236
|
+
end
|