public void actionPerformed(ActionEvent arg0) {
final BrowserTree browserTree = HermesBrowser.getBrowser().getBrowserTree();
try {
if (browserTree.getSelectionPath().getLastPathComponent() instanceof DestinationConfigTreeNode) {
final DestinationConfigTreeNode destinationNode = (DestinationConfigTreeNode) browserTree.getSelectionPath().getLastPathComponent();
final HermesTreeNode hermesNode = (HermesTreeNode) destinationNode.getHermesTreeNode();
final BrowserAction browserAction = (BrowserAction) HermesBrowser.getBrowser().getDocumentPane().getActiveDocument();
if (browserAction != null) {
final Collection<Message> messages = browserAction.getSelectedMessages();
if (messages.size() > 0) {
final StringWriter selector = new StringWriter();
for (Iterator<Message> iter = messages.iterator(); iter.hasNext();) {
Message message = iter.next();
selector.append("JMSMessageID = '" + message.getJMSMessageID() + "' ");
selector.append("OR JMSCorrelationID = '" + message.getJMSMessageID() + "' ");
if (message.getJMSCorrelationID() != null) {
selector.append("OR JMSMessageID = '" + message.getJMSCorrelationID() + "' ");
selector.append("OR JMSCorrelationID = '" + message.getJMSCorrelationID() + "' ");
}
if (iter.hasNext()) {
selector.append(" OR ");
}
}
final DestinationConfig dConfig = HermesBrowser.getConfigDAO().duplicate(destinationNode.getConfig());
dConfig.setSelector(selector.toString());
HermesBrowser.getBrowser().getActionFactory().createQueueBrowseAction(hermesNode.getHermes(), dConfig);
}
}