redcar 0.5.3dev → 0.5.4dev

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -1,4 +1,4 @@
1
- REDCAR_VERSION = "0.5.3dev" # also change in lib/redcar.rb!
1
+ REDCAR_VERSION = "0.5.4dev" # also change in lib/redcar.rb!
2
2
  require 'rubygems'
3
3
  require 'fileutils'
4
4
  require 'spec/rake/spectask'
data/bin/redcar CHANGED
@@ -1,7 +1,9 @@
1
1
  #!/usr/bin/env ruby
2
2
  $redcar_process_start_time = Time.now
3
3
  $VERBOSE = true if ARGV.find{|arg| arg == '--verbose'}
4
- require File.expand_path(File.join(File.dirname(__FILE__), %w(.. lib redcar_quick_start)))
4
+
5
+ $:.push(File.join(File.dirname(__FILE__), %w(.. lib)))
6
+ require "redcar_quick_start"
5
7
 
6
8
  if ARGV.include? '--silent'
7
9
  # reopen the standard pipes to nothingness if we were forked as part of jruby
data/lib/redcar.rb CHANGED
@@ -11,7 +11,6 @@ require 'redcar/usage'
11
11
  require 'regex_replace'
12
12
 
13
13
  require 'forwardable'
14
- require 'yaml'
15
14
  require 'uri'
16
15
 
17
16
  begin
@@ -52,7 +51,7 @@ end
52
51
  #
53
52
  # and so on.
54
53
  module Redcar
55
- VERSION = '0.5.3dev' # also change in the Rakefile!
54
+ VERSION = '0.5.4dev' # also change in the Rakefile!
56
55
  VERSION_MAJOR = 0
57
56
  VERSION_MINOR = 5
58
57
  VERSION_RELEASE = 0
@@ -108,7 +107,6 @@ module Redcar
108
107
  $:.push File.expand_path(File.join(Redcar.asset_dir))
109
108
 
110
109
  $:.push File.expand_path(File.join(File.dirname(__FILE__), "openssl", "lib"))
111
- require 'openssl'
112
110
 
113
111
  plugin_manager.load("swt")
114
112
  end
@@ -148,16 +148,12 @@ module Redcar
148
148
  focussed_notebook.new_tab(*args, &block)
149
149
  end
150
150
 
151
- attr_reader :menu, :toolbar, :keymap
151
+ attr_reader :menu, :keymap
152
152
 
153
153
  def menu=(menu)
154
154
  @menu = menu
155
155
  end
156
156
 
157
- def toolbar=(toolbar)
158
- @toolbar = toolbar
159
- end
160
-
161
157
  def keymap=(keymap)
162
158
  @keymap = keymap
163
159
  end
@@ -174,10 +170,6 @@ module Redcar
174
170
  notify_listeners(:refresh_menu)
175
171
  end
176
172
 
177
- def refresh_toolbar
178
- notify_listeners(:refresh_toolbar)
179
- end
180
-
181
173
  # Focus the Window.
182
174
  def focus
183
175
  Redcar.app.events.ignore(:window_focus, self) do
@@ -1,4 +1,6 @@
1
1
 
2
+ require 'yaml'
3
+
2
4
  require 'application/command/executor'
3
5
  require 'application/command/history'
4
6
  require 'application/sensitive'
@@ -11,11 +13,6 @@ require 'application/dialogs/filter_list_dialog'
11
13
  require 'application/event_spewer'
12
14
  require 'application/keymap'
13
15
  require 'application/keymap/builder'
14
- require 'application/toolbar'
15
- require 'application/toolbar/item'
16
- require 'application/toolbar/lazy_toolbar'
17
- require 'application/toolbar/builder'
18
- require 'application/toolbar/builder/group'
19
16
  require 'application/menu'
20
17
  require 'application/menu/item'
21
18
  require 'application/menu/lazy_menu'
