swt 0.10 → 0.11

Sign up to get free protection for your applications and to get access to all the features.
data/lib/swt/full.rb CHANGED
@@ -43,9 +43,6 @@ module Swt
43
43
  module DND
44
44
  import org.eclipse.swt.dnd.DND
45
45
 
46
- # Only load Clipboard in full running mode.
47
- import org.eclipse.swt.dnd.Clipboard
48
-
49
46
  import org.eclipse.swt.dnd.Transfer
50
47
  import org.eclipse.swt.dnd.TextTransfer
51
48
  import org.eclipse.swt.dnd.FileTransfer
data/lib/swt/minimal.rb CHANGED
@@ -4,7 +4,7 @@ require 'swt/event_loop'
4
4
  require 'swt/cucumber_runner'
5
5
 
6
6
  module Swt
7
- VERSION = "0.10" # also change in swt.gemspec
7
+ VERSION = "0.11" # also change in swt.gemspec
8
8
 
9
9
  import org.eclipse.swt.SWT
10
10
 
@@ -48,18 +48,22 @@ module Swt
48
48
 
49
49
  # Runs the given block in the SWT Event thread
50
50
  def self.sync_exec(&block)
51
+ error = nil
52
+ result = nil
51
53
  runnable = Swt::RRunnable.new do
52
54
  begin
53
- block.call
55
+ result = block.call
54
56
  rescue => e
55
- puts "error in sync exec"
56
- puts e.message
57
- puts e.backtrace
57
+ error = e
58
58
  end
59
59
  end
60
60
  unless display.is_disposed
61
61
  display.syncExec(runnable)
62
+ if error
63
+ raise error
64
+ end
62
65
  end
66
+ result
63
67
  end
64
68
 
65
69
  # Runs the given block in the SWT Event thread after
@@ -70,14 +74,18 @@ module Swt
70
74
  end
71
75
 
72
76
  def self.display
73
- if defined?(SWT_APP_NAME)
74
- Swt::Widgets::Display.app_name = SWT_APP_NAME
77
+ @display ||= begin
78
+ if defined?(SWT_APP_NAME)
79
+ Swt::Widgets::Display.app_name = SWT_APP_NAME
80
+ end
81
+ display ||= (Swt::Widgets::Display.getCurrent || Swt::Widgets::Display.new)
82
+
83
+ # clipboard class must be imported after the display is created
84
+ Swt::DND.send(:import, org.eclipse.swt.dnd.Clipboard)
85
+ display
75
86
  end
76
- @display ||= (Swt::Widgets::Display.getCurrent || Swt::Widgets::Display.new)
77
87
  end
78
88
 
79
- display # must be created before we import the Clipboard class.
80
-
81
89
  def self.event_loop(&stop_condition)
82
90
  stop_conditions << stop_condition
83
91
  run_event_loop
@@ -94,15 +102,15 @@ module Swt
94
102
  def self.run_event_loop
95
103
  return if event_loop_running?
96
104
  @event_loop_running = true
97
- display = Swt::Widgets::Display.current
105
+ this_display = display
98
106
 
99
107
  until stop_conditions.any? {|c| c[] }
100
- unless display.read_and_dispatch
101
- display.sleep
108
+ unless this_display.read_and_dispatch
109
+ this_display.sleep
102
110
  end
103
111
  end
104
112
 
105
- display.dispose
113
+ this_display.dispose
106
114
  end
107
115
  end
108
116
 
@@ -1,5 +1,5 @@
1
1
 
2
- module SwtbotExtensions
2
+ module SwtBotExtensions
3
3
  def c_tab_folder
4
4
  c_tab_item.widget.parent
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: swt
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.10'
4
+ version: '0.11'
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-09-10 00:00:00.000000000 +01:00
12
+ date: 2011-11-16 00:00:00.000000000 +00:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
  description: Includes SWT jars and imports SWT classes into Ruby.