lib/apps/objecttree.rb in sweetgui-0.0.3 vs lib/apps/objecttree.rb in sweetgui-0.0.4
- old
+ new
@@ -1,5 +1,8 @@
+# This file is an application of the SWT module. JRubyUtils::RubyObjectBrowser may be
+# used to show the contents of an object.
+#--
# The contents of this file are subject to the Mozilla Public License
# Version 1.1 (the "License"); you may not use this file except in
# compliance with the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
@@ -13,13 +16,12 @@
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Johannes Rudolph <johannes_rudolph@gmail.com>
-#require '../swt'
-
class Method
+ # get the name of the method
def name
method_field=Java::JavaClass.for_name('org.jruby.RubyMethod').declared_field('methodName')
method_field.accessible=true
Java::java_to_ruby(method_field.value(Java::ruby_to_java(self)))
end
@@ -34,12 +36,17 @@
res=File.expand_path(File.dirname(__FILE__)+"/../../"+o)
Image.new Display.getCurrent,res
end
end
+# some JRuby utilities
module JRubyUtils
+ # A Browser of objects for JRuby
+ #
+ # link:../docs/object-tree.jpg
class RubyObjectBrowser
class << self
+ # Builds a tree which shows the structure of the given object
def object_tree(object)
SWT::Builder.go do
shell "JRuby Object Viewer by JR - visit http://virtual-void.net" do
tree(:verticalFill=>true,:horizontalFill=>true) do
child do