@@ -74,7 +71,7 @@ module Redcar
74
71
  ]
75
72
  end
76
73
 
77
- attr_reader :clipboard, :keymap, :menu, :toolbar, :history, :task_queue, :show_toolbar
74
+ attr_reader :clipboard, :keymap, :menu, :history, :task_queue
78
75
 
79
76
  # Create an application instance with a Redcar::Clipboard and a Redcar::History.
80
77
  def initialize
@@ -84,7 +81,6 @@ module Redcar
84
81
  create_history
85
82
  @event_spewer = EventSpewer.new
86
83
  @task_queue = TaskQueue.new
87
- @show_toolbar = !!Application.storage['show_toolbar']
88
84
  end
89
85
 
90
86
  def events
@@ -113,7 +109,6 @@ module Redcar
113
109
  notify_listeners(:new_window, new_window)
114
110
  attach_window_listeners(new_window)
115
111
  new_window.refresh_menu
116
- new_window.refresh_toolbar
117
112
  new_window.show
118
113
  set_focussed_window(new_window)
119
114
  #puts "App#new_window took #{Time.now - s}s"
@@ -142,7 +137,6 @@ module Redcar
142
137
  @storage ||= begin
143
138
  storage = Plugin::Storage.new('application_plugin')
144
139
  storage.set_default('stay_resident_after_last_window_closed', false)
145
- storage.set_default('show_toolbar', true)
146
140
  storage
147
141
  end
148
142
  end
@@ -193,13 +187,6 @@ module Redcar
193
187
  notify_listeners(:refresh_menu)
194
188
  end
195
189
 
196
- # Redraw the main toolbar, reloading all the ToolBars and Keymaps from the plugins.
197
- def refresh_toolbar!
198
- @main_toolbar = nil
199
- windows.each {|window| window.refresh_toolbar }
200
- controller.refresh_toolbar
201
- end
202
-
203
190
  # Generate the main menu by combining menus from all plugins.
204
191
  #
205
192
  # @return [Redcar::Menu]
@@ -213,19 +200,6 @@ module Redcar
213
200
  end
214
201
  end
215
202
 
216
- # Generate the toolbar combining toolbars from all plugins.
217
- #
218
- # @return [Redcar::ToolBar]
219
- def main_toolbar
220
- @main_toolbar ||= begin
221
- toolbar = ToolBar.new
222
- Redcar.plugin_manager.objects_implementing(:toolbars).each do |object|
223
- toolbar.merge(object.toolbars)
224
- end
225
- toolbar
226
- end
227
- end
228
-
229
203
  # Generate the main keymap by merging the keymaps from all plugins.
230
204
  #
231
205
  # @return [Redcar::Keymap]
@@ -327,20 +301,6 @@ module Redcar
327
301
  def create_history
328
302
  @history = Command::History.new
329
303
  end
330
-
331
- public
332
-
333
- def show_toolbar?
334
- @show_toolbar
335
- end
336
-
337
- def show_toolbar=(bool)
338
- Application.storage['show_toobar'] = @show_toolbar = bool
339
- end
340
-
341
- def toggle_show_toolbar
342
- Application.storage['show_toolbar'] = @show_toolbar = !Application.storage['show_toolbar']
343
- end
344
304
  end
345
305
  end
346
306
 
@@ -6,8 +6,6 @@ module Redcar
6
6
 
7
7
  SASH_WIDTH = 5
8
8
  TREEBOOK_WIDTH = 200
9
- TOOLBAR_HEIGHT = 25
10
- @toolbar_height = 25
11
9
 
12
10
  class ShellListener
13
11
  include org.eclipse.swt.events.ShellListener
@@ -51,7 +49,6 @@ module Redcar
51
49
  def add_listeners
52
50
  @window.add_listener(:show, &method(:show))
53
51
  @window.add_listener(:refresh_menu, &method(:refresh_menu))
