public void delete(ContainerSelection _selection, IConfirmationListener _confirmationListener) { if (_selection.getSize() == 1) { Object obj = _selection.getValueAt(0); if (obj instanceof FIDPlaylistTreeNode) { FIDPlaylistTreeNode playlistTreeNode = (FIDPlaylistTreeNode) obj; FIDPlaylist playlist = playlistTreeNode.getPlaylist(); int confirmation = _confirmationListener.confirm( "Are you sure want to remove the " + playlist.getTitle() + " soup?", playlist); if (confirmation == IConfirmationListener.YES) { int index = _selection.getIndexAt(0); BasicContainerTreeNode containerTreeNode = (BasicContainerTreeNode) _selection.getContainer(); containerTreeNode.remove(index); if (playlist.getReferenceCount() == 0) { playlist.delete(); } DefaultTreeModel treeModel = playlistTreeNode.getTreeModel(); treeModel.nodesWereRemoved( containerTreeNode, new int[] {index}, new Object[] {playlistTreeNode}); SoupUtils.removeTransientSoupPlaylist(index - 1); } } } }
public synchronized void performSearch() throws ParseException { PlayerDatabase playerDatabase = myContext.getPlayerDatabase(); IPredicate predicate = getPredicate(); NodeFinder searcher = new NodeFinder(playerDatabase); FIDPlaylist searchPlaylist; if (predicate == null) { searchPlaylist = null; } else { searchPlaylist = searcher.findMatches(predicate.toString(), predicate, true); } showSearchResults(searchPlaylist); if (myLastSearchPlaylist != null && myLastSearchPlaylist.getReferenceCount() == 0) { myLastSearchPlaylist.delete(); } myLastSearchPlaylist = searchPlaylist; }