1 19 20 package org.openide.explorer.view; 21 22 import java.awt.Dimension ; 23 import java.awt.EventQueue ; 24 import java.awt.event.ActionEvent ; 25 import java.lang.reflect.InvocationTargetException ; 26 import javax.swing.AbstractAction ; 27 import javax.swing.Action ; 28 import javax.swing.JFrame ; 29 import javax.swing.JScrollBar ; 30 import javax.swing.JScrollPane ; 31 import org.netbeans.junit.NbTestCase; 32 import org.openide.explorer.ExplorerManager; 33 import org.openide.nodes.AbstractNode; 34 import org.openide.nodes.Children; 35 import org.openide.nodes.FilterNode; 36 import org.openide.nodes.Node; 37 import org.openide.util.HelpCtx; 38 import org.openide.util.Lookup; 39 import org.openide.util.RequestProcessor; 40 import org.openide.util.actions.NodeAction; 41 import org.openide.util.actions.SystemAction; 42 43 47 public final class TreeView72765Test extends NbTestCase { 48 private TreeView ttv; 49 50 public TreeView72765Test(String testName) { 51 super(testName); 52 } 53 54 protected void setUp() throws Exception { 55 ttv = new BeanTreeView(); 56 } 57 58 protected boolean runInEQ() { 59 return true; 60 } 61 62 63 64 public void testRedrawWhenOtherThreadHasChildrenLock() throws InterruptedException { 65 66 class Block implements Runnable { 67 public synchronized void run() { 68 if (!Children.MUTEX.isWriteAccess()) { 69 Children.MUTEX.writeAccess(this); 70 return; 71 } 72 73 notifyAll(); 74 try { 75 wait(500); 76 } catch (InterruptedException ex) { 77 ex.printStackTrace(); 78 } 79 80 synchronized (ttv.getTreeLock()) { 81 } 82 } 83 } 84 85 86 Block block = new Block(); 87 RequestProcessor.Task t; 88 synchronized (block) { 89 t = RequestProcessor.getDefault().post(block); 90 block.wait(); 91 } 92 93 ttv.addNotify(); 94 95 assertNotNull("Initialize peer", ttv.getPeer()); 96 97 ttv.invalidate(); 98 ttv.validate(); 99 100 } 101 } 102 | Popular Tags |