54
- @window.add_listener(:refresh_toolbar, &method(:refresh_toolbar))
55
52
  @window.add_listener(:popup_menu, &method(:popup_menu))
56
53
  @window.add_listener(:popup_menu_with_numbers, &method(:popup_menu_with_numbers))
57
54
  @window.add_listener(:title_changed, &method(:title_changed))
@@ -123,20 +120,6 @@ module Redcar
123
120
  old_menu_bar.dispose if old_menu_bar
124
121
  end
125
122
 
126
- def refresh_toolbar
127
- if Redcar.app.show_toolbar?
128
- @toolbar_controller = ApplicationSWT::ToolBar.new(self, Redcar.app.main_toolbar, Swt::SWT::HORIZONTAL | Swt::SWT::BORDER)
129
- @toolbar_controller.show()
130
- puts "Show toolbar"
131
- @toolbar_height = 25
132
- else
133
- @toolbar_controller.hide() if @toolbar_controller
134
- puts "Hide toolbar"
135
- @toolbar_height = 0
136
- end
137
- reset_sash_height
138
- end
139
-
140
123
  def set_icon
141
124
  path = File.join(icon_dir, icon_file)
142
125
  icon = Swt::Graphics::Image.new(ApplicationSWT.display, path)
@@ -214,13 +197,11 @@ module Redcar
214
197
  def closed(_)
215
198
  @shell.close
216
199
  @menu_controller.close
217
- @toolbar_controller.close
218
200
  end
219
201
 
220
202
  def dispose
221
203
  @shell.dispose
222
204
  @menu_controller.close
223
- @toolbar_controller.close
224
205
  end
225
206
 
226
207
  attr_reader :right_composite, :left_composite, :tree_composite, :tree_layout, :tree_sash
@@ -263,7 +244,7 @@ module Redcar
263
244
 
264
245
  @sash.layout_data = Swt::Layout::FormData.new.tap do |d|
265
246
  d.left = Swt::Layout::FormAttachment.new(0, 0)
266
- d.top = Swt::Layout::FormAttachment.new(0, TOOLBAR_HEIGHT)
247
+ d.top = Swt::Layout::FormAttachment.new(0, 0)
267
248
  d.bottom = Swt::Layout::FormAttachment.new(100, 0)
268
249
  end
269
250
 
@@ -285,14 +266,14 @@ module Redcar
285
266
  @left_composite.layout_data = Swt::Layout::FormData.new.tap do |l|
286
267
  l.left = Swt::Layout::FormAttachment.new(0, 5)
287
268
  l.right = Swt::Layout::FormAttachment.new(@sash, 0)
288
- l.top = Swt::Layout::FormAttachment.new(0, 5 + TOOLBAR_HEIGHT)
269
+ l.top = Swt::Layout::FormAttachment.new(0, 5)
289
270
  l.bottom = Swt::Layout::FormAttachment.new(100, -5)
290
271
  end
291
272
 
292
273
  @right_composite.layout_data = Swt::Layout::FormData.new.tap do |d|
293
274
  d.left = Swt::Layout::FormAttachment.new(@sash, 0)
294
275
  d.right = Swt::Layout::FormAttachment.new(100, -5)
295
- d.top = Swt::Layout::FormAttachment.new(0, 5 + TOOLBAR_HEIGHT)
276
+ d.top = Swt::Layout::FormAttachment.new(0, 5)
296
277
  d.bottom = Swt::Layout::FormAttachment.new(100, -5)
297
278
  end
298
279
 
@@ -330,16 +311,6 @@ module Redcar
330
311
  widths = [width]*@window.notebooks.length
331
312
  @notebook_sash.setWeights(widths.to_java(:int))
332
313
  end
