1 19 20 package org.netbeans.modules.apisupport.project.ui.platform; 21 22 import java.awt.BorderLayout ; 23 import java.awt.EventQueue ; 24 import java.lang.ref.WeakReference ; 25 import javax.swing.JFrame ; 26 import javax.swing.JLabel ; 27 import javax.swing.JPanel ; 28 import org.netbeans.modules.apisupport.project.TestBase; 29 import org.netbeans.modules.apisupport.project.universe.NbPlatform; 30 31 34 public class NbPlatformCustomizerSourcesTest extends TestBase { 35 36 private JFrame frame; 37 private NbPlatformCustomizerSources sourcesPane; 38 private JPanel outerPane; 39 private WeakReference sourcesPaneWR; 40 41 public NbPlatformCustomizerSourcesTest(String testName) { 42 super(testName); 43 } 44 45 public void testMemoryLeak_70032() throws Exception { 46 EventQueue.invokeAndWait(new Runnable () { 47 public void run() { 48 sourcesPane = new NbPlatformCustomizerSources(); 49 sourcesPaneWR = new WeakReference (sourcesPane); 50 sourcesPane.setPlatform(NbPlatform.getDefaultPlatform()); 51 52 outerPane = new JPanel (); 54 outerPane.add(sourcesPane); 55 56 frame = new JFrame ("testMemoryLeak_70032"); 57 frame.getContentPane().setLayout(new BorderLayout ()); 58 frame.getContentPane().add(outerPane, BorderLayout.CENTER); 59 frame.pack(); 60 frame.setVisible(true); 62 frame.getContentPane().remove(outerPane); 63 64 JLabel dummyFocusEater = new JLabel (); 66 frame.getContentPane().add(dummyFocusEater); 67 dummyFocusEater.requestFocus(); 68 frame.setVisible(false); 69 frame.dispose(); 70 } 71 }); 72 outerPane = null; 73 sourcesPane = null; 74 75 assertGC("GCing sourcesPane", sourcesPaneWR); 76 } 77 78 } 79 | Popular Tags |