redcar 0.7 → 0.8

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.
Files changed (131) hide show
  1. data/CHANGES +42 -0
  2. data/README.md +5 -3
  3. data/Rakefile +39 -81
  4. data/bin/redcar +1 -1
  5. data/lib/redcar.rb +9 -6
  6. data/lib/redcar/installer.rb +1 -1
  7. data/lib/redcar/ruby_extensions.rb +19 -0
  8. data/lib/redcar/runner.rb +1 -1
  9. data/lib/redcar/usage.rb +3 -0
  10. data/lib/redcar_quick_start.rb +11 -11
  11. data/plugins/application/features/step_definitions/tree_steps.rb +22 -5
  12. data/plugins/application/features/step_definitions/window_steps.rb +9 -1
  13. data/plugins/application/features/support/env.rb +5 -2
  14. data/plugins/application/lib/application.rb +51 -46
  15. data/plugins/application/lib/application/window.rb +60 -30
  16. data/plugins/application_swt/lib/application_swt.rb +16 -16
  17. data/plugins/application_swt/lib/application_swt/window.rb +35 -7
  18. data/plugins/auto_completer/features/support/env.rb +0 -2
  19. data/plugins/auto_indenter/features/support/env.rb +0 -1
  20. data/plugins/auto_pairer/features/auto_pairer.feature +50 -45
  21. data/plugins/auto_pairer/features/support/env.rb +0 -1
  22. data/plugins/auto_pairer/lib/auto_pairer/document_controller.rb +11 -6
  23. data/plugins/clipboard-viewer/Screenshot.png +0 -0
  24. data/plugins/clipboard-viewer/lib/clipboard_viewer.rb +50 -0
  25. data/plugins/clipboard-viewer/lib/clipboard_viewer/browser_controller.rb +27 -0
  26. data/plugins/clipboard-viewer/lib/clipboard_viewer/clipboard_bar.rb +67 -0
  27. data/plugins/clipboard-viewer/plugin.rb +9 -0
  28. data/plugins/clipboard-viewer/views/clipboard.html.erb +15 -0
  29. data/plugins/clipboard-viewer/views/default.css +43 -0
  30. data/plugins/clipboard-viewer/views/redcar_small_icon.png +0 -0
  31. data/plugins/comment/features/line_comment.feature +137 -0
  32. data/plugins/comment/features/selection_comment.feature +21 -0
  33. data/plugins/comment/features/step_definitions/comment_steps.rb +7 -0
  34. data/plugins/comment/lib/comment.rb +266 -0
  35. data/plugins/comment/plugin.rb +7 -0
  36. data/plugins/comment/vendor/comment_lib.json +47 -0
  37. data/plugins/declarations/lib/declarations.rb +1 -1
  38. data/plugins/document_search/features/replace.feature +10 -2
  39. data/plugins/document_search/features/support/env.rb +0 -1
  40. data/plugins/document_search/lib/document_search.rb +4 -1
  41. data/plugins/document_search/lib/document_search/replace.rb +11 -3
  42. data/plugins/document_search/lib/document_search/search_and_replace.rb +5 -2
  43. data/plugins/edit_view/features/case_change.feature +9 -9
  44. data/plugins/edit_view/features/cursor_navigation.feature +36 -0
  45. data/plugins/edit_view/features/step_definitions/editing_steps.rb +63 -8
  46. data/plugins/edit_view/features/step_definitions/notebook_steps.rb +2 -0
  47. data/plugins/edit_view/features/step_definitions/tab_steps.rb +8 -5
  48. data/plugins/edit_view/features/support/env.rb +8 -2
  49. data/plugins/edit_view/lib/edit_view.rb +16 -1
  50. data/plugins/edit_view/lib/edit_view/actions/cmd_enter.rb +11 -0
  51. data/plugins/edit_view/lib/edit_view/document.rb +27 -10
  52. data/plugins/edit_view/lib/edit_view/edit_tab.rb +17 -4
  53. data/plugins/edit_view/spec/edit_view/document_spec.rb +3 -0
  54. data/plugins/edit_view_swt/lib/edit_view_swt.rb +42 -3
  55. data/plugins/edit_view_swt/lib/edit_view_swt/word_movement.rb +17 -15
  56. data/plugins/help/lib/help.rb +40 -0
  57. data/plugins/help/plugin.rb +8 -0
  58. data/plugins/html_view/features/step_definitions/html_view_steps.rb +6 -4
  59. data/plugins/line_tools/features/support/env.rb +0 -1
  60. data/plugins/macros/features/step_definitions/macro_steps.rb +0 -55
  61. data/plugins/macros/features/support/env.rb +0 -2
  62. data/plugins/open_default_app/lib/open_default_app.rb +35 -0
  63. data/plugins/open_default_app/plugin.rb +8 -0
  64. data/plugins/open_default_app/screenshot.png +0 -0
  65. data/plugins/plugin_manager_ui/lib/plugin_manager_ui.rb +17 -3
  66. data/plugins/project/features/find_file.feature +3 -2
  67. data/plugins/project/features/highlight_focussed_tab.feature +8 -0
  68. data/plugins/project/features/move_and_rename_files.feature +25 -0
  69. data/plugins/project/features/open_and_save_files.feature +10 -1
  70. data/plugins/project/features/open_directory_tree.feature +32 -2
  71. data/plugins/project/features/step_definitions/directory_steps.rb +17 -0
  72. data/plugins/project/features/step_definitions/project_tree_steps.rb +3 -0
  73. data/plugins/project/features/sub_project.feature +14 -0
  74. data/plugins/project/features/support/env.rb +22 -3
  75. data/plugins/project/features/watch_for_modified_files.feature +32 -9
  76. data/plugins/project/lib/project.rb +53 -21
  77. data/plugins/project/lib/project/adapters/local.rb +21 -16
  78. data/plugins/project/lib/project/adapters/remote.rb +15 -13
  79. data/plugins/project/lib/project/commands.rb +37 -16
  80. data/plugins/project/lib/project/dir_controller.rb +41 -42
  81. data/plugins/project/lib/project/drb_service.rb +35 -21
  82. data/plugins/project/lib/project/file_list.rb +7 -1
  83. data/plugins/project/lib/project/manager.rb +28 -3
  84. data/plugins/project/lib/project/sub_project.rb +17 -0
  85. data/plugins/project/lib/project/support/recycle.js +2 -0
  86. data/plugins/project/lib/project/support/trash.rb +72 -0
  87. data/plugins/project/spec/fixtures/multi-byte-files/a/341/204/200/341/205/247/341/206/274/341/204/205/341/205/251/foo +1 -0
  88. data/plugins/project/spec/fixtures/multi-byte-files//341/204/220/341/205/246/341/204/211/341/205/263/341/204/220/341/205/263.py +1 -0
  89. data/plugins/project/spec/project/file_list_spec.rb +4 -0
  90. data/plugins/redcar/features/goto_line_command.feature +20 -0
  91. data/plugins/redcar/redcar.rb +107 -47
  92. data/plugins/repl/lib/repl.rb +20 -20
  93. data/plugins/repl/lib/repl/clojure_mirror.rb +50 -58
  94. data/plugins/repl/lib/repl/groovy_mirror.rb +22 -41
  95. data/plugins/repl/lib/repl/repl_mirror.rb +85 -14
  96. data/plugins/repl/lib/repl/ruby_mirror.rb +12 -39
  97. data/plugins/repl/spec/repl/groovy_mirror_spec.rb +1 -1
  98. data/plugins/repl/spec/repl/ruby_mirror_spec.rb +12 -12
  99. data/plugins/ruby/README +6 -0
  100. data/plugins/ruby/lib/syntax_check/ruby.rb +28 -0
  101. data/plugins/ruby/plugin.rb +7 -0
  102. data/plugins/runnables/features/command_tree.feature +9 -0
  103. data/plugins/runnables/features/file_runner_input.feature +20 -0
  104. data/plugins/runnables/features/run_alternate_command.feature +14 -0
  105. data/plugins/runnables/features/support/env.rb +42 -5
  106. data/plugins/runnables/lib/runnables.rb +67 -21
  107. data/plugins/runnables/lib/runnables/commands.rb +35 -18
  108. data/plugins/runnables/lib/runnables/tree_mirror/nodes/runnable_group.rb +23 -37
  109. data/plugins/runnables/lib/runnables/tree_mirror/nodes/runnable_type_group.rb +16 -18
  110. data/plugins/scm_svn/features/support/env.rb +0 -3
  111. data/plugins/snippets/features/snippets.feature +17 -2
  112. data/plugins/snippets/features/support/env.rb +0 -1
  113. data/plugins/snippets/lib/snippets/tab_handler.rb +51 -18
  114. data/plugins/swt/lib/swt/cucumber_patches.rb +13 -68
  115. data/plugins/swt/lib/swt/cucumber_runner.rb +2 -3
  116. data/plugins/syntax_check/README +6 -0
  117. data/plugins/syntax_check/lib/syntax_check.rb +16 -0
  118. data/plugins/syntax_check/lib/syntax_check/checker.rb +47 -0
  119. data/plugins/syntax_check/lib/syntax_check/error.rb +23 -0
  120. data/plugins/syntax_check/plugin.rb +7 -0
  121. data/plugins/tree_view_swt/lib/tree_view_swt.rb +6 -0
  122. data/plugins/web_bookmarks/Screenshot.png +0 -0
  123. data/plugins/web_bookmarks/lib/web_bookmarks.rb +42 -0
  124. data/plugins/web_bookmarks/lib/web_bookmarks/bookmark.rb +43 -0
  125. data/plugins/web_bookmarks/lib/web_bookmarks/browser_bar.rb +70 -0
  126. data/plugins/web_bookmarks/lib/web_bookmarks/commands.rb +111 -0
  127. data/plugins/web_bookmarks/lib/web_bookmarks/tree.rb +67 -0
  128. data/plugins/web_bookmarks/lib/web_bookmarks/view_controller.rb +22 -0
  129. data/plugins/web_bookmarks/plugin.rb +11 -0
  130. data/plugins/web_bookmarks/views/index.html.erb +5 -0
  131. metadata +60 -10
