redcar 0.10 → 0.11.0dev
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +14 -0
- data/Rakefile +68 -29
- data/lib/redcar.rb +2 -2
- data/plugins/application/lib/application/dialogs/filter_list_dialog.rb +2 -1
- data/plugins/application_swt/spec/application_swt/gradient_spec.rb +3 -12
- data/plugins/core/lib/core/resource.rb +13 -5
- data/plugins/document_search/features/find.feature +366 -214
- data/plugins/document_search/features/incremental_search.feature +351 -0
- data/plugins/document_search/features/replace.feature +16 -16
- data/plugins/document_search/features/step_definitions/find_steps.rb +16 -0
- data/plugins/document_search/features/support/env.rb +11 -0
- data/plugins/document_search/lib/document_search.rb +149 -109
- data/plugins/document_search/lib/document_search/commands.rb +251 -202
- data/plugins/document_search/lib/document_search/find_speedbar.rb +138 -81
- data/plugins/document_search/lib/document_search/incremental_search_speedbar.rb +70 -0
- data/plugins/document_search/lib/document_search/query_options.rb +15 -39
- data/plugins/document_search/plugin.rb +1 -1
- data/plugins/edit_view/features/step_definitions/editing_steps.rb +6 -2
- data/plugins/edit_view_swt/lib/edit_view_swt.rb +2 -2
- data/plugins/file_parser/lib/file_parser.rb +6 -1
- data/plugins/html_view/features/step_definitions/web_view_steps.rb +12 -0
- data/plugins/html_view/features/support/env.rb +16 -0
- data/plugins/html_view/lib/html_view.rb +5 -1
- data/plugins/line_tools/lib/line_tools.rb +16 -0
- data/plugins/project/features/find_file.feature +28 -0
- data/plugins/project/features/open_and_save_files.feature +11 -0
- data/plugins/project/features/step_definitions/file_steps.rb +6 -1
- data/plugins/project/features/support/env.rb +2 -0
- data/plugins/project/lib/project.rb +49 -6
- data/plugins/project/lib/project/commands.rb +18 -6
- data/plugins/project/lib/project/find_file_dialog.rb +19 -8
- data/plugins/project/lib/project/find_recent_dialog.rb +30 -0
- data/plugins/project/lib/project/manager.rb +41 -10
- data/plugins/project/lib/project/recent.rb +64 -0
- data/plugins/project/spec/fixtures/myproject/vendor/bar.rb +0 -0
- data/plugins/project/spec/fixtures/myproject/vendor/plugins/bar.rb +0 -0
- data/plugins/{find-in-project → project_search}/TODO.md +3 -3
- data/plugins/project_search/features/support/env.rb +6 -0
- data/plugins/project_search/features/word_search.feature +34 -0
- data/plugins/project_search/lib/project_search.rb +73 -0
- data/plugins/project_search/lib/project_search/binary_data_detector.rb +46 -0
- data/plugins/project_search/lib/project_search/commands.rb +62 -0
- data/plugins/project_search/lib/project_search/hit.rb +17 -0
- data/plugins/{find-in-project/lib/find_in_project → project_search/lib/project_search}/images/collapsed.png +0 -0
- data/plugins/{find-in-project/lib/find_in_project → project_search/lib/project_search}/images/expanded.png +0 -0
- data/plugins/{find-in-project/lib/find_in_project → project_search/lib/project_search}/images/spinner.gif +0 -0
- data/plugins/project_search/lib/project_search/lucene_index.rb +64 -0
- data/plugins/project_search/lib/project_search/lucene_refresh.rb +22 -0
- data/plugins/project_search/lib/project_search/project.rb +14 -0
- data/plugins/project_search/lib/project_search/query.rb +29 -0
- data/plugins/{find-in-project/lib/find_in_project → project_search/lib/project_search}/stylesheets/style.css +14 -3
- data/plugins/project_search/lib/project_search/views/_file.html.erb +60 -0
- data/plugins/{find-in-project/lib/find_in_project → project_search/lib/project_search}/views/index.html.erb +12 -9
- data/plugins/project_search/lib/project_search/word_search.rb +105 -0
- data/plugins/project_search/lib/project_search/word_search_controller.rb +207 -0
- data/plugins/project_search/plugin.rb +8 -0
- data/plugins/project_search/spec/fixtures/project/binary_file.bin +0 -0
- data/plugins/project_search/spec/fixtures/project/foo.txt +43 -0
- data/plugins/project_search/spec/fixtures/project/qux.rb +3 -0
- data/plugins/project_search/spec/project_search/binary_data_detector_spec.rb +24 -0
- data/plugins/project_search/spec/project_search/word_search_spec.rb +157 -0
- data/plugins/project_search/spec/spec_helper.rb +27 -0
- data/plugins/redcar/redcar.rb +77 -71
- data/plugins/ruby/lib/ruby/syntax_checker.rb +1 -1
- data/plugins/snippets/features/snippets.feature +12 -0
- data/plugins/snippets/lib/snippets/tab_handler.rb +1 -1
- metadata +46 -25
- data/plugins/document_search/features/find_and_replace.feature +0 -723
- data/plugins/document_search/lib/document_search/find_and_replace_speedbar.rb +0 -142
- data/plugins/find-in-project/lib/find_in_project.rb +0 -35
- data/plugins/find-in-project/lib/find_in_project/commands.rb +0 -30
- data/plugins/find-in-project/lib/find_in_project/controllers.rb +0 -170
- data/plugins/find-in-project/lib/find_in_project/views/_divider.html.erb +0 -4
- data/plugins/find-in-project/lib/find_in_project/views/_file_heading.html.erb +0 -10
- data/plugins/find-in-project/lib/find_in_project/views/_file_line.html.erb +0 -6
- data/plugins/find-in-project/plugin.rb +0 -11
- data/plugins/project/lib/project/recent_directories.rb +0 -54
@@ -24,3 +24,19 @@ end
|
|
24
24
|
After do
|
25
25
|
reset_htmlview_fixtures
|
26
26
|
end
|
27
|
+
|
28
|
+
$:.push("plugins/html_view/vendor/nokogiri/lib")
|
29
|
+
require 'nokogiri'
|
30
|
+
|
31
|
+
p Nokogiri::HTML("<h1>afso</h1>")
|
32
|
+
|
33
|
+
$:.push("plugins/html_view/vendor/capybara/lib")
|
34
|
+
require 'capybara'
|
35
|
+
require 'capybara/dsl'
|
36
|
+
|
37
|
+
$:.push("plugins/html_view/vendor/capybara-sweet/lib")
|
38
|
+
require 'capybara/driver/sweet'
|
39
|
+
|
40
|
+
Capybara.default_driver = :sweet
|
41
|
+
|
42
|
+
World(Capybara)
|
@@ -78,9 +78,13 @@ module Redcar
|
|
78
78
|
@html_tab.title = controller.title
|
79
79
|
func = RubyFunc.new(@html_tab.controller.browser, "rubyCall")
|
80
80
|
func.controller = @controller
|
81
|
-
|
81
|
+
refresh
|
82
82
|
attach_controller_listeners
|
83
83
|
end
|
84
|
+
|
85
|
+
def refresh
|
86
|
+
controller_action("index")
|
87
|
+
end
|
84
88
|
|
85
89
|
def attach_controller_listeners
|
86
90
|
@controller.add_listener(:reload_index) { controller_action("index") }
|
@@ -127,6 +127,14 @@ module Redcar
|
|
127
127
|
if doc.selection?
|
128
128
|
first_line_ix = doc.line_at_offset(doc.selection_range.begin)
|
129
129
|
last_line_ix = doc.line_at_offset(doc.selection_range.end)
|
130
|
+
|
131
|
+
if doc.selection_range.begin == doc.offset_at_inner_end_of_line(first_line_ix)
|
132
|
+
first_line_ix += 1
|
133
|
+
end
|
134
|
+
if doc.selection_range.end == doc.offset_at_line(last_line_ix)
|
135
|
+
last_line_ix -= 1
|
136
|
+
end
|
137
|
+
|
130
138
|
text = doc.get_slice(doc.offset_at_line(first_line_ix),
|
131
139
|
doc.offset_at_line_end(last_line_ix))
|
132
140
|
keep_selection = true
|
@@ -171,6 +179,14 @@ module Redcar
|
|
171
179
|
if doc.selection?
|
172
180
|
first_line_ix = doc.line_at_offset(doc.selection_range.begin)
|
173
181
|
last_line_ix = doc.line_at_offset(doc.selection_range.end)
|
182
|
+
|
183
|
+
if doc.selection_range.begin == doc.offset_at_inner_end_of_line(first_line_ix)
|
184
|
+
first_line_ix += 1
|
185
|
+
end
|
186
|
+
if doc.selection_range.end == doc.offset_at_line(last_line_ix)
|
187
|
+
last_line_ix -= 1
|
188
|
+
end
|
189
|
+
|
174
190
|
text = doc.get_slice(doc.offset_at_line(first_line_ix),
|
175
191
|
doc.offset_at_line_end(last_line_ix))
|
176
192
|
keep_selection = true
|
@@ -15,6 +15,12 @@ Feature: Find file
|
|
15
15
|
And I wait "0.4" seconds
|
16
16
|
Then the filter dialog should have 0 entries
|
17
17
|
|
18
|
+
Scenario: No matching files when typing a directory name only
|
19
|
+
When I open the find file dialog
|
20
|
+
And I set the filter to "vendor"
|
21
|
+
And I wait "0.4" seconds
|
22
|
+
Then the filter dialog should have 0 entries
|
23
|
+
|
18
24
|
Scenario: One matching file
|
19
25
|
When I open the find file dialog
|
20
26
|
And I set the filter to "foo_spec"
|
@@ -29,6 +35,13 @@ Feature: Find file
|
|
29
35
|
Then the filter dialog should have 1 entry
|
30
36
|
And I should see "foo_spec.rb (myproject/spec)" at 0 the filter dialog
|
31
37
|
|
38
|
+
Scenario: One matching file when specifying a directory
|
39
|
+
When I open the find file dialog
|
40
|
+
And I set the filter to "lib_sym/foo"
|
41
|
+
And I wait "0.4" seconds
|
42
|
+
Then the filter dialog should have 1 entry
|
43
|
+
And I should see "foo_lib.rb (myproject/lib_symlink)" at 0 the filter dialog
|
44
|
+
|
32
45
|
Scenario: Two matching files
|
33
46
|
When I open the find file dialog
|
34
47
|
And I set the filter to "foo"
|
@@ -47,6 +60,21 @@ Feature: Find file
|
|
47
60
|
And I should see "foo_lib.rb (myproject/lib_symlink)" at 1 the filter dialog
|
48
61
|
And I should see "foo_spec.rb (myproject/spec)" at 2 the filter dialog
|
49
62
|
|
63
|
+
Scenario: Three matching files in similar directories
|
64
|
+
When I open the find file dialog
|
65
|
+
And I set the filter to "ven/bar"
|
66
|
+
And I wait "0.4" seconds
|
67
|
+
Then the filter dialog should have 2 entries
|
68
|
+
And I should see "bar.rb (myproject/vendor)" at 0 the filter dialog
|
69
|
+
And I should see "bar.rb (vendor/plugins)" at 1 the filter dialog
|
70
|
+
|
71
|
+
Scenario: Two matching files in similar nested directories
|
72
|
+
When I open the find file dialog
|
73
|
+
And I set the filter to "v/p/bar"
|
74
|
+
And I wait "0.4" seconds
|
75
|
+
Then the filter dialog should have 1 entry
|
76
|
+
And I should see "bar.rb (vendor/plugins)" at 0 the filter dialog
|
77
|
+
|
50
78
|
Scenario: One matching file with arbitrary letters
|
51
79
|
When I open the find file dialog
|
52
80
|
And I set the filter to "fsc"
|
@@ -71,3 +71,14 @@ Feature: Open and save files
|
|
71
71
|
When I open a file
|
72
72
|
Then the window "fixtures" should have 1 tab
|
73
73
|
|
74
|
+
Scenario: Choosing to open a large file
|
75
|
+
Given I will open a large file from the "open_file" dialog
|
76
|
+
And I will choose "yes" from the "message_box" dialog
|
77
|
+
When I open a file
|
78
|
+
Then there should be 1 edit tab
|
79
|
+
|
80
|
+
Scenario: Choosing not to open a large file
|
81
|
+
Given I will open a large file from the "open_file" dialog
|
82
|
+
And I will choose "no" from the "message_box" dialog
|
83
|
+
When I open a file
|
84
|
+
Then there should be 0 edit tabs
|
@@ -3,6 +3,11 @@ Given /^I have open a file$/ do
|
|
3
3
|
Redcar::Project::FileOpenCommand.new.run
|
4
4
|
end
|
5
5
|
|
6
|
+
Given /^I will open a large file from the "([^"]*)" dialog$/ do |arg1|
|
7
|
+
Given %Q|I will choose "plugins/project/spec/fixtures/winter.txt" from the "open_file" dialog|
|
8
|
+
Redcar::Project::Manager.file_size_limit = 1
|
9
|
+
end
|
10
|
+
|
6
11
|
When /^I open a file$/ do
|
7
12
|
Redcar::Project::FileOpenCommand.new.run
|
8
13
|
end
|
@@ -48,4 +53,4 @@ end
|
|
48
53
|
|
49
54
|
After do
|
50
55
|
remove_test_files
|
51
|
-
end
|
56
|
+
end
|
@@ -51,6 +51,7 @@ end
|
|
51
51
|
|
52
52
|
Before do
|
53
53
|
reset_project_fixtures
|
54
|
+
@original_file_size_limit = Redcar::Project::Manager.file_size_limit
|
54
55
|
end
|
55
56
|
|
56
57
|
After do
|
@@ -58,4 +59,5 @@ After do
|
|
58
59
|
reset_project_fixtures
|
59
60
|
delete_subproject_fixtures
|
60
61
|
DrbShelloutHelper.kill_thread
|
62
|
+
Redcar::Project::Manager.file_size_limit = @original_file_size_limit
|
61
63
|
end
|
@@ -27,8 +27,9 @@ require "project/drb_service"
|
|
27
27
|
require "project/file_list"
|
28
28
|
require "project/file_mirror"
|
29
29
|
require "project/find_file_dialog"
|
30
|
+
require "project/find_recent_dialog"
|
30
31
|
require "project/manager"
|
31
|
-
require "project/
|
32
|
+
require "project/recent"
|
32
33
|
require "project/sub_project"
|
33
34
|
|
34
35
|
module Redcar
|
@@ -69,6 +70,7 @@ module Redcar
|
|
69
70
|
end
|
70
71
|
|
71
72
|
def open(win)
|
73
|
+
lock
|
72
74
|
@window = win
|
73
75
|
if current_project = Project.window_projects[window]
|
74
76
|
current_project.close
|
@@ -80,20 +82,56 @@ module Redcar
|
|
80
82
|
Redcar.plugin_manager.objects_implementing(:project_loaded).each do |i|
|
81
83
|
i.project_loaded(self)
|
82
84
|
end
|
83
|
-
|
85
|
+
Recent.store_path(path)
|
84
86
|
Manager.storage['last_open_dir'] = path
|
85
87
|
Project.window_projects[window] = self
|
86
88
|
end
|
89
|
+
|
90
|
+
def lock
|
91
|
+
File.open(lock_filename, "w") do |fout|
|
92
|
+
fout.puts "#{$$}: Locked by #{$$} at #{Time.now}"
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
def lock_filename
|
97
|
+
File.join(config_dir, "redcar.lock")
|
98
|
+
end
|
99
|
+
|
100
|
+
def locked?
|
101
|
+
File.exist?(lock_filename)
|
102
|
+
end
|
103
|
+
|
104
|
+
def unlock
|
105
|
+
if locked?
|
106
|
+
if locked_by_this_process?
|
107
|
+
FileUtils.rm_rf(lock_filename)
|
108
|
+
else
|
109
|
+
raise "locked by another process"
|
110
|
+
end
|
111
|
+
else
|
112
|
+
raise "project not locked"
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
def locked_by_this_process?
|
117
|
+
return false unless locked?
|
118
|
+
locking_pid = File.read(lock_filename).split(":").first
|
119
|
+
locking_pid == $$.to_s
|
120
|
+
end
|
87
121
|
|
88
122
|
def close
|
89
|
-
window
|
90
|
-
|
91
|
-
window
|
123
|
+
return unless @window
|
124
|
+
this_window = window
|
125
|
+
@window = nil
|
126
|
+
this_window.treebook.remove_tree(@tree)
|
127
|
+
Project.window_projects.delete(this_window)
|
128
|
+
this_window.title = Window::DEFAULT_TITLE
|
92
129
|
Manager.open_project_sensitivity.recompute
|
93
130
|
Redcar.plugin_manager.objects_implementing(:project_closed).each do |i|
|
94
131
|
i.project_closed(self)
|
95
132
|
end
|
96
133
|
listeners = {}
|
134
|
+
unlock
|
97
135
|
end
|
98
136
|
|
99
137
|
def attach_listeners
|
@@ -183,7 +221,12 @@ module Redcar
|
|
183
221
|
|
184
222
|
def send_refresh_to_plugins
|
185
223
|
Redcar.plugin_manager.objects_implementing(:project_refresh_task_type).each do |object|
|
186
|
-
|
224
|
+
task = object.project_refresh_task_type.new(self)
|
225
|
+
if Redcar::Resource.compute_synchronously
|
226
|
+
task.execute
|
227
|
+
else
|
228
|
+
Redcar::Resource.task_queue.submit(task)
|
229
|
+
end
|
187
230
|
end
|
188
231
|
end
|
189
232
|
|
@@ -224,6 +224,12 @@ module Redcar
|
|
224
224
|
end
|
225
225
|
end
|
226
226
|
|
227
|
+
class FindRecentCommand < Command
|
228
|
+
def execute
|
229
|
+
FindRecentDialog.new.open
|
230
|
+
end
|
231
|
+
end
|
232
|
+
|
227
233
|
class RevealInProjectCommand < ProjectCommand
|
228
234
|
def execute
|
229
235
|
if Project::Manager.reveal_file?(project)
|
@@ -296,10 +302,13 @@ module Redcar
|
|
296
302
|
end
|
297
303
|
|
298
304
|
class OpenDirectoryInExplorerCommand < OpenCommand
|
299
|
-
LinuxApps = {
|
300
|
-
'
|
305
|
+
LinuxApps = {
|
306
|
+
'Thunar' => '%s',
|
307
|
+
'nautilus' => '%s',
|
301
308
|
'konqueror' => '%s',
|
302
|
-
'
|
309
|
+
'pcmanfm' => '%s',
|
310
|
+
'kfm' => '%s'
|
311
|
+
}
|
303
312
|
|
304
313
|
def explorer_osx
|
305
314
|
['open -a Finder', path]
|
@@ -332,9 +341,12 @@ module Redcar
|
|
332
341
|
end
|
333
342
|
|
334
343
|
class OpenDirectoryInCommandLineCommand < OpenCommand
|
335
|
-
LinuxApps = {
|
344
|
+
LinuxApps = {
|
345
|
+
'xfce4-terminal' => "--working-directory=%s",
|
336
346
|
'gnome-terminal' => "--working-directory=%s",
|
337
|
-
'
|
347
|
+
'lxterminal' => "--working-directory=%s",
|
348
|
+
'konsole' => "--workdir %s"
|
349
|
+
}
|
338
350
|
|
339
351
|
def osx_terminal_script(preferred)
|
340
352
|
if preferred.start_with? "iTerm"
|
@@ -389,4 +401,4 @@ module Redcar
|
|
389
401
|
end
|
390
402
|
end
|
391
403
|
end
|
392
|
-
end
|
404
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'set'
|
2
2
|
|
3
3
|
module Redcar
|
4
|
-
class Project
|
4
|
+
class Project
|
5
5
|
|
6
6
|
class FindFileDialog < FilterListDialog
|
7
7
|
def self.storage
|
@@ -101,17 +101,28 @@ module Redcar
|
|
101
101
|
end
|
102
102
|
|
103
103
|
def find_files_from_list(text, file_list)
|
104
|
-
re = make_regex(text
|
105
|
-
file_list.select
|
106
|
-
fn
|
107
|
-
|
104
|
+
re = make_regex(text)
|
105
|
+
file_list.select do |fn|
|
106
|
+
not ignore_file?(fn) and match_substring(fn) =~ re
|
107
|
+
end
|
108
108
|
end
|
109
109
|
|
110
110
|
def find_files(text, directories)
|
111
111
|
files = project.all_files.sort.select {|fn| not ignore_file?(fn)}
|
112
|
-
filter_and_rank_by(files, text
|
113
|
-
|
114
|
-
|
112
|
+
filter_and_rank_by(files, text) {|fn| match_substring(fn) }
|
113
|
+
end
|
114
|
+
|
115
|
+
def match_substring(filename)
|
116
|
+
@folder_search ? filename.sub(project.path, "") : filename.split("/").last
|
117
|
+
end
|
118
|
+
|
119
|
+
def make_regex(text)
|
120
|
+
path = text.gsub(/\s/, "").split("/")
|
121
|
+
@folder_search = path.size > 1
|
122
|
+
folders = path[0...-1].map {|f| "(#{Regexp.escape(f)}).*/" }
|
123
|
+
file = path.last.each_char.map {|c| "(#{Regexp.escape(c)})[^/]*?" }.join
|
124
|
+
re_src = "#{folders.join}#{file}$"
|
125
|
+
Regexp.new(re_src, :options => Regexp::IGNORECASE)
|
115
126
|
end
|
116
127
|
end
|
117
128
|
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Redcar
|
2
|
+
class Project
|
3
|
+
|
4
|
+
class FindRecentDialog < FilterListDialog
|
5
|
+
def update_list(filter)
|
6
|
+
recent = Project::Recent.storage['list']
|
7
|
+
recent = recent.map {|path| path.gsub(/^#{Regexp.escape(Redcar.home_dir)}\/?/, "")}
|
8
|
+
filter_and_rank_by(recent, filter)
|
9
|
+
end
|
10
|
+
|
11
|
+
def selected(path, ix)
|
12
|
+
unless path[0..0] == "/"
|
13
|
+
path = Redcar.home_dir + "/" + path
|
14
|
+
end
|
15
|
+
if File.exist?(File.expand_path(path))
|
16
|
+
if File.directory?(path)
|
17
|
+
Project::Manager.open_project_for_path(path)
|
18
|
+
close
|
19
|
+
elsif File.file?(File.expand_path(path))
|
20
|
+
Project::Manager.open_file(path)
|
21
|
+
close
|
22
|
+
else
|
23
|
+
Project::Recent.remove_path(path)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
@@ -163,6 +163,7 @@ module Redcar
|
|
163
163
|
# @path [String] path the path of the file to be edited
|
164
164
|
# @param [Window] win the Window to open the File in
|
165
165
|
def self.open_file_in_window(path, win, adapter)
|
166
|
+
return unless large_file_airbag(path)
|
166
167
|
tab = win.new_tab(Redcar::EditTab)
|
167
168
|
mirror = FileMirror.new(path, adapter)
|
168
169
|
tab.edit_view.document.mirror = mirror
|
@@ -170,6 +171,22 @@ module Redcar
|
|
170
171
|
tab.focus
|
171
172
|
end
|
172
173
|
|
174
|
+
def self.file_too_large?(path)
|
175
|
+
File.size(path) > file_size_limit
|
176
|
+
end
|
177
|
+
|
178
|
+
# Prompts the user before opening the given path if it's above self.file_size_limit.
|
179
|
+
def self.large_file_airbag(path)
|
180
|
+
if file_too_large?(path)
|
181
|
+
Application::Dialog.message_box(
|
182
|
+
"This file is larger than 10MB which may crash Redcar.\n\nAre you sure you want to open it?",
|
183
|
+
:type => :warning,
|
184
|
+
:buttons => :yes_no) == :yes
|
185
|
+
else
|
186
|
+
true
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
173
190
|
def self.find_projects_containing_path(path)
|
174
191
|
open_projects.select {|p|
|
175
192
|
p.contains_path?(path)
|
@@ -185,6 +202,7 @@ module Redcar
|
|
185
202
|
window = project.window
|
186
203
|
else
|
187
204
|
window = windows_without_projects.first || Redcar.app.new_window
|
205
|
+
Project::Recent.store_path(path)
|
188
206
|
end
|
189
207
|
open_file_in_window(path, window, adapter)
|
190
208
|
window.focus
|
@@ -225,15 +243,28 @@ module Redcar
|
|
225
243
|
tab.focus
|
226
244
|
end
|
227
245
|
|
246
|
+
PROJECT_LOCKED_MESSAGE = "Project appears to be locked by another Redcar process!\nOpen anway?"
|
247
|
+
|
228
248
|
# Opens a new Tree with a DirMirror and DirController for the given
|
229
249
|
# path, in a new window.
|
230
250
|
#
|
231
251
|
# @param [String] path the path of the directory to view
|
232
252
|
def self.open_project_for_path(path)
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
253
|
+
open_projects.each do |project|
|
254
|
+
if project.path == path
|
255
|
+
project.window.focus
|
256
|
+
return
|
257
|
+
end
|
258
|
+
end
|
259
|
+
project = Project.new(path)
|
260
|
+
should_open = true
|
261
|
+
if project.locked?
|
262
|
+
should_open = Application::Dialog.message_box(PROJECT_LOCKED_MESSAGE, :type => :warning, :buttons => :yes_no)
|
263
|
+
end
|
264
|
+
if should_open
|
265
|
+
win = Redcar.app.focussed_window
|
266
|
+
win = Redcar.app.new_window if !win or Manager.in_window(win)
|
267
|
+
project.open(win) if project.ready?
|
237
268
|
end
|
238
269
|
end
|
239
270
|
|
@@ -367,20 +398,18 @@ module Redcar
|
|
367
398
|
item "Open", Project::FileOpenCommand
|
368
399
|
item "Reload File", Project::FileReloadCommand
|
369
400
|
item "Open Directory", Project::DirectoryOpenCommand
|
370
|
-
|
371
|
-
|
372
|
-
Project::RecentDirectories.generate_menu(self)
|
373
|
-
end
|
374
|
-
|
401
|
+
item "Open Recent...", Project::FindRecentCommand
|
402
|
+
|
375
403
|
separator
|
376
404
|
item "Save", Project::FileSaveCommand
|
377
405
|
item "Save As", Project::FileSaveAsCommand
|
378
406
|
end
|
379
407
|
end
|
408
|
+
|
380
409
|
sub_menu "Project", :priority => 15 do
|
381
410
|
group(:priority => :first) do
|
382
411
|
item "Find File", Project::FindFileCommand
|
383
|
-
item "Refresh Directory", Project::RefreshDirectoryCommand
|
412
|
+
# item "Refresh Directory", Project::RefreshDirectoryCommand
|
384
413
|
end
|
385
414
|
item "Reveal Open File in Tree", :command => Project::ToggleRevealInProject, :type => :check, :active => Project::Manager.reveal_files?
|
386
415
|
end
|
@@ -449,8 +478,10 @@ module Redcar
|
|
449
478
|
end
|
450
479
|
|
451
480
|
class << self
|
481
|
+
attr_accessor :file_size_limit
|
452
482
|
attr_reader :open_project_sensitivity
|
453
483
|
end
|
484
|
+
self.file_size_limit = 5242880
|
454
485
|
end
|
455
486
|
end
|
456
487
|
end
|