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
@@ -40,10 +40,8 @@ module Redcar
|
|
40
40
|
|
41
41
|
def execute
|
42
42
|
if tab.edit_view.document.modified?
|
43
|
-
result = Application::Dialog.message_box(
|
44
|
-
|
45
|
-
:buttons => :yes_no_cancel
|
46
|
-
)
|
43
|
+
result = Application::Dialog.message_box("This tab has unsaved changes. \n\nReload?",
|
44
|
+
:buttons => :yes_no_cancel)
|
47
45
|
case result
|
48
46
|
when :yes
|
49
47
|
tab.edit_view.document.update_from_mirror
|
@@ -82,13 +80,8 @@ module Redcar
|
|
82
80
|
button :connect, "Connect", "Return" do
|
83
81
|
selected = self.class.connections.find { |c| c.name == connection.value }
|
84
82
|
|
85
|
-
Manager.connect_to_remote(
|
86
|
-
selected[:
|
87
|
-
selected[:host],
|
88
|
-
selected[:user],
|
89
|
-
selected[:path],
|
90
|
-
ConnectionManager::PrivateKeyStore.paths
|
91
|
-
)
|
83
|
+
Manager.connect_to_remote(selected[:protocol], selected[:host],
|
84
|
+
selected[:user], selected[:path], ConnectionManager::PrivateKeyStore.paths)
|
92
85
|
end
|
93
86
|
|
94
87
|
button :quick, "Quick Connection", "Ctrl+Q" do
|
@@ -123,13 +116,8 @@ module Redcar
|
|
123
116
|
textbox :path
|
124
117
|
|
125
118
|
button :connect, "Connect", "Return" do
|
126
|
-
Manager.connect_to_remote(
|
127
|
-
|
128
|
-
host.value,
|
129
|
-
user.value,
|
130
|
-
path.value,
|
131
|
-
ConnectionManager::PrivateKeyStore.paths
|
132
|
-
)
|
119
|
+
Manager.connect_to_remote(protocol.value, host.value, user.value,
|
120
|
+
path.value, ConnectionManager::PrivateKeyStore.paths)
|
133
121
|
end
|
134
122
|
end
|
135
123
|
|
@@ -217,13 +205,6 @@ module Redcar
|
|
217
205
|
end
|
218
206
|
end
|
219
207
|
|
220
|
-
class DirectoryCloseCommand < ProjectCommand
|
221
|
-
|
222
|
-
def execute
|
223
|
-
project.close
|
224
|
-
end
|
225
|
-
end
|
226
|
-
|
227
208
|
class RefreshDirectoryCommand < ProjectCommand
|
228
209
|
|
229
210
|
def execute
|
@@ -247,13 +228,17 @@ module Redcar
|
|
247
228
|
def execute
|
248
229
|
if project and project.window.trees_visible?
|
249
230
|
tab = Redcar.app.focussed_window.focussed_notebook_tab
|
250
|
-
|
231
|
+
if tab.is_a?(EditTab)
|
232
|
+
return unless mirror = tab.edit_view.document.mirror and mirror.respond_to? :path
|
233
|
+
else
|
234
|
+
return
|
235
|
+
end
|
251
236
|
|
252
|
-
path =
|
237
|
+
path = mirror.path
|
253
238
|
tree = project.tree
|
254
239
|
current = tree.tree_mirror.top
|
255
240
|
while current.any?
|
256
|
-
ancestor_node = current.detect {|node| path =~ /^#{node.path}($|\/)/}
|
241
|
+
ancestor_node = current.detect {|node| path =~ /^#{node.path}($|\/)/ }
|
257
242
|
return unless ancestor_node
|
258
243
|
tree.expand(ancestor_node)
|
259
244
|
current = ancestor_node.children
|
@@ -264,6 +249,9 @@ module Redcar
|
|
264
249
|
end
|
265
250
|
end
|
266
251
|
|
252
|
+
# FIXME: XXX: The rest of this file is outright ugly. The Redcar.platform ultimately
|
253
|
+
# needs to return a platform object which we can dispatch to for commandlines,
|
254
|
+
# configuration, escaping and all that.
|
267
255
|
class OpenCommand < Command
|
268
256
|
attr_reader :path
|
269
257
|
|
@@ -286,15 +274,12 @@ module Redcar
|
|
286
274
|
end
|
287
275
|
|
288
276
|
def run_application(app, *options)
|
289
|
-
|
277
|
+
# TODO: Investigate why Spoon doesn't seem to work on osx
|
278
|
+
if SPOON_AVAILABLE and ::Spoon.supported? and Redcar.platform != :osx
|
290
279
|
::Spoon.spawn(app, *options)
|
291
280
|
else
|
292
281
|
# TODO: This really needs proper escaping.
|
293
|
-
|
294
|
-
options = options.map {|o| "\"#{o}\""}.join(' ')
|
295
|
-
else
|
296
|
-
options = ""
|
297
|
-
end
|
282
|
+
options = options.map {|o| %{ "#{o}" } }.join(' ')
|
298
283
|
Thread.new do
|
299
284
|
system("#{app} #{options}")
|
300
285
|
puts " Finished: #{app} #{options}"
|
@@ -304,78 +289,95 @@ module Redcar
|
|
304
289
|
end
|
305
290
|
|
306
291
|
class OpenDirectoryInExplorerCommand < OpenCommand
|
307
|
-
|
308
|
-
|
309
|
-
|
292
|
+
LinuxApps = { 'Thunar' => '%s',
|
293
|
+
'nautilus' => '%s',
|
294
|
+
'konqueror' => '%s',
|
295
|
+
'kfm' => '%s' }
|
296
|
+
|
297
|
+
def explorer_osx
|
298
|
+
['open -a Finder', path]
|
299
|
+
end
|
300
|
+
|
301
|
+
def explorer_windows
|
302
|
+
['explorer.exe', path.gsub("/", "\\")]
|
303
|
+
end
|
304
|
+
|
305
|
+
def explorer_linux
|
310
306
|
preferred = Manager.storage['preferred_file_browser']
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
run = app.keys.map {|a| command.find(a)}.find{|a| a}
|
328
|
-
Manager.storage['preferred_file_browser'] = run if not preferred
|
329
|
-
end
|
330
|
-
if run
|
331
|
-
run_application(run, *app[File.basename(run)])
|
332
|
-
else
|
333
|
-
Application::Dialog.message_box("Sorry, we couldn't find your file manager. Please let us know what file manager you use, so we can fix this!")
|
334
|
-
end
|
307
|
+
run = preferred if LinuxApps[preferred] and find(preferred)
|
308
|
+
LinuxApps.keys.detect {|a| run = @command.find(a) } unless run
|
309
|
+
|
310
|
+
Manager.storage['preferred_file_browser'] = run unless preferred
|
311
|
+
|
312
|
+
[run, LinuxApps[File.basename(run)] % path ] if run
|
313
|
+
end
|
314
|
+
|
315
|
+
def execute(options = nil)
|
316
|
+
@path ||= options[:value]
|
317
|
+
@command = self
|
318
|
+
cmd = send(:"explorer_#{Redcar.platform}")
|
319
|
+
if cmd
|
320
|
+
run_application(*cmd)
|
321
|
+
else
|
322
|
+
Application::Dialog.message_box("Sorry, we couldn't start your file manager. Please let us know what file manager you use, so we can fix this!")
|
335
323
|
end
|
336
324
|
end
|
337
325
|
end
|
338
326
|
|
339
327
|
class OpenDirectoryInCommandLineCommand < OpenCommand
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
osascript <<END
|
352
|
-
tell application "#{preferred}"
|
353
|
-
do script "cd \\\"#{path}\\\""
|
354
|
-
activate
|
328
|
+
LinuxApps = { 'xfce4-terminal' => "--working-directory=%s",
|
329
|
+
'gnome-terminal' => "--working-directory=%s",
|
330
|
+
'konsole' => "--workdir %s" }
|
331
|
+
|
332
|
+
def osx_terminal_script(preferred)
|
333
|
+
if preferred.start_with? "iTerm"
|
334
|
+
<<-OSASCRIPT
|
335
|
+
tell the first terminal
|
336
|
+
launch session "Default Session"
|
337
|
+
tell the last session
|
338
|
+
write text "cd \\\"#{path}\\\""
|
355
339
|
end tell
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
340
|
+
end tell
|
341
|
+
OSASCRIPT
|
342
|
+
else
|
343
|
+
%{ do script "cd \\\"#{path}\\\"" }
|
344
|
+
end
|
345
|
+
end
|
346
|
+
|
347
|
+
def commandline_osx
|
348
|
+
preferred = (Manager.storage['preferred_command_line'] ||= "Terminal")
|
349
|
+
<<-BASH.gsub(/^\s*/, '')
|
350
|
+
osascript <<END
|
351
|
+
tell application "#{preferred}"
|
352
|
+
#{osx_terminal_script(preferred)}
|
353
|
+
activate
|
354
|
+
end tell
|
355
|
+
END
|
356
|
+
BASH
|
357
|
+
end
|
358
|
+
|
359
|
+
def commandline_windows
|
360
|
+
['start cmd.exe /kcd ', path.gsub("/","\\")]
|
361
|
+
end
|
362
|
+
|
363
|
+
def commandline_linux
|
364
|
+
preferred = Manager.storage['preferred_command_line']
|
365
|
+
run = preferred if LinuxApps[preferred] and find(preferred)
|
366
|
+
LinuxApps.keys.detect {|a| run = @command.find(a) } unless run
|
367
|
+
|
368
|
+
Manager.storage['preferred_command_line'] = run unless preferred
|
369
|
+
|
370
|
+
[run, LinuxApps[File.basename(run)] % path ] if run
|
371
|
+
end
|
372
|
+
|
373
|
+
def execute(options = nil)
|
374
|
+
@path ||= options[:value]
|
375
|
+
@command = self
|
376
|
+
cmd = send(:"commandline_#{Redcar.platform}")
|
377
|
+
if cmd
|
378
|
+
run_application(*cmd)
|
379
|
+
else
|
380
|
+
Application::Dialog.message_box("Sorry, we couldn't start your command line. Please let us know what command line you use, so we can fix this!")
|
379
381
|
end
|
380
382
|
end
|
381
383
|
end
|
@@ -2,89 +2,79 @@ module Redcar
|
|
2
2
|
class Project
|
3
3
|
class DrbService
|
4
4
|
def initialize
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
5
|
+
address = "druby://127.0.0.1:#{DRB_PORT}"
|
6
|
+
@drb = DRb.start_service(address, self)
|
7
|
+
rescue Errno::EADDRINUSE => e
|
8
|
+
puts 'warning--not starting listener (perhaps theres another Redcar already open?)' + e + ' ' + address
|
9
|
+
end
|
10
|
+
|
11
|
+
def open_item_drb(full_path, untitled = false, wait = false)
|
12
|
+
puts %{drb opening #{"untitled" if untitled} #{full_path}} if $VERBOSE
|
13
|
+
if File.directory? full_path
|
14
|
+
Swt.sync_exec { open_directory(full_path) }
|
15
|
+
elsif full_path == 'just_bring_to_front'
|
16
|
+
Swt.sync_exec { bring_to_front }
|
17
|
+
elsif File.file?(full_path)
|
18
|
+
open_file(full_path, untitled, wait)
|
10
19
|
end
|
20
|
+
'ok'
|
21
|
+
rescue Exception => e
|
22
|
+
puts 'drb got exception:' + e.class + " " + e.message, e.backtrace
|
23
|
+
raise e
|
11
24
|
end
|
12
25
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
if Redcar.app.windows.length > 0
|
23
|
-
window = Redcar.app.windows.find do |win|
|
24
|
-
next unless win
|
25
|
-
win.treebook.trees.find do |t|
|
26
|
-
t.tree_mirror.is_a?(Redcar::Project::DirMirror) and t.tree_mirror.path == full_path
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
Project::Manager.open_project_for_path(full_path)
|
31
|
-
Redcar.app.focussed_window.controller.bring_to_front
|
32
|
-
end
|
33
|
-
'ok'
|
34
|
-
elsif full_path == 'just_bring_to_front'
|
35
|
-
Swt.sync_exec do
|
36
|
-
if Redcar.app.windows.length == 0
|
37
|
-
Project::Manager.restore_last_session
|
38
|
-
end
|
39
|
-
Redcar.app.focussed_window.controller.bring_to_front
|
40
|
-
end
|
41
|
-
'ok'
|
42
|
-
elsif File.file?(full_path)
|
43
|
-
Swt.sync_exec do
|
44
|
-
if Redcar.app.windows.length == 0
|
45
|
-
Project::Manager.restore_last_session
|
46
|
-
end
|
47
|
-
if untitled
|
48
|
-
Project::Manager.open_untitled_path(full_path)
|
49
|
-
else
|
50
|
-
Project::Manager.open_file(full_path)
|
51
|
-
end
|
52
|
-
Redcar.app.focussed_window.controller.bring_to_front
|
53
|
-
end
|
54
|
-
'ok'
|
55
|
-
end
|
56
|
-
rescue Exception => e
|
57
|
-
puts 'drb got exception:' + e.class + " " + e.message, e.backtrace
|
58
|
-
raise e
|
26
|
+
##
|
27
|
+
# Opens the specified directory in a new window, if it was not
|
28
|
+
# already open. Brings the project's window to the front, if this
|
29
|
+
# directory is already opened. If the specified directory was the last open
|
30
|
+
# directory, restores the complete session.
|
31
|
+
def open_directory(full_path)
|
32
|
+
if Redcar.app.windows.empty? and Application.storage['last_open_dir'] == full_path
|
33
|
+
Project::Manager.restore_last_session
|
59
34
|
end
|
35
|
+
|
36
|
+
Redcar::Project.window_projects.each_pair do |window, project|
|
37
|
+
return window.controller.bring_to_front if project.path == full_path
|
38
|
+
end
|
39
|
+
Project::Manager.open_project_for_path(full_path)
|
40
|
+
Redcar.app.focussed_window.controller.bring_to_front
|
60
41
|
end
|
61
42
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
43
|
+
## Focuses a Redcar window
|
44
|
+
def bring_to_front
|
45
|
+
Project::Manager.restore_last_session if Redcar.app.windows.empty?
|
46
|
+
Redcar.app.focussed_window.controller.bring_to_front
|
47
|
+
end
|
48
|
+
|
49
|
+
##
|
50
|
+
# Opens a file, optionally untitled, and waits for it to close, if requested
|
51
|
+
def open_file(file, untitled, wait)
|
52
|
+
file_open_block = Proc.new do
|
68
53
|
Project::Manager.restore_last_session if Redcar.app.windows.empty?
|
69
54
|
if untitled
|
70
55
|
Project::Manager.open_untitled_path(file)
|
71
56
|
else
|
72
57
|
Project::Manager.open_file(file)
|
73
58
|
end
|
74
|
-
|
75
|
-
|
76
|
-
|
59
|
+
Redcar.app.focussed_window.controller.bring_to_front
|
60
|
+
end
|
61
|
+
wait ? open_file_and_wait(&file_open_block) : Swt.sync_exec(&file_open_block)
|
62
|
+
end
|
63
|
+
|
64
|
+
def open_file_and_wait
|
65
|
+
semaphore = Mutex.new
|
66
|
+
handler = nil
|
67
|
+
tab = nil
|
68
|
+
Swt.sync_exec do
|
69
|
+
semaphore.lock
|
70
|
+
yield
|
71
|
+
tab = Redcar.app.focussed_window.focussed_notebook_tab
|
77
72
|
handler = tab.add_listener(:close) { semaphore.unlock }
|
78
73
|
end
|
79
74
|
Thread.new(tab, handler) do
|
80
75
|
semaphore.synchronize { tab.remove_listener(handler) }
|
81
76
|
end.join # Wait until the tab's close event was fired
|
82
|
-
'ok'
|
83
|
-
rescue Exception => e
|
84
|
-
puts 'drb got exception:' + e.class + " " + e.message, e.backtrace
|
85
|
-
raise e
|
86
77
|
end
|
87
|
-
|
88
78
|
end
|
89
79
|
end
|
90
80
|
end
|
@@ -162,6 +162,33 @@ module Redcar
|
|
162
162
|
window.focus
|
163
163
|
end
|
164
164
|
|
165
|
+
def self.pop_first_line_option(args)
|
166
|
+
if args.include? '-l'
|
167
|
+
argix = args.index('-l')
|
168
|
+
raise ArgumentError, "The -l Option expects an Argument" unless args[argix + 1]
|
169
|
+
numbers = args[argix + 1].split(',')
|
170
|
+
first_num = numbers.delete_at(0)
|
171
|
+
if (args[argix + 1] = numbers.join(',')).empty?
|
172
|
+
args.delete_at(argix); args.delete_at(argix)
|
173
|
+
end
|
174
|
+
first_num
|
175
|
+
elsif match = args.select {|a| /^\-l\d+$/.match a }.first
|
176
|
+
args.delete(args.index(match))
|
177
|
+
match[2..-1]
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
181
|
+
def self.scroll_to_line(arg)
|
182
|
+
begin
|
183
|
+
doc = Redcar.app.focussed_notebook_tab.edit_view.document
|
184
|
+
lineix = arg.to_i - 1
|
185
|
+
doc.scroll_to_line(lineix)
|
186
|
+
doc.cursor_offset = doc.offset_at_line(lineix)
|
187
|
+
rescue Exception
|
188
|
+
raise ArgumentError, 'The "-l" Option expects a number as Argument'
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
165
192
|
def self.open_tab_with_content(text)
|
166
193
|
win = Redcar.app.focussed_window || Redcar.app.new_window
|
167
194
|
tab = win.new_tab(Redcar::EditTab)
|
@@ -224,6 +251,8 @@ module Redcar
|
|
224
251
|
elsif File.file?(arg)
|
225
252
|
found_path_args = true
|
226
253
|
open_file(arg)
|
254
|
+
linearg = pop_first_line_option(args)
|
255
|
+
scroll_to_line(linearg) if linearg
|
227
256
|
end
|
228
257
|
end
|
229
258
|
args.each do |arg|
|
@@ -319,10 +348,6 @@ module Redcar
|
|
319
348
|
item "Save", Project::FileSaveCommand
|
320
349
|
item "Save As", Project::FileSaveAsCommand
|
321
350
|
end
|
322
|
-
|
323
|
-
group(:priority => 11) do
|
324
|
-
item "Close Directory", Project::DirectoryCloseCommand
|
325
|
-
end
|
326
351
|
end
|
327
352
|
sub_menu "Project", :priority => 15 do
|
328
353
|
group(:priority => :first) do
|