public void rebuild ( ) { if ( TRACE ) { System . out . println ( "rebuilding bug tree model" ) ; } NewFilterFromBug . closeAll ( ) ; // If this thread is not interrupting a previous thread, set the paths // to be opened when the new tree is complete // If the thread is interrupting another thread, don't do this, because // you don't have the tree with the correct paths selected // As of now, it should be impossible to interrupt a rebuilding thread, // in another version this may change, so this if statement check is // left in, even though it should always be true. if ( rebuildingThread == null ) { setOldSelectedBugs ( ) ; } Debug . println ( "Please Wait called right before starting rebuild thread" ) ; mainFrame . acquireDisplayWait ( ) ; rebuildingThread = edu . umd . cs . findbugs . util . Util . runInDameonThread ( new Runnable ( ) { BugTreeModel newModel ; @ Override public void run ( ) { try { newModel = new BugTreeModel ( BugTreeModel . this ) ; newModel . listeners = listeners ; newModel . resetData ( ) ; newModel . bugSet . sortList ( ) ; } finally { rebuildingThread = null ; SwingUtilities . invokeLater ( ( ) -> { if ( newModel != null ) { JTree newTree = new JTree ( newModel ) ; newModel . tree = newTree ; mainFrame . mainFrameTree . newTree ( newTree , newModel ) ; mainFrame . releaseDisplayWait ( ) ; } getOffListenerList ( ) ; } ) ; } } } , "Rebuilding thread" ) ; }
Swaps in a new BugTreeModel and a new JTree