redcar 0.5.5dev → 0.5.6dev
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/lib/redcar.rb +1 -1
- data/lib/redcar/jvm_options_probe.rb +26 -7
- data/plugins/auto_completer/lib/auto_completer.rb +46 -24
- data/plugins/edit_view/lib/edit_view.rb +92 -70
- data/plugins/edit_view_swt/lib/edit_view_swt.rb +75 -48
- data/plugins/edit_view_swt/lib/edit_view_swt/document.rb +50 -35
- data/plugins/edit_view_swt/vendor/java-mateview.rb +1 -2
- data/plugins/file_parser/lib/file_parser.rb +71 -7
- data/plugins/find-in-project/TODO.md +0 -2
- data/plugins/find-in-project/lib/find_in_project.rb +1 -0
- data/plugins/find-in-project/lib/find_in_project/controllers.rb +38 -17
- data/plugins/find-in-project/lib/find_in_project/stylesheets/style.css +27 -8
- data/plugins/find-in-project/lib/find_in_project/views/_file_heading.html.erb +2 -2
- data/plugins/find-in-project/lib/find_in_project/views/_file_line.html.erb +3 -3
- data/plugins/find-in-project/lib/find_in_project/views/index.html.erb +13 -7
- data/plugins/redcar/redcar.rb +4 -3
- data/plugins/scm/lib/scm/scm_changes_mirror/change.rb +2 -0
- data/plugins/swt/lib/swt/full_swt.rb +4 -1
- metadata +4 -4
data/Rakefile
CHANGED
data/lib/redcar.rb
CHANGED
@@ -1,14 +1,33 @@
|
|
1
|
-
|
1
|
+
require "open3"
|
2
|
+
|
2
3
|
class JvmOptionsProbe
|
4
|
+
|
3
5
|
def initialize
|
4
|
-
@
|
6
|
+
@d32 = @d64 = @client = false
|
7
|
+
|
8
|
+
if Redcar.platform == :windows
|
9
|
+
@help = `java -h`
|
10
|
+
@d32 = (@help == `java -d32`) ? true : false
|
11
|
+
@d64 = (@help == `java -d64`) ? true : false
|
12
|
+
@client = (@help == `java -client`) ? true : false
|
13
|
+
else
|
14
|
+
@help = Open3.popen3("java -h")[2].readlines
|
15
|
+
@d32 = (@help == Open3.popen3("java -d32")[2].readlines) ? true : false
|
16
|
+
@d64 = (@help == Open3.popen3("java -d64")[2].readlines) ? true : false
|
17
|
+
@client = (@help == Open3.popen3("java -client")[2].readlines) ? true : false
|
18
|
+
end
|
5
19
|
end
|
6
|
-
|
20
|
+
|
7
21
|
def can_use_d32?
|
8
|
-
@
|
22
|
+
@d32
|
9
23
|
end
|
10
|
-
|
24
|
+
|
25
|
+
def can_use_d64?
|
26
|
+
@d64
|
27
|
+
end
|
28
|
+
|
11
29
|
def can_use_client?
|
12
|
-
@
|
30
|
+
@client
|
13
31
|
end
|
14
|
-
end
|
32
|
+
end
|
33
|
+
|
@@ -5,17 +5,17 @@ require 'auto_completer/word_iterator'
|
|
5
5
|
require 'auto_completer/word_list'
|
6
6
|
|
7
7
|
module Redcar
|
8
|
-
class AutoCompleter
|
8
|
+
class AutoCompleter
|
9
9
|
WORD_CHARACTERS = /\w|_/ # /(\s|\t|\.|\r|\(|\)|,|;)/
|
10
|
-
|
10
|
+
|
11
11
|
def self.document_controller_types
|
12
12
|
[AutoCompleter::DocumentController]
|
13
13
|
end
|
14
|
-
|
14
|
+
|
15
15
|
def self.autocompletion_source_types
|
16
16
|
[AutoCompleter::CurrentDocumentCompletionSource]
|
17
17
|
end
|
18
|
-
|
18
|
+
|
19
19
|
def self.all_autocompletion_source_types
|
20
20
|
result = []
|
21
21
|
Redcar.plugin_manager.objects_implementing(:autocompletion_source_types).each do |object|
|
@@ -23,7 +23,23 @@ module Redcar
|
|
23
23
|
end
|
24
24
|
result
|
25
25
|
end
|
26
|
-
|
26
|
+
|
27
|
+
#def self.edit_view_context_menus(offset)
|
28
|
+
# cmd = AutoCompleter::MenuAutoCompleterCommand.new
|
29
|
+
# cmd.merge_menu(offset)
|
30
|
+
# completions = cmd.run
|
31
|
+
# Menu::Builder.build do
|
32
|
+
# sub_menu "Auto Completion" do
|
33
|
+
# if completions
|
34
|
+
# completions.entries.each {|item| append item }
|
35
|
+
# else
|
36
|
+
# item "(No Suggestions)" do
|
37
|
+
# end
|
38
|
+
# end
|
39
|
+
# end
|
40
|
+
# end
|
41
|
+
#end
|
42
|
+
|
27
43
|
def self.menus
|
28
44
|
Menu::Builder.build do
|
29
45
|
sub_menu "Edit" do
|
@@ -34,13 +50,13 @@ module Redcar
|
|
34
50
|
end
|
35
51
|
end
|
36
52
|
end
|
37
|
-
|
53
|
+
|
38
54
|
class AutoCompleteCommand < Redcar::EditTabCommand
|
39
|
-
|
55
|
+
|
40
56
|
def execute
|
41
57
|
controller = doc.controllers(AutoCompleter::DocumentController).first
|
42
58
|
controller.start_modification
|
43
|
-
|
59
|
+
|
44
60
|
if controller.in_completion?
|
45
61
|
doc.delete(doc.cursor_offset - controller.length_of_previous, controller.length_of_previous)
|
46
62
|
prefix = controller.prefix
|
@@ -57,7 +73,7 @@ module Redcar
|
|
57
73
|
controller.right = right
|
58
74
|
end
|
59
75
|
end
|
60
|
-
|
76
|
+
|
61
77
|
if prefix
|
62
78
|
index = (controller.index || 0) + 1
|
63
79
|
if word_list.completions.length == index
|
@@ -65,23 +81,23 @@ module Redcar
|
|
65
81
|
end
|
66
82
|
completion = word_list.completions[index]
|
67
83
|
controller.index = index
|
68
|
-
|
84
|
+
|
69
85
|
start_offset = right
|
70
86
|
doc.insert(right, completion[prefix.length..-1])
|
71
87
|
word_end_offset = right + completion.length - prefix.length
|
72
88
|
doc.cursor_offset = word_end_offset
|
73
|
-
|
89
|
+
|
74
90
|
controller.length_of_previous = completion.length - prefix.length
|
75
|
-
|
91
|
+
|
76
92
|
controller.start_completion
|
77
93
|
end
|
78
94
|
controller.end_modification
|
79
95
|
end
|
80
|
-
|
96
|
+
|
81
97
|
private
|
82
|
-
|
98
|
+
|
83
99
|
def alternatives(prefix)
|
84
|
-
sources = AutoCompleter.all_autocompletion_source_types.map do |t|
|
100
|
+
sources = AutoCompleter.all_autocompletion_source_types.map do |t|
|
85
101
|
t.new(doc, Project::Manager.focussed_project)
|
86
102
|
end
|
87
103
|
word_list = WordList.new
|
@@ -92,8 +108,8 @@ module Redcar
|
|
92
108
|
end
|
93
109
|
word_list
|
94
110
|
end
|
95
|
-
|
96
|
-
# returns the prefix that is being touched by the cursor and a range
|
111
|
+
|
112
|
+
# returns the prefix that is being touched by the cursor and a range
|
97
113
|
# containing offsets of the prefix.
|
98
114
|
def touched_prefix
|
99
115
|
range = doc.current_word_range
|
@@ -103,10 +119,15 @@ module Redcar
|
|
103
119
|
return prefix, left, right
|
104
120
|
end
|
105
121
|
end
|
106
|
-
|
122
|
+
|
107
123
|
class MenuAutoCompleterCommand < AutoCompleteCommand
|
108
|
-
|
124
|
+
|
125
|
+
def merge_menu(offset)
|
126
|
+
@merge_menu = offset
|
127
|
+
end
|
128
|
+
|
109
129
|
def execute
|
130
|
+
#TODO: something with offset?
|
110
131
|
controller = doc.controllers(AutoCompleter::DocumentController).first
|
111
132
|
input_word = ""
|
112
133
|
word_list = controller.word_list
|
@@ -117,7 +138,7 @@ module Redcar
|
|
117
138
|
controller.prefix = prefix
|
118
139
|
controller.left = left
|
119
140
|
controller.right = right
|
120
|
-
|
141
|
+
|
121
142
|
cur_doc = doc
|
122
143
|
builder = Menu::Builder.new do
|
123
144
|
word_list.words.each do |current_word, word_distance|
|
@@ -128,12 +149,13 @@ module Redcar
|
|
128
149
|
end
|
129
150
|
end
|
130
151
|
end
|
131
|
-
|
132
|
-
|
152
|
+
if @merge_menu
|
153
|
+
builder.menu
|
154
|
+
else
|
155
|
+
Application::Dialog.popup_menu(builder.menu, :cursor)
|
156
|
+
end
|
133
157
|
end
|
134
158
|
end
|
135
159
|
end
|
136
160
|
end
|
137
161
|
end
|
138
|
-
|
139
|
-
|
@@ -24,7 +24,7 @@ module Redcar
|
|
24
24
|
include Redcar::Model
|
25
25
|
extend Redcar::Observable
|
26
26
|
include Redcar::Observable
|
27
|
-
|
27
|
+
|
28
28
|
extend Forwardable
|
29
29
|
|
30
30
|
module Handler
|
@@ -33,21 +33,21 @@ module Redcar
|
|
33
33
|
def handle(edit_view, modifiers)
|
34
34
|
end
|
35
35
|
end
|
36
|
-
|
36
|
+
|
37
37
|
class << self
|
38
38
|
attr_reader :undo_sensitivity, :redo_sensitivity
|
39
39
|
attr_reader :focussed_edit_view
|
40
40
|
end
|
41
|
-
|
41
|
+
|
42
42
|
def self.tab_settings
|
43
43
|
@tab_settings ||= TabSettings.new
|
44
44
|
end
|
45
45
|
|
46
|
-
# unused?
|
46
|
+
# unused?
|
47
47
|
def self.storage
|
48
48
|
@storage ||= Plugin::Storage.new('edit_view_plugin')
|
49
49
|
end
|
50
|
-
|
50
|
+
|
51
51
|
def self.menus
|
52
52
|
Menu::Builder.build do
|
53
53
|
sub_menu "Edit" do
|
@@ -68,6 +68,29 @@ module Redcar
|
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
71
|
+
def self.edit_view_context_menus
|
72
|
+
Menu::Builder.build do
|
73
|
+
group(:priority => :first) do
|
74
|
+
item ("Cut" ) { Redcar::Top::CutCommand.new.run }
|
75
|
+
item ("Copy" ) { Redcar::Top::CopyCommand.new.run }
|
76
|
+
item ("Paste") { Redcar::Top::PasteCommand.new.run}
|
77
|
+
end
|
78
|
+
group(:priority => 20) do
|
79
|
+
separator
|
80
|
+
sub_menu "Convert Text" do
|
81
|
+
item ("to Uppercase") {EditView::UpcaseTextCommand.new.run}
|
82
|
+
item ("to Lowercase") {EditView::DowncaseTextCommand.new.run}
|
83
|
+
item ("to Titlecase") {EditView::TitlizeTextCommand.new.run}
|
84
|
+
item ("to Opposite Case") {EditView::OppositeCaseTextCommand.new.run}
|
85
|
+
separator
|
86
|
+
item ("to CamelCase") {EditView::CamelCaseTextCommand.new.run}
|
87
|
+
item ("to snake_case") {EditView::UnderscoreTextCommand.new.run}
|
88
|
+
item ("Toggle PascalCase-underscore-camelCase") {EditView::CamelSnakePascalRotateTextCommand.new.run}
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
71
94
|
def self.all_handlers(type)
|
72
95
|
result = []
|
73
96
|
method_name = :"#{type}_handlers"
|
@@ -80,31 +103,31 @@ module Redcar
|
|
80
103
|
def self.arrow_left_handlers
|
81
104
|
[Actions::ArrowLeftHandler]
|
82
105
|
end
|
83
|
-
|
106
|
+
|
84
107
|
def self.arrow_right_handlers
|
85
108
|
[Actions::ArrowRightHandler]
|
86
109
|
end
|
87
|
-
|
110
|
+
|
88
111
|
def self.tab_handlers
|
89
112
|
[Actions::IndentTabHandler]
|
90
113
|
end
|
91
|
-
|
114
|
+
|
92
115
|
def self.backspace_handlers
|
93
116
|
[Actions::BackspaceHandler]
|
94
117
|
end
|
95
|
-
|
118
|
+
|
96
119
|
def self.delete_handlers
|
97
120
|
[Actions::DeleteHandler]
|
98
121
|
end
|
99
|
-
|
122
|
+
|
100
123
|
def self.esc_handlers
|
101
124
|
[Actions::EscapeHandler]
|
102
125
|
end
|
103
|
-
|
126
|
+
|
104
127
|
def self.all_tab_handlers
|
105
128
|
all_handlers(:tab)
|
106
129
|
end
|
107
|
-
|
130
|
+
|
108
131
|
def self.all_esc_handlers
|
109
132
|
all_handlers(:esc)
|
110
133
|
end
|
@@ -140,27 +163,27 @@ module Redcar
|
|
140
163
|
def tab_pressed(modifiers)
|
141
164
|
handle_key(EditView.all_tab_handlers, modifiers)
|
142
165
|
end
|
143
|
-
|
166
|
+
|
144
167
|
def esc_pressed(modifiers)
|
145
168
|
handle_key(EditView.all_esc_handlers, modifiers)
|
146
169
|
end
|
147
|
-
|
170
|
+
|
148
171
|
def left_pressed(modifiers)
|
149
172
|
handle_key(EditView.all_arrow_left_handlers, modifiers)
|
150
173
|
end
|
151
|
-
|
174
|
+
|
152
175
|
def right_pressed(modifiers)
|
153
176
|
handle_key(EditView.all_arrow_right_handlers, modifiers)
|
154
177
|
end
|
155
|
-
|
178
|
+
|
156
179
|
def delete_pressed(modifiers)
|
157
180
|
handle_key(EditView.all_delete_handlers, modifiers)
|
158
181
|
end
|
159
|
-
|
182
|
+
|
160
183
|
def backspace_pressed(modifiers)
|
161
184
|
handle_key(EditView.all_backspace_handlers, modifiers)
|
162
185
|
end
|
163
|
-
|
186
|
+
|
164
187
|
# Called by the GUI whenever an EditView is focussed or
|
165
188
|
# loses focus. Sends :focussed_edit_view event.
|
166
189
|
#
|
@@ -174,14 +197,14 @@ module Redcar
|
|
174
197
|
edit_view.check_for_updated_document if edit_view
|
175
198
|
notify_listeners(:focussed_edit_view, edit_view)
|
176
199
|
end
|
177
|
-
|
200
|
+
|
178
201
|
def self.current
|
179
202
|
tab = Redcar.app.focussed_window.focussed_notebook.focussed_tab
|
180
203
|
if tab.is_a?(Redcar::EditTab)
|
181
204
|
tab.edit_view
|
182
205
|
end
|
183
206
|
end
|
184
|
-
|
207
|
+
|
185
208
|
def self.sensitivities
|
186
209
|
[
|
187
210
|
Sensitivity.new(:edit_tab_focussed, Redcar.app, false, [:tab_focussed]) do |tab|
|
@@ -196,12 +219,12 @@ module Redcar
|
|
196
219
|
tab and tab.is_a?(EditTab) and tab.edit_view.document.selection?
|
197
220
|
end
|
198
221
|
end,
|
199
|
-
@undo_sensitivity =
|
222
|
+
@undo_sensitivity =
|
200
223
|
Sensitivity.new(:undoable, Redcar.app, false, [:focussed_tab_changed, :tab_focussed]) do
|
201
224
|
tab = Redcar.app.focussed_window.focussed_notebook.focussed_tab
|
202
225
|
tab and tab.is_a?(EditTab) and tab.edit_view.undoable?
|
203
226
|
end,
|
204
|
-
@redo_sensitivity =
|
227
|
+
@redo_sensitivity =
|
205
228
|
Sensitivity.new(:redoable, Redcar.app, false, [:focussed_tab_changed, :tab_focussed]) do
|
206
229
|
tab = Redcar.app.focussed_window.focussed_notebook.focussed_tab
|
207
230
|
tab and tab.is_a?(EditTab) and tab.edit_view.redoable?
|
@@ -223,36 +246,36 @@ module Redcar
|
|
223
246
|
default_font = "Courier New"
|
224
247
|
default_font_size = 9
|
225
248
|
end
|
226
|
-
[ EditView.storage["font"] || default_font,
|
249
|
+
[ EditView.storage["font"] || default_font,
|
227
250
|
EditView.storage["font-size"] || default_font_size ]
|
228
251
|
end
|
229
|
-
|
252
|
+
|
230
253
|
def self.font
|
231
254
|
font_info[0]
|
232
255
|
end
|
233
|
-
|
256
|
+
|
234
257
|
def self.font_size
|
235
258
|
font_info[1]
|
236
259
|
end
|
237
|
-
|
260
|
+
|
238
261
|
def self.font=(font)
|
239
262
|
EditView.storage["font"] = font
|
240
263
|
all_edit_views.each {|ev| ev.refresh_font }
|
241
|
-
end
|
242
|
-
|
243
|
-
def refresh_font
|
264
|
+
end
|
265
|
+
|
266
|
+
def refresh_font
|
244
267
|
notify_listeners(:font_changed)
|
245
268
|
end
|
246
|
-
|
269
|
+
|
247
270
|
def self.font_size=(size)
|
248
271
|
EditView.storage["font-size"] = size
|
249
272
|
all_edit_views.each {|ev| ev.refresh_font }
|
250
273
|
end
|
251
|
-
|
274
|
+
|
252
275
|
def self.theme
|
253
276
|
EditView.storage["theme"] || "Twilight"
|
254
277
|
end
|
255
|
-
|
278
|
+
|
256
279
|
def self.theme=(theme)
|
257
280
|
theme.gsub!(/ \(Current\)$/, '')
|
258
281
|
EditView.storage["theme"] = theme
|
@@ -265,55 +288,55 @@ module Redcar
|
|
265
288
|
def self.themes
|
266
289
|
@themes ||= []
|
267
290
|
end
|
268
|
-
|
291
|
+
|
269
292
|
def refresh_theme
|
270
293
|
notify_listeners(:theme_changed)
|
271
294
|
end
|
272
|
-
|
295
|
+
|
273
296
|
def self.focussed_tab_edit_view
|
274
297
|
Redcar.app.focussed_notebook_tab.edit_view if Redcar.app.focussed_notebook_tab and Redcar.app.focussed_notebook_tab.edit_tab?
|
275
298
|
end
|
276
|
-
|
299
|
+
|
277
300
|
def self.focussed_edit_view_document
|
278
301
|
focussed_tab_edit_view.document if focussed_tab_edit_view
|
279
302
|
end
|
280
|
-
|
303
|
+
|
281
304
|
def self.focussed_document_mirror
|
282
305
|
focussed_edit_view_document.mirror if focussed_edit_view_document
|
283
306
|
end
|
284
|
-
|
307
|
+
|
285
308
|
def self.all_edit_views
|
286
309
|
Redcar.app.windows.map {|w| w.notebooks.map {|n| n.tabs}.flatten }.flatten.select {|t| t.is_a?(EditTab)}.map {|t| t.edit_view}
|
287
310
|
end
|
288
|
-
|
311
|
+
|
289
312
|
attr_reader :document
|
290
|
-
|
313
|
+
|
291
314
|
def initialize
|
292
315
|
create_document
|
293
316
|
@grammar = nil
|
294
317
|
@focussed = nil
|
295
318
|
end
|
296
|
-
|
319
|
+
|
297
320
|
def create_document
|
298
321
|
@document = Redcar::Document.new(self)
|
299
322
|
end
|
300
|
-
|
323
|
+
|
301
324
|
def_delegators :controller, :undo, :redo,
|
302
325
|
:undoable?, :redoable?,
|
303
326
|
:reset_undo,
|
304
327
|
:cursor_offset, :cursor_offset=,
|
305
328
|
:scroll_to_line, :compound,
|
306
329
|
:begin_compound, :end_compound
|
307
|
-
|
330
|
+
|
308
331
|
def grammar
|
309
332
|
@grammar
|
310
333
|
end
|
311
|
-
|
334
|
+
|
312
335
|
def grammar=(name)
|
313
336
|
set_grammar(name)
|
314
337
|
notify_listeners(:grammar_changed, name)
|
315
338
|
end
|
316
|
-
|
339
|
+
|
317
340
|
def set_grammar(name)
|
318
341
|
@grammar = name
|
319
342
|
self.tab_width = EditView.tab_settings.width_for(name)
|
@@ -325,11 +348,11 @@ module Redcar
|
|
325
348
|
refresh_show_line_numbers
|
326
349
|
refresh_show_annotations
|
327
350
|
end
|
328
|
-
|
351
|
+
|
329
352
|
def focus
|
330
353
|
notify_listeners(:focussed)
|
331
354
|
end
|
332
|
-
|
355
|
+
|
333
356
|
def exists?
|
334
357
|
controller.exists?
|
335
358
|
end
|
@@ -337,57 +360,57 @@ module Redcar
|
|
337
360
|
def tab_width
|
338
361
|
@tab_width
|
339
362
|
end
|
340
|
-
|
363
|
+
|
341
364
|
def tab_width=(val)
|
342
365
|
@tab_width = val
|
343
366
|
EditView.tab_settings.set_width_for(grammar, val)
|
344
367
|
notify_listeners(:tab_width_changed, val)
|
345
368
|
end
|
346
|
-
|
369
|
+
|
347
370
|
def set_tab_width(val)
|
348
371
|
@tab_width = val
|
349
372
|
end
|
350
|
-
|
373
|
+
|
351
374
|
def soft_tabs?
|
352
375
|
@soft_tabs
|
353
376
|
end
|
354
|
-
|
377
|
+
|
355
378
|
def soft_tabs=(bool)
|
356
379
|
@soft_tabs = bool
|
357
380
|
EditView.tab_settings.set_softness_for(grammar, bool)
|
358
381
|
notify_listeners(:softness_changed, bool)
|
359
382
|
end
|
360
|
-
|
383
|
+
|
361
384
|
def show_margin?
|
362
385
|
@show_margin
|
363
386
|
end
|
364
|
-
|
387
|
+
|
365
388
|
def show_margin=(bool)
|
366
389
|
@show_margin = bool
|
367
390
|
EditView.tab_settings.set_show_margin_for(grammar, bool)
|
368
391
|
notify_listeners(:show_margin_changed, bool)
|
369
392
|
end
|
370
|
-
|
393
|
+
|
371
394
|
def word_wrap?
|
372
395
|
@word_wrap
|
373
396
|
end
|
374
|
-
|
397
|
+
|
375
398
|
def word_wrap=(bool)
|
376
399
|
@word_wrap = bool
|
377
400
|
EditView.tab_settings.set_word_wrap_for(grammar, bool)
|
378
401
|
notify_listeners(:word_wrap_changed, bool)
|
379
402
|
end
|
380
|
-
|
403
|
+
|
381
404
|
def margin_column
|
382
405
|
@margin_column
|
383
406
|
end
|
384
|
-
|
407
|
+
|
385
408
|
def margin_column=(val)
|
386
409
|
@margin_column = val
|
387
410
|
EditView.tab_settings.set_margin_column_for(grammar, val)
|
388
411
|
notify_listeners(:margin_column_changed, val)
|
389
412
|
end
|
390
|
-
|
413
|
+
|
391
414
|
def show_invisibles?
|
392
415
|
@show_invisibles
|
393
416
|
end
|
@@ -400,7 +423,7 @@ module Redcar
|
|
400
423
|
EditView.tab_settings.set_show_invisibles(bool)
|
401
424
|
all_edit_views.each {|ev| ev.refresh_show_invisibles }
|
402
425
|
end
|
403
|
-
|
426
|
+
|
404
427
|
def refresh_show_invisibles
|
405
428
|
@show_invisibles = EditView.tab_settings.show_invisibles?
|
406
429
|
notify_listeners(:invisibles_changed, @show_invisibles)
|
@@ -418,7 +441,7 @@ module Redcar
|
|
418
441
|
EditView.tab_settings.set_show_line_numbers(bool)
|
419
442
|
all_edit_views.each {|ev| ev.refresh_show_line_numbers }
|
420
443
|
end
|
421
|
-
|
444
|
+
|
422
445
|
def refresh_show_line_numbers
|
423
446
|
@show_line_numbers = EditView.tab_settings.show_line_numbers?
|
424
447
|
notify_listeners(:line_number_visibility_changed, @show_line_numbers)
|
@@ -436,7 +459,7 @@ module Redcar
|
|
436
459
|
EditView.tab_settings.set_show_annotations(bool)
|
437
460
|
all_edit_views.each {|ev| ev.refresh_show_annotations }
|
438
461
|
end
|
439
|
-
|
462
|
+
|
440
463
|
def refresh_show_annotations
|
441
464
|
@show_annotations = EditView.tab_settings.show_annotations?
|
442
465
|
notify_listeners(:annotations_visibility_changed, @show_annotations)
|
@@ -451,30 +474,30 @@ module Redcar
|
|
451
474
|
:cursor_offset => cursor_offset,
|
452
475
|
:grammar => grammar }
|
453
476
|
end
|
454
|
-
|
477
|
+
|
455
478
|
def deserialize(data)
|
456
479
|
self.grammar = data[:grammar]
|
457
480
|
document.text = data[:contents]
|
458
481
|
self.cursor_offset = data[:cursor_offset]
|
459
482
|
end
|
460
|
-
|
483
|
+
|
461
484
|
def delay_parsing
|
462
485
|
controller.delay_parsing { yield }
|
463
486
|
end
|
464
|
-
|
487
|
+
|
465
488
|
def reset_last_checked
|
466
489
|
@last_checked = Time.now
|
467
490
|
end
|
468
|
-
|
491
|
+
|
469
492
|
def check_for_updated_document
|
470
493
|
# awful forward dependency on the Project plugin here....
|
471
|
-
if document and
|
472
|
-
document.mirror and
|
473
|
-
document.mirror.is_a?(Project::FileMirror) and
|
494
|
+
if document and
|
495
|
+
document.mirror and
|
496
|
+
document.mirror.is_a?(Project::FileMirror) and
|
474
497
|
document.mirror.changed_since?(@last_checked)
|
475
498
|
if document.modified?
|
476
499
|
result = Application::Dialog.message_box(
|
477
|
-
"This file has been changed on disc, and you have unsaved changes in Redcar.\n\n" +
|
500
|
+
"This file has been changed on disc, and you have unsaved changes in Redcar.\n\n" +
|
478
501
|
"Revert to version on disc (and lose your changes)?",
|
479
502
|
:buttons => :yes_no
|
480
503
|
)
|
@@ -489,5 +512,4 @@ module Redcar
|
|
489
512
|
@last_checked = Time.now
|
490
513
|
end
|
491
514
|
end
|
492
|
-
end
|
493
|
-
|
515
|
+
end
|