protected void doDelete()

in client/src/main/java/org/apache/hupa/client/activity/MessageListActivity.java [337:387]


    protected void doDelete(final List<Long> uids) {
        hc.showTopLoading("Deleting...");

        String fullName = null;
        if (pc.getWhere() instanceof FolderPlace) {
            fullName = ((FolderPlace) pc.getWhere()).getToken();
        } else {
            fullName = ((MessagePlace) pc.getWhere()).getTokenWrapper().getFolder();
        }

        DeleteMessageByUidRequest req = rf.deleteMessageByUidRequest();
        DeleteMessageByUidAction action = req.create(DeleteMessageByUidAction.class);
        ImapFolder f = req.create(ImapFolder.class);
        f.setFullName(fullName);
        action.setMessageUids(uids);
        action.setFolder(f);
        req.delete(action).fire(new Receiver<DeleteMessageResult>() {
            @Override
            public void onSuccess(DeleteMessageResult response) {
                antiSelectMessages(display.getSelectedMessages());
                display.refresh();
                hc.hideTopLoading();
                pc.goTo(new FolderPlace(folderName));
                eventBus.fireEvent(new RefreshFoldersEvent());
                for (Long uid : uids) {
                    removeMessage(uid);
                }
                display.getDataProvider().setFechMessagesResult(currentFechResult);
//                display.getGrid().getRowElement(0).scrollIntoView();
            }

            @Override
            public void onFailure(ServerFailure error) {
                hc.hideTopLoading();
                hc.showNotice("Error removing messages", 5000);
                super.onFailure(error);
            }

            private void removeMessage(Long uid) {
                List<Message> messages = currentFechResult.getMessages();
                int l = messages.size();
                for (int i = 0; i < l; i++){
                    Message m = messages.get(i);
                    if (m.getUid() == uid) {
                        messages.remove(i);
                        return;
                    }
                }
            }
        });
    }