Example usage for javax.mail.event FolderEvent DELETED

List of usage examples for javax.mail.event FolderEvent DELETED

Introduction

In this page you can find the example usage for javax.mail.event FolderEvent DELETED.

Prototype

int DELETED

To view the source code for javax.mail.event FolderEvent DELETED.

Click Source Link

Document

The folder was deleted.

Usage

From source file:org.sourceforge.net.javamail4ews.store.EwsFolder.java

@Override
public boolean delete(boolean recurse) throws MessagingException {
    if (isOpen()) {
        throw new IllegalStateException("Folder not closed!");
    }//from  w  ww.j  a va 2 s  . c om
    try {
        if (recurse) {
            for (javax.mail.Folder aFolder : list()) {
                aFolder.delete(recurse);
            }
        } else {
            // Simplest approach
            if (getMessageCount() > 0) {
                return false;
            }
        }

        folder.delete(DELETE_MODE);
        notifyFolderListeners(FolderEvent.DELETED);
        return true;
    } catch (Exception e) {
        throw new MessagingException(e.getMessage(), e);
    }
}