@@ -147,11 +147,14 @@ def close_everything
147
147
  dialogs.each {|d| d.controller.model.close }
148
148
  end
149
149
  Redcar.app.windows.each do |win|
150
- while tree = win.treebook.trees.first
150
+ win.treebook.trees.each do |tree|
151
151
  Swt.sync_exec do
152
152
  win.treebook.remove_tree(tree)
153
153
  end
154
154
  end
155
+ if Redcar::Project::Manager.in_window(win)
156
+ Redcar::Project.window_projects.delete(win)
157
+ end
155
158
  win.notebooks.each do |notebook|
156
159
  while tab = notebook.tabs.first
157
160
  Swt.sync_exec do
@@ -191,7 +194,7 @@ After do
191
194
  Redcar.app.history.clear
192
195
  total_mem = java.lang.Runtime.getRuntime.totalMemory
193
196
  free_mem = java.lang.Runtime.getRuntime.freeMemory
194
- p [:total, total_mem, :free, free_mem, :diff, total_mem - free_mem]
197
+ #p [:total, total_mem, :free, free_mem, :diff, total_mem - free_mem]
195
198
  end
196
199
 
197
200
  at_exit {
@@ -42,16 +42,16 @@ module Redcar
42
42
  # one place to hook into Redcar events.
43
43
  class Application
44
44
  NAME = "Redcar"
45
-
45
+
46
46
  include Redcar::Model
47
47
  include Redcar::Observable
48
-
48
+
49
49
  def self.start
50
50
  Redcar.app = Application.new
51
51
  end
52
-
52
+
53
53
  def self.sensitivities
54
- [
54
+ [
55
55
  Sensitivity.new(:open_tab, Redcar.app, false, [:focussed_window, :tab_focussed]) do |tab|
56
56
  if win = Redcar.app.focussed_window
57
57
  win.focussed_notebook.focussed_tab
@@ -67,7 +67,7 @@ module Redcar
67
67
  win.notebooks.length > 1
68
68
  end
69
69
  end,
70
- Sensitivity.new(:other_notebook_has_tab, Redcar.app, false,
70
+ Sensitivity.new(:other_notebook_has_tab, Redcar.app, false,
71
71
  [:focussed_window, :focussed_notebook, :notebook_change, :tab_closed]) do
72
72
  if win = Redcar.app.focussed_window and notebook = win.nonfocussed_notebook
73
73
  notebook.tabs.any?
@@ -75,9 +75,9 @@ module Redcar
75
75
  end
76
76
  ]
77
77
  end
78
-
78
+
79
79
  attr_reader :clipboard, :keymap, :menu, :toolbar, :history, :task_queue, :show_toolbar
80
-
80
+
81
81
  # Create an application instance with a Redcar::Clipboard and a Redcar::History.
82
82
  def initialize
83
83
  @windows = []
@@ -86,27 +86,27 @@ module Redcar
86
86
  create_history
87
87
  @event_spewer = EventSpewer.new
88
88
  @task_queue = TaskQueue.new
89
-
89
+
90
90
  # Don't show the toolbar by default on Mac OS X
91
91
  if Redcar.platform == :osx
92
92
  Application.storage['show_toolbar'] = false
93
93
  end
94
-
94
+
95
95
  # Otherwise, use previous setting
96
96
  @show_toolbar = !!Application.storage['show_toolbar']
97
97
  end
98
-
98
+
99
99
  def events
100
100
  @event_spewer
101
101
  end
102
-
102
+
103
103
  # Immediately stop the gui event loop.
104
- # (You should probably be running QuitCommand instead.)
104
+ # (You should probably be running QuitCommand instead.)
105
105
  def quit
106
106
  @task_queue.stop
107
107
  Redcar.gui.stop
108
108
  end
109
-
109
+
110
110
  # All open windows
111
111
  #
112
112
  # @return [Array<Redcar::Window>]
@@ -127,14 +127,14 @@ module Redcar
127
127
  set_focussed_window(new_window)
128
128
  #puts "App#new_window took #{Time.now - s}s"
129
129
  new_window
130
- end
131
-
130
+ end
131
+
132
132
  def make_sure_at_least_one_window_open
133
133
  if windows.length == 0
134
134
  new_window
135
135
  end
136
- end
137
-
136
+ end
137
+
138
138
  # Removes a window from this Application. Should not be called by plugins,
139
139
  # use Window#close instead.
140
140
  def window_closed(window)
@@ -143,10 +143,10 @@ module Redcar
143
143
  self.focussed_window = windows.first
144
144
  end
145
145
  @window_handlers[window].each {|h| window.remove_listener(h) }
146
-
146
+
147
147
  @window_handlers.delete(window)
148
148
  end
149
-
149
+
150
150
  def self.storage
151
151
  @storage ||= begin
152
152
  storage = Plugin::Storage.new('application_plugin')
@@ -155,45 +155,45 @@ module Redcar
155
155
  storage
156
156
  end
157
157
  end
158
-
158
+
159
159
  # All Redcar::Notebooks in all Windows.
160
160
  def all_notebooks
161
161
  windows.inject([]) { |arr, window| arr << window.notebooks }.flatten
162
162
  end
163
-
163
+
164
164
  # All Redcar::Tabs in all Notebooks in all Windows.
165
165
  def all_tabs
166
166
  all_notebooks.inject([]) { |arr, notebook| arr << notebook.tabs }.flatten
167
167
  end
168
-
168
+
169
169
  # The focussed Redcar::Notebook in the focussed window, or nil.
170
170
  def focussed_window_notebook
171
171
  focussed_window.focussed_notebook if focussed_window
172
172
  end
173
-
173
+
174
174
  # The focussed Redcar::Tab in the focussed notebook in the focussed window.
175
175
  def focussed_notebook_tab
176
176
  focussed_window_notebook.focussed_tab if focussed_window_notebook
177
177
  end
178
178
 
179
- # The focussed Redcar::Window.
179
+ # The focussed Redcar::Window.
180
180
  def focussed_window
181
181
  @focussed_window
182
182
  end
183
-
184
- # Set which window the app thinks is focussed.
183
+
184
+ # Set which window the app thinks is focussed.
185
185
  # Should not be called by plugins, use Window#focus instead.
186
186
  def focussed_window=(window)
187
187
  set_focussed_window(window)
188
188
  notify_listeners(:focussed_window, window)
189
189
  end
190
-
190
+
191
191
  # Set which window the app thinks is focussed.
192
192
  # Should not be called by plugins, use Window#focus instead.
193
193
  def set_focussed_window(window)
194
194
  @focussed_window = window
195
195
  end
196
-
196
+
197
197
  # Redraw the main menu, reloading all the Menus and Keymaps from the plugins.
198
198
  def refresh_menu!
199
199
  @main_menu = nil
@@ -201,27 +201,32 @@ module Redcar
201
201
  windows.each {|window| window.refresh_menu }
202
202
  notify_listeners(:refresh_menu)
203
203
  end
204
-
204
+
205
205
  # Redraw the main toolbar, reloading all the ToolBars and Keymaps from the plugins.
206
206
  def refresh_toolbar!
207
207
  @main_toolbar = nil
208
208
  windows.each {|window| window.refresh_toolbar }
209
209
  controller.refresh_toolbar
210
210
  end
211
-
211
+
212
212
  # Generate the main menu by combining menus from all plugins.
213
213
  #
214
214
  # @return [Redcar::Menu]
215
- def main_menu
215
+ def main_menu(window=nil)
216
216
  @main_menu ||= begin
217
217
  menu = Menu.new
218
218
  Redcar.plugin_manager.objects_implementing(:menus).each do |object|
219
- menu.merge(object.menus)
219
+ case object.method(:menus).arity
220
+ when 1
221
+ menu.merge(object.menus(window))
222
+ else
223
+ menu.merge(object.menus)
224
+ end
220
225
  end
221
226
  menu
222
227
  end
223
228
  end
224
-
229
+
225
230
  # Generate the toolbar combining toolbars from all plugins.
226
231
  #
227
232
  # @return [Redcar::ToolBar]
@@ -234,7 +239,7 @@ module Redcar
234
239
  toolbar
235
240
  end
236
241
  end
237
-
242
+
238
243
  # Generate the main keymap by merging the keymaps from all plugins.
239
244
  #
240
245
  # @return [Redcar::Keymap]
@@ -243,7 +248,7 @@ module Redcar
243
248
  keymap = Keymap.new("main", Redcar.platform)
244
249
  Redcar.plugin_manager.objects_implementing(:keymaps).each do |object|
245
250
  maps = object.keymaps
246
- keymaps = maps.select do |map|
251
+ keymaps = maps.select do |map|
247
252
  map.name == "main" and map.platforms.include?(Redcar.platform)
248
253
  end
249
254
  keymap = keymaps.inject(keymap) {|k, nk| k.merge(nk) }
@@ -251,14 +256,14 @@ module Redcar
251
256
  keymap
252
257
  end
253
258
  end
254
-
259
+
255
260
  # Loads sensitivities from all plugins.
256
261
  def load_sensitivities
257
262
  Redcar.plugin_manager.objects_implementing(:sensitivities).each do |object|
258
263
  object.sensitivities
259
264
  end
260
265
  end
261
-
266
+
262
267
  # Called by the Gui to tell the Application that it
263
268
  # has lost focus.
264
269
  def lost_application_focus
@@ -266,7 +271,7 @@ module Redcar
266
271
  @application_focus = false
267
272
  notify_listeners(:lost_focus, self)
268
273
  end
269
-
274
+
270
275
  # Called by the Gui to tell the Application that it
271
276
  # has gained focus.
272
277
  def gained_application_focus
@@ -275,24 +280,24 @@ module Redcar
275
280
  notify_listeners(:focussed, self)
276
281
  end
277
282
  end
278
-
283
+
279
284
  def has_focus?
280
285
  @application_focus
281
286
  end
282
-
287
+
283
288
  def protect_application_focus
284
289
  @protect_application_focus = true
285
290
  r = yield
286
291
  @protect_application_focus = false
287
292
  r
288
293
  end
289
-
294
+
290
295
  def repeat_event(type)
291
296
  notify_listeners(type)
292
297
  end
293
-
298
+
294
299
  private
295
-
300
+
296
301
  def attach_window_listeners(window)
297
302
  h1 = window.add_listener(:tab_focussed) do |tab|
298
303
  notify_listeners(:tab_focussed, tab)
@@ -331,17 +336,17 @@ module Redcar
331
336
  end
332
337
  @window_handlers[window] << h1 << h2 << h3 << h4 << h5 << h6 << h7 << h8 << h9 << h10
333
338
  end
334
-
339
+
335
340
  def create_clipboard
336
341
  @clipboard = Clipboard.new("application")
337
342
  @clipboard.add_listener(:added) { notify_listeners(:clipboard_added) }
338
343
  end
339
-
344
+
340
345
  def create_history
341
346
  @history = Command::History.new
342
347
  end
343
348
 
344
- public
349
+ public
345
350
 
346
351
  def show_toolbar?
347
352
  @show_toolbar
@@ -2,10 +2,10 @@
2
2
  module Redcar
3
3
  class Window
4
4
  DEFAULT_TITLE = "Redcar"
5
-
5
+
6
6
  include Redcar::Model
7
7
  include Redcar::Observable
8
-
8
+
9
9
  # All instantiated windows
10
10
  def self.all
11
11
  @all ||= []
@@ -14,16 +14,28 @@ module Redcar
14
14
  attr_reader :notebooks, :notebook_orientation
15
15
  attr_reader :treebook
16
16
  attr_reader :speedbar
17
-
17
+
18
18
  def initialize
19
19
  Window.all << self
20
20
  @visible = false
21
21
  @notebooks = []
22
22
  @notebook_orientation = :horizontal
23
23
  create_notebook
24
- @treebook = Treebook.new
25
- @speedbar = nil
26
- self.title = DEFAULT_TITLE
24
+ @treebook = Treebook.new
25
+ @speedbar = nil
26
+ self.title = DEFAULT_TITLE
27
+ end
28
+
29
+ def set_trees_visible(value)
30
+ if value
31
+ notify_listeners(:toggle_trees_visible) unless trees_visible?
32
+ else
33
+ notify_listeners(:toggle_trees_visible) if trees_visible?
34
+ end
35
+ end
36
+
37
+ def trees_visible?
38
+ controller.treebook_visible?
27
39
  end
28
40
 
29
41
  def title
@@ -43,7 +55,15 @@ module Redcar
43
55
  def visible?
44
56
  @visible
45
57
  end
46
-
58
+
59
+ def fullscreen
60
+ controller.fullscreen
61
+ end
62
+
63
+ def fullscreen=(value)
64
+ controller.fullscreen = value
65
+ end
66
+
47
67
  # Create a new notebook in this window.
48
68
  #
49
69
  # @events [(:new_notebook, notebook)]
@@ -57,7 +77,7 @@ module Redcar
57
77
  attach_notebook_listeners(notebook)
58
78
  notify_listeners(:new_notebook, notebook)
59
79
  end
60
-
80
+
61
81
  def attach_notebook_listeners(notebook)
62
82
  notebook.add_listener(:tab_focussed) do |tab|
63
83
  notify_listeners(:tab_focussed, tab)
@@ -87,7 +107,7 @@ module Redcar
87
107
  end
88
108
  end
89
109
  end
90
-
110
+
91
111
  def close_notebook
92
112
  return if @notebooks.length == 1
93
113
  first_notebook, second_notebook = *@notebooks
@@ -98,42 +118,42 @@ module Redcar
98
118
  self.focussed_notebook = first_notebook
99
119
  notify_listeners(:notebook_removed, second_notebook)
100
120
  end
101
-
121
+
102
122
  def focussed_notebook
103
123
  @focussed_notebook
104
124
  end
105
-
125
+
106
126
  def focussed_notebook_tab
107
127
  @focussed_notebook.focussed_tab
108
128
  end
109
-
129
+
110
130
  def focussed_notebook_tab_document
111
131
  focussed_notebook_tab.document if focussed_notebook_tab
112
- end
113
-
132
+ end
133
+
114
134
  def focussed_notebook=(notebook)
115
135
  if notebook != @focussed_notebook
116
136
  set_focussed_notebook(notebook)
117
137
  notify_listeners(:notebook_focussed, notebook)
118
138
  end
119
139
  end
120
-
140
+
121
141
  def set_focussed_notebook(notebook)
122
142
  @focussed_notebook = notebook
123
143
  end
124
-
144
+
125
145
  def nonfocussed_notebook
126
146
  @notebooks.find {|nb| nb != @focussed_notebook }
127
147
  end
128
-
148
+
129
149
  # Sets the orientation of the notebooks.
130
150
  #
131
- # @param [:horizontal, :vertical]
151
+ # @param [:horizontal, :vertical]
132
152
  def notebook_orientation=(key)
133
153
  @notebook_orientation = key
134
154
  notify_listeners(:notebook_orientation_changed, key)
135
155
  end
136
-
156
+
137
157
  # Sets the orientation of the notebooks to whatever it is not currently.
138
158
  def rotate_notebooks
139
159
  if notebook_orientation == :horizontal
@@ -142,12 +162,12 @@ module Redcar
142
162
  self.notebook_orientation = :horizontal
143
163
  end
144
164
  end
145
-
165
+
146
166
  # Delegates to the new_tab method in the Window's active Notebook.
147
167
  def new_tab(*args, &block)
148
168
  focussed_notebook.new_tab(*args, &block)
149
169
  end
150
-
170
+
151
171
  attr_reader :menu, :toolbar, :keymap
152
172
 
153
173
  def menu=(menu)
@@ -165,30 +185,40 @@ module Redcar
165
185
  def popup_menu(menu)
166
186
  notify_listeners(:popup_menu, menu)
167
187
  end
168
-
188
+
169
189
  def popup_menu_with_numbers(menu)
170
190
  notify_listeners(:popup_menu_with_numbers, menu)
171
191
  end
172
-
192
+
173
193
  def refresh_menu
174
194
  notify_listeners(:refresh_menu)
175
195
  end
176
-
196
+
177
197
  def refresh_toolbar
178
198
  notify_listeners(:refresh_toolbar)
179
199
  end
180
-
200
+
181
201
  # Focus the Window.
182
202
  def focus
183
203
  Redcar.app.events.ignore(:window_focus, self) do
184
204
  notify_listeners(:focussed, self)
205
+ refresh_tabs
206
+ end
207
+ end
208
+
209
+ # Check all tabs for underlying files; mark if missing
210
+ def refresh_tabs
211
+ all_tabs.each do |tab|
212
+ if tab.is_a?(Redcar::EditTab)
213
+ tab.update_for_file_changes
214
+ end
185
215
  end
186
216
  end
187
217
 
188
218
  def close
189
219
  Redcar.app.events.ignore(:window_close, self) do
190
220
  notify_listeners(:about_to_close, self)
191
- notebooks.each do |notebook|
221
+ notebooks.each do |notebook|
192
222
  notebook.tabs.each {|tab| tab.close }
193
223
  end
194
224
  if notebooks.length > 1
@@ -197,11 +227,11 @@ module Redcar
197
227
  notify_listeners(:closed, self)
198
228
  end
199
229
  end
200
-
230
+
201
231
  def inspect
202
232
  "#<Redcar::Window \"#{title}\">"
203
233
  end
204
-
234
+
205
235
  def open_speedbar(speedbar)
206
236
  if @speedbar
207
237
  close_speedbar
@@ -209,7 +239,7 @@ module Redcar
209
239
  @speedbar = speedbar
210
240
  notify_listeners(:speedbar_opened, speedbar)
211
241
  end
212
-
242
+
213
243
  def close_speedbar
214
244
  notify_listeners(:speedbar_closed, @speedbar)
215
245
  @speedbar.close if @speedbar.respond_to?(:close)
@@ -218,7 +248,7 @@ module Redcar
218
248
  tab.focus
219
249
  end
220
250
  end
221
-
251
+
222
252
  def all_tabs
223
253
  notebooks.map {|nb| nb.tabs }.flatten
224
254
  end