333
-
334
- def reset_sash_height
335
-
336
- @sash.layout_data.top = Swt::Layout::FormAttachment.new(0, @toolbar_height.to_i)
337
- @left_composite.layout_data.top = Swt::Layout::FormAttachment.new(0, 5 + @toolbar_height.to_i)
338
- @right_composite.layout_data.top = Swt::Layout::FormAttachment.new(0, 5 + @toolbar_height.to_i)
339
- @shell.layout
340
- @shell.redraw
341
- end
342
-
343
314
  end
344
315
  end
345
- end
316
+ end
@@ -1,5 +1,5 @@
1
1
 
2
- SWT_APP_NAME = "Redcar"
2
+ require 'swt/full_swt'
3
3
 
4
4
  require "application_swt/tab"
5
5
 
@@ -10,8 +10,6 @@ require "application_swt/dialogs/filter_list_dialog_controller"
10
10
  require "application_swt/html_tab"
11
11
  require "application_swt/menu"
12
12
  require "application_swt/menu/binding_translator"
13
- require "application_swt/toolbar"
14
- require "application_swt/toolbar/binding_translator"
15
13
  require "application_swt/notebook"
16
14
  require "application_swt/notebook/tab_transfer"
17
15
  require "application_swt/notebook/tab_drag_and_drop_listener"
@@ -126,15 +124,6 @@ module Redcar
126
124
  end
127
125
  end
128
126
 
129
- def refresh_toolbar
130
- if Redcar.platform == :osx
131
- #old_toolbar_bar = @fake_shell.toolbar_bar
132
- fake_toolbar_controller = ApplicationSWT::ToolBar.new(FakeWindow.new(@fake_shell), Redcar.app.main_toolbar, Swt::SWT::FLAT)
133
- #fake_shell.toolbar_bar = fake_toolbar_controller.toolbar_bar
134
- #old_toolbar_bar.dispose if old_toolbar_bar
135
- end
136
- end
137
-
138
127
  def add_listeners
139
128
  @model.add_listener(:new_window, &method(:new_window))
140
129
  @model.add_listener(:refresh_menu, &method(:refresh_menu))
@@ -1,124 +1,125 @@
1
1
 
