sendPacket(srch);
PacketFilter filter = new AndFilter(new PacketIDFilter(srch.getPacketID()),
new PacketTypeFilter(IQ.class));
PacketCollector packetCollector =
BuddyList.getInstance().getConnection().createPacketCollector(filter);
final IQ reply = (IQ) packetCollector.nextResult(SmackConfiguration.getPacketReplyTimeout());
if(reply == null)
{
SwingUtilities.invokeLater( new Runnable()
{
public void run()
{
wait.setVisible( false );
JOptionPane.showMessageDialog(SearchDialog.this,
resources.getString("searchRequestTimeout"),
resources.getString("searchError"),
JOptionPane.OK_OPTION);
}
});
}
else
{
SwingUtilities.invokeLater(new Runnable()
{
public void run()
{
wait.setVisible( false );
if( cancelled ) { return; }
// update results table with new data
resultsTableModel.setItems(((Search) reply).getItems());
resultsTableModel.fireTableStructureChanged();
resultsTableModel.fireTableDataChanged();
}
});
}
packetCollector.cancel();
}