Created
August 25, 2010 03:23
-
-
Save kattrali/548785 to your computer and use it in GitHub Desktop.
Testing the Disposal of SWT resources
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'java' | |
require 'swt.jar' | |
class SwtTest | |
include_package 'org.eclipse.swt.widgets' | |
import 'org.eclipse.swt.SWT' | |
def run | |
puts "Press Enter to Start" | |
#pause, in case you wan to attach a profiler | |
gets | |
display = Display.new | |
i = 0 | |
while true | |
shell = Shell.new(display) | |
shell.layout = org.eclipse.swt.layout.FormLayout.new | |
#shell.visible = true | |
menu_bar = Menu.new(shell, SWT::DROP_DOWN) | |
5.times do | |
menu = Menu.new(menu_bar) | |
(1..10).each do |j| | |
item_1 = MenuItem.new(menu, SWT::CASCADE) | |
item_1.text = "Item #{j}" | |
end | |
#menu.visible = true | |
end | |
shell.dispose | |
i = i+1 | |
if (i % 50) == 0 | |
puts i | |
puts "#{shell} <-- sample shell" | |
end | |
end | |
end | |
end | |
SwtTest.new.run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment