swt 0.1-java
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +27 -0
- data/README.md +20 -0
- data/lib/swt.rb +4 -0
- data/lib/swt/cucumber_patches.rb +33 -0
- data/lib/swt/cucumber_runner.rb +23 -0
- data/lib/swt/event_loop.rb +30 -0
- data/lib/swt/full.rb +117 -0
- data/lib/swt/grid_data.rb +11 -0
- data/lib/swt/jar.rb +31 -0
- data/lib/swt/minimal.rb +79 -0
- data/vendor/jface/org.eclipse.core.commands.jar +0 -0
- data/vendor/jface/org.eclipse.core.jobs.jar +0 -0
- data/vendor/jface/org.eclipse.core.resources.jar +0 -0
- data/vendor/jface/org.eclipse.core.runtime_3.5.0.v20090525.jar +0 -0
- data/vendor/jface/org.eclipse.equinox.common.jar +0 -0
- data/vendor/jface/org.eclipse.jface.databinding_1.3.0.I20090525-2000.jar +0 -0
- data/vendor/jface/org.eclipse.jface.jar +0 -0
- data/vendor/jface/org.eclipse.jface.text_3.5.0.jar +0 -0
- data/vendor/jface/org.eclipse.osgi.jar +0 -0
- data/vendor/jface/org.eclipse.text_3.5.0.v20090513-2000.jar +0 -0
- data/vendor/swt_linux.jar +0 -0
- data/vendor/swt_linux64.jar +0 -0
- data/vendor/swt_osx.jar +0 -0
- data/vendor/swt_osx64.jar +0 -0
- data/vendor/swt_win32.jar +0 -0
- metadata +81 -0
data/LICENSE
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
All files in the directory "vendor" are provided to you under the
|
2
|
+
terms and conditions of the Eclipse Public License Version 1.0 ("EPL").
|
3
|
+
A copy of the EPL is available at http://www.eclipse.org/legal/epl-v10.html
|
4
|
+
|
5
|
+
Unless specified in the file itself, the contents of all other files in this
|
6
|
+
repository are provided to you under the following license (MIT):
|
7
|
+
|
8
|
+
Copyright (c) Daniel Lucraft 2011.
|
9
|
+
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
11
|
+
a copy of this software and associated documentation files (the
|
12
|
+
'Software'), to deal in the Software without restriction, including
|
13
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
14
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
15
|
+
permit persons to whom the Software is furnished to do so, subject to
|
16
|
+
the following conditions:
|
17
|
+
|
18
|
+
The above copyright notice and this permission notice shall be
|
19
|
+
included in all copies or substantial portions of the Software.
|
20
|
+
|
21
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
22
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
23
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
24
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
25
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
26
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
27
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
|
2
|
+
SWT
|
3
|
+
===
|
4
|
+
|
5
|
+
This gem contains the SWT jars needed to run SWT applications.
|
6
|
+
|
7
|
+
## Example
|
8
|
+
|
9
|
+
Linux / windows:
|
10
|
+
|
11
|
+
jruby examples/button.rb
|
12
|
+
|
13
|
+
On OSX:
|
14
|
+
|
15
|
+
jruby -J-XstartOnFirstThread examples/button.rb
|
16
|
+
|
17
|
+
## Usage
|
18
|
+
|
19
|
+
require 'java'
|
20
|
+
require 'swt'
|
data/lib/swt.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
|
2
|
+
module Cucumber
|
3
|
+
module Ast
|
4
|
+
class StepInvocation #:nodoc:#
|
5
|
+
class << self
|
6
|
+
attr_accessor :wait_time
|
7
|
+
end
|
8
|
+
|
9
|
+
def invoke_with_swt(step_mother, options)
|
10
|
+
block = Swt::RRunnable.new { invoke_without_swt(step_mother, options) }
|
11
|
+
|
12
|
+
Redcar::ApplicationSWT.display.syncExec(block)
|
13
|
+
sleep ENV["SLOW_CUKES"].to_f if ENV["SLOW_CUKES"]
|
14
|
+
sleep(Cucumber::Ast::StepInvocation.wait_time || 0)
|
15
|
+
Cucumber::Ast::StepInvocation.wait_time = nil
|
16
|
+
end
|
17
|
+
|
18
|
+
alias_method :invoke_without_swt, :invoke
|
19
|
+
alias_method :invoke, :invoke_with_swt
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
module Cli
|
24
|
+
class Configuration
|
25
|
+
def require_dirs_with_redcar_plugins
|
26
|
+
require_dirs_without_redcar_plugins + Dir['plugins/*/features']
|
27
|
+
end
|
28
|
+
|
29
|
+
alias_method :require_dirs_without_redcar_plugins, :require_dirs
|
30
|
+
alias_method :require_dirs, :require_dirs_with_redcar_plugins
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Swt
|
2
|
+
class CucumberRunner
|
3
|
+
START_DELAY = 1
|
4
|
+
|
5
|
+
def run_features(args)
|
6
|
+
require "cucumber/cli/main"
|
7
|
+
require "cucumber"
|
8
|
+
require "cucumber/rb_support/rb_language"
|
9
|
+
require "swt/cucumber_patches"
|
10
|
+
Thread.new do
|
11
|
+
begin
|
12
|
+
sleep START_DELAY
|
13
|
+
main = Cucumber::Cli::Main.new(args)
|
14
|
+
main.execute!
|
15
|
+
Redcar.app.quit
|
16
|
+
rescue Object => e
|
17
|
+
puts e.message
|
18
|
+
puts e.backtrace
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
|
2
|
+
module Swt
|
3
|
+
class EventLoop
|
4
|
+
def initialize
|
5
|
+
@running = false
|
6
|
+
end
|
7
|
+
|
8
|
+
# Begins the SWT event loop. Blocks.
|
9
|
+
def start
|
10
|
+
@running = true
|
11
|
+
@display = Swt.display
|
12
|
+
while @running and not @display.disposed?
|
13
|
+
unless read = @display.read_and_dispatch
|
14
|
+
@display.sleep
|
15
|
+
end
|
16
|
+
end
|
17
|
+
@display.dispose
|
18
|
+
end
|
19
|
+
|
20
|
+
# Lets the even loop run until block returns false
|
21
|
+
def yield_until
|
22
|
+
@display.read_and_dispatch until yield
|
23
|
+
end
|
24
|
+
|
25
|
+
# Halts the SWT event loop.
|
26
|
+
def stop
|
27
|
+
@running = false
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/lib/swt/full.rb
ADDED
@@ -0,0 +1,117 @@
|
|
1
|
+
|
2
|
+
module Swt
|
3
|
+
import org.eclipse.swt.SWT
|
4
|
+
|
5
|
+
module Widgets
|
6
|
+
import org.eclipse.swt.widgets.Button
|
7
|
+
import org.eclipse.swt.widgets.Caret
|
8
|
+
import org.eclipse.swt.widgets.Combo
|
9
|
+
import org.eclipse.swt.widgets.Composite
|
10
|
+
import org.eclipse.swt.widgets.Event
|
11
|
+
import org.eclipse.swt.widgets.DirectoryDialog
|
12
|
+
import org.eclipse.swt.widgets.FileDialog
|
13
|
+
import org.eclipse.swt.widgets.List
|
14
|
+
import org.eclipse.swt.widgets.Menu
|
15
|
+
import org.eclipse.swt.widgets.MenuItem
|
16
|
+
import org.eclipse.swt.widgets.MessageBox
|
17
|
+
import org.eclipse.swt.widgets.ToolBar
|
18
|
+
import org.eclipse.swt.widgets.ToolItem
|
19
|
+
import org.eclipse.swt.widgets.CoolBar
|
20
|
+
import org.eclipse.swt.widgets.CoolItem
|
21
|
+
import org.eclipse.swt.widgets.Sash
|
22
|
+
import org.eclipse.swt.widgets.Slider
|
23
|
+
import org.eclipse.swt.widgets.TabFolder
|
24
|
+
import org.eclipse.swt.widgets.TabItem
|
25
|
+
import org.eclipse.swt.widgets.Text
|
26
|
+
import org.eclipse.swt.widgets.ToolTip
|
27
|
+
import org.eclipse.swt.widgets.Table
|
28
|
+
import org.eclipse.swt.widgets.TableItem
|
29
|
+
end
|
30
|
+
|
31
|
+
module Custom
|
32
|
+
import org.eclipse.swt.custom.CTabFolder
|
33
|
+
import org.eclipse.swt.custom.CTabItem
|
34
|
+
import org.eclipse.swt.custom.SashForm
|
35
|
+
import org.eclipse.swt.custom.StackLayout
|
36
|
+
import org.eclipse.swt.custom.ST
|
37
|
+
import org.eclipse.swt.custom.StyleRange
|
38
|
+
import org.eclipse.swt.custom.StyledText
|
39
|
+
import org.eclipse.swt.custom.TreeEditor
|
40
|
+
end
|
41
|
+
|
42
|
+
module DND
|
43
|
+
import org.eclipse.swt.dnd.DND
|
44
|
+
|
45
|
+
# Only load Clipboard in full running mode.
|
46
|
+
import org.eclipse.swt.dnd.Clipboard
|
47
|
+
|
48
|
+
import org.eclipse.swt.dnd.Transfer
|
49
|
+
import org.eclipse.swt.dnd.TextTransfer
|
50
|
+
import org.eclipse.swt.dnd.FileTransfer
|
51
|
+
import org.eclipse.swt.dnd.ByteArrayTransfer
|
52
|
+
|
53
|
+
import org.eclipse.swt.dnd.DropTarget
|
54
|
+
import org.eclipse.swt.dnd.DropTargetEvent
|
55
|
+
import org.eclipse.swt.dnd.DropTargetListener
|
56
|
+
|
57
|
+
import org.eclipse.swt.dnd.DragSource
|
58
|
+
import org.eclipse.swt.dnd.DragSourceEvent
|
59
|
+
import org.eclipse.swt.dnd.DragSourceListener
|
60
|
+
end
|
61
|
+
|
62
|
+
module Layout
|
63
|
+
import org.eclipse.swt.layout.FillLayout
|
64
|
+
import org.eclipse.swt.layout.GridLayout
|
65
|
+
import org.eclipse.swt.layout.GridData
|
66
|
+
import org.eclipse.swt.layout.RowLayout
|
67
|
+
import org.eclipse.swt.layout.RowData
|
68
|
+
end
|
69
|
+
|
70
|
+
module Graphics
|
71
|
+
import org.eclipse.swt.graphics.Color
|
72
|
+
import org.eclipse.swt.graphics.Device
|
73
|
+
import org.eclipse.swt.graphics.Font
|
74
|
+
import org.eclipse.swt.graphics.GC
|
75
|
+
import org.eclipse.swt.graphics.Point
|
76
|
+
import org.eclipse.swt.graphics.RGB
|
77
|
+
end
|
78
|
+
|
79
|
+
module Events
|
80
|
+
import org.eclipse.swt.events.KeyEvent
|
81
|
+
import org.eclipse.swt.events.MouseListener
|
82
|
+
import org.eclipse.swt.events.MouseTrackListener
|
83
|
+
end
|
84
|
+
|
85
|
+
import org.eclipse.swt.browser.Browser
|
86
|
+
class Browser
|
87
|
+
import org.eclipse.swt.browser.BrowserFunction
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
module JFace
|
92
|
+
Dir[File.dirname(__FILE__) + "/../../vendor/jface/*.jar"].each do |jar_fn|
|
93
|
+
require jar_fn
|
94
|
+
end
|
95
|
+
|
96
|
+
module Viewers
|
97
|
+
import org.eclipse.jface.viewers.ColumnViewerToolTipSupport
|
98
|
+
import org.eclipse.jface.viewers.TreeViewer
|
99
|
+
import org.eclipse.jface.viewers.ITreeContentProvider
|
100
|
+
import org.eclipse.jface.viewers.ILabelProvider
|
101
|
+
import org.eclipse.jface.viewers.ILazyTreeContentProvider
|
102
|
+
import org.eclipse.jface.viewers.ILabelProvider
|
103
|
+
import org.eclipse.jface.viewers.TextCellEditor
|
104
|
+
import org.eclipse.jface.viewers.ViewerDropAdapter
|
105
|
+
end
|
106
|
+
|
107
|
+
module Text
|
108
|
+
import org.eclipse.jface.text.TextViewerUndoManager
|
109
|
+
end
|
110
|
+
|
111
|
+
module Dialogs
|
112
|
+
import org.eclipse.jface.dialogs.Dialog
|
113
|
+
import org.eclipse.jface.dialogs.InputDialog
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
require 'swt/grid_data'
|
data/lib/swt/jar.rb
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'rbconfig'
|
2
|
+
|
3
|
+
module Swt
|
4
|
+
def self.jar_path
|
5
|
+
case Config::CONFIG["host_os"]
|
6
|
+
when /darwin/i
|
7
|
+
if Config::CONFIG["host_cpu"] == "x86_64"
|
8
|
+
'../vendor/swt_osx64'
|
9
|
+
else
|
10
|
+
'../vendor/swt_osx'
|
11
|
+
end
|
12
|
+
when /linux/i
|
13
|
+
if %w(amd64 x84_64).include? Config::CONFIG["host_cpu"]
|
14
|
+
'../vendor/swt_linux64'
|
15
|
+
else
|
16
|
+
'../vendor/swt_linux'
|
17
|
+
end
|
18
|
+
when /windows|mswin/i
|
19
|
+
'../vendor/swt_win32'
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
path = File.expand_path(File.dirname(__FILE__) + "/../" + Swt.jar_path)
|
24
|
+
if File.exist?(path + ".jar")
|
25
|
+
puts "loading #{Swt.jar_path}"
|
26
|
+
require path
|
27
|
+
else
|
28
|
+
puts "SWT jar file required: #{path}.jar"
|
29
|
+
exit
|
30
|
+
end
|
31
|
+
end
|
data/lib/swt/minimal.rb
ADDED
@@ -0,0 +1,79 @@
|
|
1
|
+
|
2
|
+
require 'swt/jar'
|
3
|
+
require 'swt/event_loop'
|
4
|
+
|
5
|
+
module Swt
|
6
|
+
VERSION = "0.1"
|
7
|
+
|
8
|
+
import org.eclipse.swt.SWT
|
9
|
+
|
10
|
+
module Widgets
|
11
|
+
import org.eclipse.swt.widgets.Display
|
12
|
+
import org.eclipse.swt.widgets.Label
|
13
|
+
import org.eclipse.swt.widgets.ProgressBar
|
14
|
+
import org.eclipse.swt.widgets.Shell
|
15
|
+
end
|
16
|
+
|
17
|
+
module Custom
|
18
|
+
end
|
19
|
+
|
20
|
+
module DND
|
21
|
+
end
|
22
|
+
|
23
|
+
module Layout
|
24
|
+
import org.eclipse.swt.layout.FormAttachment
|
25
|
+
import org.eclipse.swt.layout.FormData
|
26
|
+
import org.eclipse.swt.layout.FormLayout
|
27
|
+
end
|
28
|
+
|
29
|
+
module Graphics
|
30
|
+
import org.eclipse.swt.graphics.Image
|
31
|
+
end
|
32
|
+
|
33
|
+
module Events
|
34
|
+
end
|
35
|
+
|
36
|
+
class RRunnable
|
37
|
+
include java.lang.Runnable
|
38
|
+
|
39
|
+
def initialize(&block)
|
40
|
+
@block = block
|
41
|
+
end
|
42
|
+
|
43
|
+
def run
|
44
|
+
@block.call
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
# Runs the given block in the SWT Event thread
|
49
|
+
def self.sync_exec(&block)
|
50
|
+
runnable = Swt::RRunnable.new do
|
51
|
+
begin
|
52
|
+
block.call
|
53
|
+
rescue => e
|
54
|
+
puts "error in sync exec"
|
55
|
+
puts e.message
|
56
|
+
puts e.backtrace
|
57
|
+
end
|
58
|
+
end
|
59
|
+
unless display.is_disposed
|
60
|
+
display.syncExec(runnable)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
# Runs the given block in the SWT Event thread after
|
65
|
+
# the given number of milliseconds
|
66
|
+
def self.timer_exec(ms, &block)
|
67
|
+
runnable = Swt::RRunnable.new(&block)
|
68
|
+
display.timerExec(ms, runnable)
|
69
|
+
end
|
70
|
+
|
71
|
+
def self.display
|
72
|
+
if defined?(SWT_APP_NAME)
|
73
|
+
Swt::Widgets::Display.app_name = SWT_APP_NAME
|
74
|
+
end
|
75
|
+
@display ||= (Swt::Widgets::Display.getCurrent || Swt::Widgets::Display.new)
|
76
|
+
end
|
77
|
+
|
78
|
+
display # must be created before we import the Clipboard class.
|
79
|
+
end
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/vendor/swt_osx.jar
ADDED
Binary file
|
Binary file
|
Binary file
|
metadata
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: swt
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: "0.1"
|
6
|
+
platform: java
|
7
|
+
authors:
|
8
|
+
- Daniel Lucraft
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2011-06-07 00:00:00 +01:00
|
14
|
+
default_executable:
|
15
|
+
dependencies: []
|
16
|
+
|
17
|
+
description: Includes SWT jars and imports SWT classes into Ruby.
|
18
|
+
email:
|
19
|
+
- dan@fluentradical.com
|
20
|
+
executables: []
|
21
|
+
|
22
|
+
extensions: []
|
23
|
+
|
24
|
+
extra_rdoc_files: []
|
25
|
+
|
26
|
+
files:
|
27
|
+
- lib/swt.rb
|
28
|
+
- lib/swt/cucumber_patches.rb
|
29
|
+
- lib/swt/cucumber_runner.rb
|
30
|
+
- lib/swt/event_loop.rb
|
31
|
+
- lib/swt/full.rb
|
32
|
+
- lib/swt/grid_data.rb
|
33
|
+
- lib/swt/jar.rb
|
34
|
+
- lib/swt/minimal.rb
|
35
|
+
- LICENSE
|
36
|
+
- README.md
|
37
|
+
- vendor/jface/org.eclipse.core.commands.jar
|
38
|
+
- vendor/jface/org.eclipse.core.jobs.jar
|
39
|
+
- vendor/jface/org.eclipse.core.resources.jar
|
40
|
+
- vendor/jface/org.eclipse.core.runtime_3.5.0.v20090525.jar
|
41
|
+
- vendor/jface/org.eclipse.equinox.common.jar
|
42
|
+
- vendor/jface/org.eclipse.jface.databinding_1.3.0.I20090525-2000.jar
|
43
|
+
- vendor/jface/org.eclipse.jface.jar
|
44
|
+
- vendor/jface/org.eclipse.jface.text_3.5.0.jar
|
45
|
+
- vendor/jface/org.eclipse.osgi.jar
|
46
|
+
- vendor/jface/org.eclipse.text_3.5.0.v20090513-2000.jar
|
47
|
+
- vendor/swt_linux.jar
|
48
|
+
- vendor/swt_linux64.jar
|
49
|
+
- vendor/swt_osx.jar
|
50
|
+
- vendor/swt_osx64.jar
|
51
|
+
- vendor/swt_win32.jar
|
52
|
+
has_rdoc: true
|
53
|
+
homepage: http://github.com/danlucraft/swt
|
54
|
+
licenses: []
|
55
|
+
|
56
|
+
post_install_message:
|
57
|
+
rdoc_options: []
|
58
|
+
|
59
|
+
require_paths:
|
60
|
+
- lib
|
61
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
62
|
+
none: false
|
63
|
+
requirements:
|
64
|
+
- - ">="
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: "0"
|
67
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
68
|
+
none: false
|
69
|
+
requirements:
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: "0"
|
73
|
+
requirements: []
|
74
|
+
|
75
|
+
rubyforge_project:
|
76
|
+
rubygems_version: 1.5.1
|
77
|
+
signing_key:
|
78
|
+
specification_version: 3
|
79
|
+
summary: The SWT library available to JRuby.
|
80
|
+
test_files: []
|
81
|
+
|