2
- require 'java'
3
-
4
- require File.join(File.dirname(__FILE__), *%w".. spec_helper")
5
-
6
- TaskQueue = Redcar::TaskQueue
7
- Task = Redcar::Task
8
- Resource = Redcar::Resource
9
-
10
- describe Resource do
11
- before do
12
- $started_tasks = []
13
- @block_runs = 0
14
- @started_flag = false
15
- @finish_flag = false
16
- $wait_task_finish = false
17
- @q = TaskQueue.new
18
- Resource.stub!(:task_queue).and_return(@q)
19
- end
20
-
21
- after do
22
- @q.stop
23
- end
24
-
25
- describe "synchronous get" do
26
- it "should let you synchronously get the value" do
27
- resource = Resource.new { 101 }
28
- resource.value.should == 101
29
- end
30
-
31
- it "should cache the value across multiple calls" do
32
- resource = Resource.new { @block_runs += 1; 101 }
33
- resource.value
34
- resource.value
35
- resource.value.should == 101
36
- @block_runs.should == 1
37
- end
38
-
39
- it "should wait for a background job to finish if one is already in progress" do
40
- resource = Resource.new do
41
- @block_runs += 1
42
- 1 until @finish_flag
43
- end
44
- resource.compute
45
- Thread.new do
46
- resource.value
47
- end
48
- sleep 0.1
49
- @finish_flag = true
50
- @block_runs.should == 1
51
- end
52
-
53
- it "should not wait for a background job if it pending, because it may have a long wait" do
54
- @q.submit(BlockingTask.new)
55
- resource = Resource.new do
56
- @block_runs += 1
57
- 911
58
- end
59
- resource.compute
60
- Thread.new do
61
- resource.value
62
- end
63
- sleep 0.1
64
- resource.value.should == 911
65
- @block_runs.should == 1
66
- end
67
-
68
- it "should cancel background jobs that it overtakes" do
69
- @q.submit(BlockingTask.new)
70
- resource = Resource.new do
71
- @block_runs += 1
72
- 911
73
- end
74
- resource.compute
75
- task = resource.task
76
- Thread.new do
77
- resource.value
78
- end
79
- sleep 0.1
80
- task.should be_cancelled
81
- end
82
- end
83
-
84
- it "should let you compute the resource in the background" do
85
- resource = Resource.new do
86
- 1 until @started_flag
87
- @block_runs += 1
88
- @finish_flag = true
89
- end
90
- resource.compute
91
- @block_runs.should == 0
92
- @started_flag = true
93
- 1 until @finish_flag
94
- @block_runs.should == 1
95
- end
96
-
97
- it "should have the background computed value" do
98
- resource = Resource.new do
99
- @block_runs += 1
100
- @started_flag = true
101
- 999
102
- end
103
- resource.compute
104
- 1 until @started_flag
105
- sleep 0.1
106
- resource.value.should == 999
107
- @block_runs.should == 1
108
- end
109
-
110
- it "should not compute lots of times" do
111
- resource = Resource.new do
112
- @block_runs += 1
113
- 1 until @finish_flag
114
- 999
115
- end
116
- 20.times { resource.compute }
117
- @finish_flag = true
118
- resource.value.should == 999
119
- 1 until @block_runs == 2
120
- @block_runs.should == 2
121
- end
122
- end
123
-
124
-
2
+ #require 'java'
3
+ #
4
+ #require File.join(File.dirname(__FILE__), *%w".. spec_helper")
5
+ #
6
+ #TaskQueue = Redcar::TaskQueue
7
+ #Task = Redcar::Task
8
+ #Resource = Redcar::Resource
9
+ #
10
+ #describe Resource do
11
+ # before do
12
+ # $started_tasks = []
13
+ # @block_runs = 0
14
+ # @started_flag = false
15
+ # @finish_flag = false
16
+ # $wait_task_finish = false
17
+ # @q = TaskQueue.new
18
+ # Resource.stub!(:task_queue).and_return(@q)
19
+ # end
20
+ #
21
+ # after do
22
+ # @q.stop
23
+ # end
24
+ #
25
+ # describe "synchronous get" do
26
+ # it "should let you synchronously get the value" do
27
+ # resource = Resource.new { 101 }
28
+ # resource.value.should == 101
29
+ # end
30
+ #
31
+ # it "should cache the value across multiple calls" do
32
+ # resource = Resource.new { @block_runs += 1; 101 }
33
+ # resource.value
34
+ # resource.value
35
+ # resource.value.should == 101
36
+ # @block_runs.should == 1
37
+ # end
38
+ #
39
+ # it "should wait for a background job to finish if one is already in progress" do
40
+ # resource = Resource.new do
41
+ # @block_runs += 1
42
+ # 1 until @finish_flag
43
+ # end
44
+ # resource.compute
45
+ # Thread.new do
46
+ # resource.value
47
+ # end
48
+ # sleep 0.1
49
+ # @finish_flag = true
50
+ # @block_runs.should == 1
51
+ # end
52
+ #
53
+ # it "should not wait for a background job if it pending, because it may have a long wait" do
54
+ # @q.submit(BlockingTask.new)
55
+ # resource = Resource.new do
56
+ # @block_runs += 1
57
+ # 911
58
+ # end
59
+ # resource.compute
60
+ # Thread.new do
61
+ # resource.value
62
+ # end
63
+ # sleep 0.1
64
+ # resource.value.should == 911
65
+ # @block_runs.should == 1
66
+ # end
67
+ #
68
+ # it "should cancel background jobs that it overtakes" do
69
+ # @q.submit(BlockingTask.new)
70
+ # resource = Resource.new do
71
+ # @block_runs += 1
72
+ # 911
73
+ # end
74
+ # resource.compute
75
+ # task = resource.task
76
+ # Thread.new do
77
+ # resource.value
78
+ # end
79
+ # sleep 0.1
80
+ # task.should be_cancelled
81
+ # end
82
+ # end
83
+ #
84
+ # it "should let you compute the resource in the background" do
85
+ # resource = Resource.new do
86
+ # 1 until @started_flag
87
+ # @block_runs += 1
88
+ # @finish_flag = true
89
+ # end
90
+ # resource.compute
91
+ # @block_runs.should == 0
92
+ # @started_flag = true
93
+ # 1 until @finish_flag
94
+ # @block_runs.should == 1
95
+ # end
96
+ #
97
+ # it "should have the background computed value" do
98
+ # resource = Resource.new do
99
+ # @block_runs += 1
100
+ # @started_flag = true
101
+ # 999
102
+ # end
103
+ # resource.compute
104
+ # 1 until @started_flag
105
+ # sleep 0.1
106
+ # resource.value.should == 999
107
+ # @block_runs.should == 1
108
+ # end
109
+ #
110
+ # it "should not compute lots of times" do
111
+ # resource = Resource.new do
112
+ # @block_runs += 1
113
+ # 1 until @finish_flag
114
+ # 999
115
+ # end
116
+ # 20.times { resource.compute }
117
+ # @finish_flag = true
118
+ # resource.value.should == 999
119
+ # 1 until @block_runs == 2
120
+ # @block_runs.should == 2
121
+ # end
122
+ #end
123
+ #
124
+ #
125
+ #
@@ -7,6 +7,7 @@ Plugin.define do
7
7
  file "lib", "html_view"
