blob: fb9d8bfee95d8b7ad772c6a9f5f4d864b8b148d0 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2012 EclipseSource Muenchen GmbH.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
******************************************************************************/
package org.eclipse.emf.emfstore.client.ui.errorreporting;
import java.util.ArrayList;
import java.util.List;
/**
* Class for logging exceptions.
*
* @author Maximilian Koegel
*/
public class ExceptionLog {
private List<Exception> exceptions;
private EmfStoreExceptionObserver exceptionObserver;
/**
* Constructor.
*
* @param exceptionObserver
* the exception that is used to notify this class when to add exceptions
*/
public ExceptionLog(EmfStoreExceptionObserver exceptionObserver) {
this.exceptions = new ArrayList<Exception>();
this.exceptionObserver = exceptionObserver;
exceptionObserver.addLog(this);
}
/**
* Adds and exception to the log.
*
* @param exception
* the exception to be added
*/
public void addException(Exception exception) {
exceptions.add(exception);
}
/**
* Destroys the exception log.
*
* @return the list of collected exceptions
*/
public List<Exception> destroy() {
exceptionObserver.removeLog(this);
return exceptions;
}
}