glimmer-dsl-swt 0.3.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1b818d6b949f1a1c4388ecad2f9d6f425afbdf0c772a99031c2ea1cf1276dc1c
4
- data.tar.gz: 7f9f78326e9a083b170f9606bfb7337963bda57c4648e7f585c435747f77e94a
3
+ metadata.gz: d9125e62ffb8b2d214ba60942f71052d615ab2c875c3d436f1a1260252b67ade
4
+ data.tar.gz: 8d756fc26f9cd2eb30232e546ff49a1736ad8831bf0cb179dfab36cb60828d05
5
5
  SHA512:
6
- metadata.gz: e56deeff2d43d47a8e875ed1e32ba54f6cca9398053afdd5351257a2b0da3326384412635cf0c41529e8d961abab5de32d69cc5b6e23e67f1ebec23bb372b174
7
- data.tar.gz: 49dc96a0dc0921bac9b0cd048d9e33d1436dffa09b4bcb48704f162a30209c52209b3ca03318c89e7277835e682821ec89fb4f32f9c26218fb8ed1812a340dcb
6
+ metadata.gz: b7c40f5d85005f1c8a2de46c36ef9b734e3b21e83dc06f775afde6d564562350117fd76b673d1124273352ee9d1e520db6611bdbb6d268197989ed847776389f
7
+ data.tar.gz: 8076087a4567e24823ad85ebec3326b6e0446fc17b4e268c34afb9152389f9095a4fef8629df516cd2e0ca95afefeeb9676d46b8e1848a53b6ab4ce2d43363e8
data/README.md CHANGED
@@ -1,7 +1,8 @@
1
- # <img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 /> Glimmer DSL for SWT 0.3.0 (Desktop GUI)
1
+ # [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for SWT 0.5.1 (Desktop GUI)
2
2
  [![Gem Version](https://badge.fury.io/rb/glimmer-dsl-swt.svg)](http://badge.fury.io/rb/glimmer-dsl-swt)
3
3
  [![Travis CI](https://travis-ci.com/AndyObtiva/glimmer-dsl-swt.svg?branch=master)](https://travis-ci.com/github/AndyObtiva/glimmer-dsl-swt)
4
4
  [![Coverage Status](https://coveralls.io/repos/github/AndyObtiva/glimmer-dsl-swt/badge.svg?branch=master)](https://coveralls.io/github/AndyObtiva/glimmer-dsl-swt?branch=master)
5
+ [![Maintainability](https://api.codeclimate.com/v1/badges/aaf1cba142dd351f84bd/maintainability)](https://codeclimate.com/github/AndyObtiva/glimmer-dsl-swt/maintainability)
5
6
  [![Join the chat at https://gitter.im/AndyObtiva/glimmer](https://badges.gitter.im/AndyObtiva/glimmer.svg)](https://gitter.im/AndyObtiva/glimmer?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
6
7
 
7
8
  [Glimmer](https://github.com/AndyObtiva/glimmer) DSL for [SWT](https://www.eclipse.org/swt/) enables desktop development with [Glimmer](https://github.com/AndyObtiva/glimmer).
@@ -66,5 +67,11 @@ These features have been suggested. You might see them in a future version of Gl
66
67
 
67
68
  ## License
68
69
 
69
- Copyright (c) 2020 Andy Maleh.
70
- See LICENSE.txt for further details.
70
+ [MIT](https://opensource.org/licenses/MIT)
71
+
72
+ Copyright (c) 2020 - Andy Maleh.
73
+ See [LICENSE.txt](LICENSE.txt) for further details.
74
+
75
+ --
76
+
77
+ [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=40 />](https://github.com/AndyObtiva/glimmer) Built for [Glimmer](https://github.com/AndyObtiva/glimmer) (Ruby Desktop Development GUI Library).
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.0
1
+ 0.5.1
@@ -21,6 +21,94 @@ module Glimmer
21
21
  @@import_swt_packages = DEFAULT_IMPORT_SWT_PACKAGES if !defined?(@@import_swt_packages) || (defined?(@@import_swt_packages) && @@import_swt_packages == true)
22
22
  @@import_swt_packages
23
23
  end
24
+
25
+ # Returns Logging Devices. Default is [:stdout, :syslog]
26
+ def logging_devices
27
+ unless defined? @@logging_devices
28
+ @@logging_devices = [:stdout, :syslog]
29
+ end
30
+ @@logging_devices
31
+ end
32
+
33
+ # Logging Devices is an array of these possible values: :stdout (default), :stderr, :file, :syslog (default), :stringio
34
+ def logging_devices=(devices)
35
+ @@logging_devices = devices
36
+ reset_logger!
37
+ end
38
+
39
+ def logging_device_file_options
40
+ @@logging_device_file_options = {size: 1_000_000, age: 'daily', roll_by: 'number'} unless defined? @@logging_device_file_options
41
+ @@logging_device_file_options
42
+ end
43
+
44
+ def logging_device_file_options=(custom_options)
45
+ @@logging_device_file_options = custom_options
46
+ reset_logger!
47
+ end
48
+
49
+ def logging_appender_options
50
+ @@logging_appender_options = {async: true, auto_flushing: 500, write_size: 500, flush_period: 60, immediate_at: [:error, :fatal], layout: logging_layout} unless defined? @@logging_appender_options
51
+ @@logging_appender_options
52
+ end
53
+
54
+ def logging_appender_options=(custom_options)
55
+ @@logging_appender_options = custom_options
56
+ reset_logger!
57
+ end
58
+
59
+ def logging_layout
60
+ unless defined? @@logging_layout
61
+ @@logging_layout = Logging.layouts.pattern(
62
+ pattern: '[%d] %-5l %c: %m\n',
63
+ date_pattern: '%Y-%m-%d %H:%M:%S'
64
+ )
65
+ end
66
+ @@logging_layout
67
+ end
68
+
69
+ def logging_layout=(custom_layout)
70
+ @@logging_layout = custom_layout
71
+ reset_logger!
72
+ end
73
+
74
+ def reset_logger!
75
+ @first_time = !defined?(@@logger)
76
+ old_level = logger.level unless @first_time
77
+ self.logger = Logging.logger['glimmer'].tap do |logger|
78
+ logger.level = old_level || :error
79
+ appenders = []
80
+ appenders << Logging.appenders.stdout(logging_appender_options) if logging_devices.include?(:stdout)
81
+ appenders << Logging.appenders.stderr(logging_appender_options) if logging_devices.include?(:stderr)
82
+ if logging_devices.include?(:file)
83
+ require 'fileutils'
84
+ FileUtils.mkdir_p('log')
85
+ appenders << Logging.appenders.rolling_file('log/glimmer.log', logging_appender_options.merge(logging_device_file_options)) if logging_devices.include?(:file)
86
+ end
87
+ if Object.const_defined?(:Syslog) && logging_devices.include?(:syslog)
88
+ Syslog.close if Syslog.opened?
89
+ appenders << Logging.appenders.syslog('glimmer', logging_appender_options)
90
+ end
91
+ logger.appenders = appenders
92
+ end
93
+ end
24
94
  end
25
95
  end
26
96
  end
97
+
98
+ Glimmer::Config.reset_logger!
99
+ if ENV['GLIMMER_LOGGER_LEVEL']
100
+ # if glimmer log level is being overridden for debugging purposes, then disable async logging making logging immediate
101
+ Glimmer::Config.logging_appender_options = Glimmer::Config.logging_appender_options.merge(async: false, auto_flushing: 1)
102
+ Glimmer::Config.logging_devices = [:stdout]
103
+ Glimmer::Config.logger.level = ENV['GLIMMER_LOGGER_LEVEL']
104
+ end
105
+ Glimmer::Config.excluded_keyword_checkers << lambda do |method_symbol, *args|
106
+ method = method_symbol.to_s
107
+ result = false
108
+ result ||= method.start_with?('on_swt_') && is_a?(Glimmer::UI::CustomWidget) && respond_to?(method)
109
+ result ||= method == 'dispose' && is_a?(Glimmer::UI::CustomWidget) && respond_to?(method)
110
+ result ||= ['drag_source_proxy', 'drop_target_proxy'].include?(method) && is_a?(Glimmer::UI::CustomWidget)
111
+ result ||= method == 'post_initialize_child'
112
+ result ||= method.end_with?('=')
113
+ result ||= ['finish_edit!', 'search', 'all_tree_items', 'depth_first_search'].include?(method) && is_a?(Glimmer::UI::CustomWidget) && body_root.respond_to?(method)
114
+ end
@@ -6,9 +6,10 @@ if ENV['BUNDLER_REQUIRE'].to_s.downcase == 'true'
6
6
  require 'bundler'
7
7
  Bundler.require
8
8
  else
9
+ require 'glimmer'
10
+ require 'logging'
9
11
  require 'nested_inherited_jruby_include_package'
10
12
  require 'super_module'
11
- require 'glimmer'
12
13
  end
13
14
 
14
15
  # Internal requires
@@ -23,16 +23,18 @@ module Glimmer
23
23
  @table.body_root.column_properties = @column_properties
24
24
  end
25
25
  call(@model_binding.evaluate_property)
26
- observe(model_binding)
26
+ @table_observer_registration = observe(model_binding)
27
27
  @table.on_widget_disposed do |dispose_event|
28
28
  unregister_all_observables
29
29
  end
30
30
  end
31
31
 
32
32
  def call(new_model_collection=nil)
33
- new_model_collection = @model_binding.evaluate_property # this ensures applying converters (e.g. :on_read)
33
+ new_model_collection = @model_binding.evaluate_property # this ensures applying converters (e.g. :on_read)
34
34
  if new_model_collection and new_model_collection.is_a?(Array)
35
- observe(new_model_collection, @column_properties)
35
+ @table_items_observer_registration&.unobserve
36
+ @table_items_observer_registration = observe(new_model_collection, @column_properties)
37
+ add_dependent(@table_observer_registration => @table_items_observer_registration)
36
38
  @model_collection = new_model_collection
37
39
  end
38
40
  populate_table(@model_collection, @table, @column_properties)
@@ -41,6 +43,7 @@ module Glimmer
41
43
  def populate_table(model_collection, parent, column_properties)
42
44
  selected_table_item_models = parent.swt_widget.getSelection.map(&:getData)
43
45
  parent.finish_edit!
46
+ parent.swt_widget.items.each(&:dispose)
44
47
  parent.swt_widget.removeAll
45
48
  model_collection.each do |model|
46
49
  table_item = TableItem.new(parent.swt_widget, SWT::SWTProxy[:none])
@@ -52,6 +55,7 @@ module Glimmer
52
55
  selected_table_items = parent.search {|item| selected_table_item_models.include?(item.getData) }
53
56
  selected_table_items = [parent.swt_widget.getItems.first].to_java(TableItem) if selected_table_items.empty? && !parent.swt_widget.getItems.empty?
54
57
  parent.swt_widget.setSelection(selected_table_items) unless selected_table_items.empty?
58
+ parent.sort
55
59
  end
56
60
  end
57
61
  end
@@ -41,10 +41,9 @@ module Glimmer
41
41
  old_tree_items = parent.all_tree_items
42
42
  old_tree_item_expansion_by_data = old_tree_items.reduce({}) {|hash, ti| hash.merge(ti.getData => ti.getExpanded)}
43
43
  old_tree_items.each do |tree_item|
44
- tree_item.getData('observer_registrations').each do |key, observer_registration|
45
- observer_registration.unregister
46
- end
44
+ tree_item.getData('observer_registrations').each(&:unregister)
47
45
  end
46
+ parent.swt_widget.items.each(&:dispose)
48
47
  parent.swt_widget.removeAll
49
48
  populate_tree_node(model_tree_root_node, parent.swt_widget, tree_properties)
50
49
  parent.all_tree_items.each { |ti| ti.setExpanded(!!old_tree_item_expansion_by_data[ti.getData]) }
@@ -54,10 +53,9 @@ module Glimmer
54
53
 
55
54
  def populate_tree_node(model_tree_node, parent, tree_properties)
56
55
  return if model_tree_node.nil?
57
- # TODO anticipate default tree properties if none were passed (like literal values text and children)
58
56
  tree_item = TreeItem.new(parent, SWT::SWTProxy[:none])
59
- observer_registrations = @tree_properties.reduce({}) do |hash, key_value_pair|
60
- hash.merge(key_value_pair.first => observe(model_tree_node, key_value_pair.last))
57
+ observer_registrations = @tree_properties.reduce([]) do |array, key_value_pair|
58
+ array + [observe(model_tree_node, key_value_pair.last)]
61
59
  end
62
60
  tree_item.setData('observer_registrations', observer_registrations)
63
61
  tree_item.setData(model_tree_node)
@@ -1,3 +1,4 @@
1
+
1
2
  require 'glimmer'
2
3
  require 'glimmer/dsl/expression'
3
4
  require 'glimmer/dsl/parent_expression'
@@ -20,7 +20,7 @@ module Glimmer
20
20
  end
21
21
 
22
22
  def interpret(parent, keyword, *args, &block)
23
- Glimmer::SWT::DisplayProxy.instance.send(exec_operation, &block)
23
+ Glimmer::SWT::DisplayProxy.instance.swt_display.send(exec_operation, &block)
24
24
  end
25
25
  end
26
26
  end
@@ -18,7 +18,7 @@ module Glimmer
18
18
  if parent.swt_widget.is_a?(TabFolder)
19
19
  return true
20
20
  else
21
- Glimmer::Config.logger&.error "tab_item widget may only be used directly under a tab_folder widget!"
21
+ Glimmer::Config.logger.error {"tab_item widget may only be used directly under a tab_folder widget!"}
22
22
  end
23
23
  end
24
24
  false
@@ -8,17 +8,17 @@ module Glimmer
8
8
  include_package 'org.eclipse.swt.widgets'
9
9
 
10
10
  def can_interpret?(parent, keyword, *args, &block)
11
- Glimmer::Config.logger&.debug "keyword starts with on_: #{keyword.start_with?('on_')}"
11
+ Glimmer::Config.logger.debug {"keyword starts with on_: #{keyword.start_with?('on_')}"}
12
12
  return false unless keyword.start_with?('on_')
13
13
  widget_or_display_parentage = parent.respond_to?(:swt_widget) || parent.is_a?(Glimmer::SWT::DisplayProxy)
14
- Glimmer::Config.logger&.debug "parent is a widget or display: #{widget_or_display_parentage}"
14
+ Glimmer::Config.logger.debug {"parent #{parent} is a widget or display: #{widget_or_display_parentage}"}
15
15
  return false unless widget_or_display_parentage
16
- Glimmer::Config.logger&.debug "block exists?: #{!block.nil?}"
16
+ Glimmer::Config.logger.debug {"block exists?: #{!block.nil?}"}
17
17
  raise Glimmer::Error, "Listener is missing block for keyword: #{keyword}" unless block_given?
18
- Glimmer::Config.logger&.debug "args are empty?: #{args.empty?}"
18
+ Glimmer::Config.logger.debug {"args are empty?: #{args.empty?}"}
19
19
  raise Glimmer::Error, "Invalid listener arguments for keyword: #{keyword}(#{args})" unless args.empty?
20
20
  result = parent.can_handle_observation_request?(keyword)
21
- Glimmer::Config.logger&.debug "can add listener? #{result}"
21
+ Glimmer::Config.logger.debug {"can add listener? #{result}"}
22
22
  raise Glimmer::Error, "Invalid listener keyword: #{keyword}" unless result
23
23
  true
24
24
  end
@@ -17,7 +17,7 @@ module Glimmer
17
17
  project_name = File.basename(File.expand_path('.'))
18
18
  if !File.exists?('config/warble.rb')
19
19
  puts 'Generating JAR configuration (config/warble.rb) to use with Warbler...'
20
- system('mkdir -p config')
20
+ FileUtils.mkdir_p('config')
21
21
  system('warble config')
22
22
  new_config = File.read('config/warble.rb').split("\n").inject('') do |output, line|
23
23
  if line.include?('config.dirs =')
@@ -36,7 +36,7 @@ module Glimmer
36
36
  end
37
37
 
38
38
  def jar
39
- system('mkdir -p dist')
39
+ FileUtils.mkdir_p('dist')
40
40
  puts "Generating JAR with Warbler..."
41
41
  system('warble')
42
42
  end
@@ -49,11 +49,13 @@ module Glimmer
49
49
  version = (File.read(version_file).strip if File.exists?(version_file) && File.file?(version_file)) rescue nil
50
50
  license_file = File.expand_path('./LICENSE.txt')
51
51
  license = (File.read(license_file).strip if File.exists?(license_file) && File.file?(license_file)) rescue nil
52
+ copyright = license.split("\n").first
52
53
  human_name = project_name.underscore.titlecase
53
- command = "javapackager -deploy -native -outdir packages -outfile \"#{project_name}\" -srcfiles \"dist/#{project_name}.jar\" -appclass JarMain -name \"#{human_name}\" -title \"#{human_name}\" -Bmac.CFBundleName=\"#{human_name}\" -Bmac.CFBundleIdentifier=\"org.#{project_name}.application.#{project_name}\" -Bmac.category=\"public.app-category.business\" "
54
+ command = "javapackager -deploy -native -outdir packages -outfile \"#{project_name}\" -srcfiles \"dist/#{project_name}.jar\" -appclass JarMain -name \"#{human_name}\" -title \"#{human_name}\" -Bmac.CFBundleName=\"#{human_name}\" -Bmac.CFBundleIdentifier=\"org.#{project_name}.application.#{project_name}\" -Bmac.category=\"public.app-category.business\" -BinstalldirChooser=true -Bvendor=\"#{human_name}\" -Bwin.menuGroup=\"#{human_name}\" -BsystemWide=#{OS.mac?} "
54
55
  command += " -BjvmOptions=-XstartOnFirstThread " if OS.mac?
55
56
  command += " -BappVersion=#{version} -Bmac.CFBundleVersion=#{version} " if version
56
57
  command += " -srcfiles LICENSE.txt -BlicenseFile=LICENSE.txt " if license
58
+ command += " -Bcopyright=\"#{copyright}\" " if copyright
57
59
  command += " #{javapackager_extra_args} " if javapackager_extra_args
58
60
  command += " #{ENV['JAVAPACKAGER_EXTRA_ARGS']} " if ENV['JAVAPACKAGER_EXTRA_ARGS']
59
61
  puts "Generating DMG/PKG/APP/JNLP with javapackager..."
@@ -33,57 +33,97 @@ namespace :glimmer do
33
33
  end
34
34
 
35
35
 
36
- desc 'Scaffold a Glimmer application directory structure to begin building a new app'
36
+ desc 'Scaffold Glimmer application directory structure to build a new app'
37
37
  task :scaffold, [:app_name] do |t, args|
38
38
  require_relative 'scaffold'
39
39
  Scaffold.app(args[:app_name])
40
40
  end
41
41
 
42
42
  namespace :scaffold do
43
- desc 'Scaffold a Glimmer::UI::CustomShell subclass (represents a full window view) under app/views (namespace is optional)'
44
- task :custom_shell, [:custom_shell_name, :namespace] do |t, args|
43
+ desc 'Scaffold Glimmer::UI::CustomShell subclass (full window view) under app/views (namespace is optional) [alt: scaffold:cs]'
44
+ task :customshell, [:name, :namespace] do |t, args|
45
45
  require_relative 'scaffold'
46
- Scaffold.custom_shell(args[:custom_shell_name], args[:namespace])
46
+ Scaffold.custom_shell(args[:name], args[:namespace])
47
47
  end
48
48
 
49
- desc 'Scaffold a Glimmer::UI::CustomWidget subclass (represents a part of a view) under app/views (namespace is optional)'
50
- task :custom_widget, [:custom_widget_name, :namespace] do |t, args|
51
- require_relative 'scaffold'
52
- Scaffold.custom_widget(args[:custom_widget_name], args[:namespace])
53
- end
49
+ task :cs, [:name, :namespace] => :customshell
50
+ task :custom_shell, [:name, :namespace] => :customshell
51
+ task :"custom-shell", [:name, :namespace] => :customshell
54
52
 
55
- desc 'Scaffold a Glimmer::UI::CustomShell subclass (represents a full window view) under its own Ruby gem + app project (namespace is required)'
56
- task :custom_shell_gem, [:custom_shell_name, :namespace] do |t, args|
53
+ desc 'Scaffold Glimmer::UI::CustomWidget subclass (part of a view) under app/views (namespace is optional) [alt: scaffold:cw]'
54
+ task :customwidget, [:name, :namespace] do |t, args|
57
55
  require_relative 'scaffold'
58
- Scaffold.custom_shell_gem(args[:custom_shell_name], args[:namespace])
56
+ Scaffold.custom_widget(args[:name], args[:namespace])
59
57
  end
60
58
 
61
- desc 'Scaffold a Glimmer::UI::CustomWidget subclass (represents a part of a view) under its own Ruby gem project (namespace is required)'
62
- task :custom_widget_gem, [:custom_widget_name, :namespace] do |t, args|
63
- require_relative 'scaffold'
64
- Scaffold.custom_widget_gem(args[:custom_widget_name], args[:namespace])
59
+ task :cw, [:name, :namespace] => :customwidget
60
+ task :custom_widget, [:name, :namespace] => :customwidget
61
+ task :"custom-widget", [:name, :namespace] => :customwidget
62
+
63
+ namespace :gem do
64
+ desc 'Scaffold Glimmer::UI::CustomShell subclass (full window view) under its own Ruby gem + app project (namespace is required) [alt: scaffold:gem:cs]'
65
+ task :customshell, [:name, :namespace] do |t, args|
66
+ require_relative 'scaffold'
67
+ Scaffold.custom_shell_gem(args[:name], args[:namespace])
68
+ end
69
+
70
+ task :cs, [:name, :namespace] => :customshell
71
+ task :custom_shell, [:name, :namespace] => :customshell
72
+ task :"custom-shell", [:name, :namespace] => :customshell
73
+
74
+ desc 'Scaffold Glimmer::UI::CustomWidget subclass (part of a view) under its own Ruby gem project (namespace is required) [alt: scaffold:gem:cw]'
75
+ task :customwidget, [:name, :namespace] do |t, args|
76
+ require_relative 'scaffold'
77
+ Scaffold.custom_widget_gem(args[:name], args[:namespace])
78
+ end
79
+
80
+ task :cw, [:name, :namespace] => :customwidget
81
+ task :custom_widget, [:name, :namespace] => :customwidget
82
+ task :"custom-widget", [:name, :namespace] => :customwidget
65
83
  end
84
+
85
+ # legacy support
86
+
87
+ task :custom_shell_gem, [:name, :namespace] => 'gem:customshell'
88
+ task :custom_widget_gem, [:name, :namespace] => 'gem:customwidget'
89
+
66
90
  end
67
91
 
68
92
  namespace :list do
69
93
  task :list_require do
70
94
  require_relative 'rake_task/list'
71
95
  end
72
-
73
- desc 'List Glimmer custom widget gems available at rubygems.org (query is optional)'
74
- task :custom_widget_gems, [:query] => :list_require do |t, args|
75
- Glimmer::RakeTask::List.custom_widget_gems(args[:query])
76
- end
77
96
 
78
- desc 'List Glimmer custom shell gems available at rubygems.org (query is optional)'
79
- task :custom_shell_gems, [:query] => :list_require do |t, args|
80
- Glimmer::RakeTask::List.custom_shell_gems(args[:query])
81
- end
97
+ namespace :gems do
98
+ desc 'List Glimmer custom widget gems available at rubygems.org (query is optional) [alt: list:gems:cw]'
99
+ task :customwidget, [:query] => :list_require do |t, args|
100
+ Glimmer::RakeTask::List.custom_widget_gems(args[:query])
101
+ end
102
+
103
+ task :cw, [:query] => :customwidget
104
+ task :custom_widget, [:query] => :customwidget
105
+ task :"custom-widget", [:query] => :customwidget
106
+
107
+ desc 'List Glimmer custom shell gems available at rubygems.org (query is optional) [alt: list:gems:cs]'
108
+ task :customshell, [:query] => :list_require do |t, args|
109
+ Glimmer::RakeTask::List.custom_shell_gems(args[:query])
110
+ end
111
+
112
+ task :cs, [:query] => :customshell
113
+ task :custom_shell, [:query] => :customshell
114
+ task :"custom-shell", [:query] => :customshell
115
+
116
+ desc 'List Glimmer DSL gems available at rubygems.org (query is optional)'
117
+ task :dsl, [:query] => :list_require do |t, args|
118
+ Glimmer::RakeTask::List.dsl_gems(args[:query])
119
+ end
82
120
 
83
- desc 'List Glimmer DSL gems available at rubygems.org (query is optional)'
84
- task :dsl_gems, [:query] => :list_require do |t, args|
85
- Glimmer::RakeTask::List.dsl_gems(args[:query])
86
121
  end
87
122
 
123
+ # legacy support
124
+
125
+ task :custom_shell_gems, [:name, :namespace] => 'gems:customshell'
126
+ task :custom_widget_gems, [:name, :namespace] => 'gems:customwidget'
127
+
88
128
  end
89
129
  end
@@ -48,6 +48,17 @@ module Glimmer
48
48
  end
49
49
  @swt_color
50
50
  end
51
+
52
+ def method_missing(method, *args, &block)
53
+ swt_color.send(method, *args, &block)
54
+ rescue => e
55
+ Glimmer::Config.logger.debug {"Neither ColorProxy nor #{swt_color.class.name} can handle the method ##{method}"}
56
+ super
57
+ end
58
+
59
+ def respond_to?(method, *args, &block)
60
+ super || swt_color.respond_to?(method, *args, &block)
61
+ end
51
62
  end
52
63
  end
53
64
  end
@@ -33,26 +33,24 @@ module Glimmer
33
33
 
34
34
  def initialize(*args)
35
35
  @swt_display = Display.new(*args)
36
+ @swt_display.set_data('proxy', self)
36
37
  end
37
38
 
38
- def dispose
39
- @swt_display.dispose
39
+ def method_missing(method, *args, &block)
40
+ swt_display.send(method, *args, &block)
41
+ rescue => e
42
+ Glimmer::Config.logger.debug {"Neither DisplayProxy nor #{swt_display.class.name} can handle the method ##{method}"}
43
+ super
40
44
  end
41
-
42
- # Executes code block asynchronously with respect to SWT UI thread
43
- def async_exec(&block)
44
- @swt_display.asyncExec(&block)
45
- end
46
-
47
- # Executes code block synchronously with respect to SWT UI thread
48
- def sync_exec(&block)
49
- @swt_display.syncExec(&block)
45
+
46
+ def respond_to?(method, *args, &block)
47
+ super || swt_display.respond_to?(method, *args, &block)
50
48
  end
51
49
 
52
50
  def can_handle_observation_request?(observation_request)
53
51
  observation_request = observation_request.to_s
54
- if observation_request.start_with?('on_event_')
55
- constant_name = observation_request.sub(/^on_event_/, '')
52
+ if observation_request.start_with?('on_swt_')
53
+ constant_name = observation_request.sub(/^on_swt_/, '')
56
54
  SWTProxy.has_constant?(constant_name)
57
55
  elsif observation_request.start_with?('on_')
58
56
  event_name = observation_request.sub(/^on_/, '')
@@ -63,8 +61,8 @@ module Glimmer
63
61
  end
64
62
 
65
63
  def handle_observation_request(observation_request, &block)
66
- if observation_request.start_with?('on_event_')
67
- constant_name = observation_request.sub(/^on_event_/, '')
64
+ if observation_request.start_with?('on_swt_')
65
+ constant_name = observation_request.sub(/^on_swt_/, '')
68
66
  add_swt_event_listener(constant_name, &block)
69
67
  elsif observation_request.start_with?('on_')
70
68
  event_name = observation_request.sub(/^on_/, '')