8
8
 
9
9
  dependencies "core", ">0",
10
- "application", ">0"
10
+ "application", ">0",
11
+ "application_swt", ">0"
11
12
 
12
13
  end
@@ -8,6 +8,8 @@ unless defined?(DRb)
8
8
  require 'drb/drb'
9
9
  end
10
10
 
11
+ require 'openssl'
12
+
11
13
  require "project/adapters/remote_protocols/protocol"
12
14
  require "project/adapters/remote_protocols/sftp"
13
15
  require "project/adapters/remote_protocols/ftp"
@@ -685,13 +685,6 @@ Redcar.environment: #{Redcar.environment}
685
685
  end
686
686
  end
687
687
 
688
- class ToggleToolbar < Redcar::EditTabCommand
689
- def execute
690
- Redcar.app.toggle_show_toolbar
691
- Redcar.app.refresh_toolbar!
692
- end
693
- end
694
-
695
688
  class SelectNewFont < Command
696
689
  def execute
697
690
  Redcar::EditView::SelectFontDialog.new.open
@@ -873,16 +866,6 @@ Redcar.environment: #{Redcar.environment}
873
866
  [linwin, osx]
874
867
  end
875
868
 
876
- def self.toolbars
877
- ToolBar::Builder.build do
878
- item "New", :command => NewCommand, :icon => :new
879
- item "Open", :command => Project::FileOpenCommand, :icon => :open
880
- item "Save", :command => Project::FileSaveCommand, :icon => :save
881
- item "Undo", :command => UndoCommand, :icon => :undo
882
- item "Redo", :command => RedoCommand, :icon => :redo
883
- end
884
- end
885
-
886
869
  def self.menus
887
870
  Menu::Builder.build do
888
871
  sub_menu "File", :priority => :first do
@@ -1043,7 +1026,6 @@ Redcar.environment: #{Redcar.environment}
1043
1026
  if Redcar.gui
1044
1027
  Redcar.app.controller = ApplicationSWT.new(Redcar.app)
1045
1028
  end
1046
- Redcar.app.refresh_toolbar!
1047
1029
  Redcar.app.refresh_menu!
1048
1030
  Redcar.app.load_sensitivities
1049
1031
  puts "initializing gui took #{Time.now - s}s"