List<DestinationConfigTreeNode> nodes = getSelectedDestinationNodes();
if (nodes.size() > 0) {
final DestinationConfigTreeNode destinationNode = nodes.get(0);
final HermesTreeNode hermesNode = getSelectedHermesNode();
if (hermesNode != null && destinationNode != null) {
Collection<Message> selected = messages.getSelectedMessages();
Message[] messagesArray = messages.getSelectedMessages().toArray(new Message[selected.size()]);
if (selected.size() == 1 && action == TransferHandler.COPY && MessageEditorDialog.canEdit(messagesArray[0])) {
try {
Message message = selected.iterator().next();
MessageEditorDialog dialog = new MessageEditorDialog(message, destinationNode.getDestinationName(), destinationNode.getDomain(),
new AbstractEditedMessageHandler(hermesNode.getHermes()) {
@Override
public void onMessage(Message message) {
HermesBrowser
.getBrowser()
.getActionFactory()
.createMessageCopyAction(hermesNode.getHermes(), destinationNode.getDestinationName(),
destinationNode.getDomain(), new ArrayList(Arrays.asList(message)), false, true);
}
});
dialog.setLocationRelativeTo(HermesBrowser.getBrowser());
dialog.setVisible(true);
} catch (JMSException ex) {
HermesBrowser.getBrowser().showErrorDialog(ex);
}
} else {
if (action == TransferHandler.COPY) {
HermesBrowser
.getBrowser()
.getActionFactory()
.createMessageCopyAction(hermesNode.getHermes(), destinationNode.getDestinationName(), destinationNode.getDomain(), selected,
true, true);
} else {
HermesBrowser.getBrowser().getActionFactory()
.createMessageMoveAction(hermesNode.getHermes(), destinationNode.getDestinationName(), destinationNode.getDomain(), selected);
}
}
}
} else {
if (getSelectionPath() != null) {