diff options
Diffstat (limited to 'common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/command/AbstractSafeCommandExecutor.java')
-rw-r--r-- | common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/command/AbstractSafeCommandExecutor.java | 57 |
1 files changed, 0 insertions, 57 deletions
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/command/AbstractSafeCommandExecutor.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/command/AbstractSafeCommandExecutor.java deleted file mode 100644 index adc2abffa6..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/command/AbstractSafeCommandExecutor.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 Oracle. 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: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.command; - -import org.eclipse.jpt.common.utility.ExceptionHandler; -import org.eclipse.jpt.common.utility.command.Command; -import org.eclipse.jpt.common.utility.command.CommandExecutor; -import org.eclipse.jpt.common.utility.internal.StringTools; - -/** - * This command executor wraps another command executor and uses an exception - * handler to handle any exceptions thrown by an executing command. - */ -public abstract class AbstractSafeCommandExecutor<E extends CommandExecutor> - implements CommandExecutor -{ - protected final E commandExecutor; - protected final ExceptionHandler exceptionHandler; - - - /** - * <strong>NB:</strong> The default exception handler simply - * <em>ignores</em> any and all exceptions. - */ - protected AbstractSafeCommandExecutor(E commandExecutor) { - this(commandExecutor, ExceptionHandler.Null.instance()); - } - - protected AbstractSafeCommandExecutor(E commandExecutor, ExceptionHandler exceptionHandler) { - super(); - if ((commandExecutor == null) || (exceptionHandler == null)) { - throw new NullPointerException(); - } - this.commandExecutor = commandExecutor; - this.exceptionHandler = exceptionHandler; - } - - public void execute(Command command) { - try { - this.commandExecutor.execute(command); - } catch (RuntimeException ex) { - this.exceptionHandler.handleException(ex); - } - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.commandExecutor); - } -} |