diff options
7 files changed, 205 insertions, 0 deletions
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/command/InterruptibleJobCommandAdapter.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/command/InterruptibleJobCommandAdapter.java new file mode 100644 index 0000000000..62891fb372 --- /dev/null +++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/command/InterruptibleJobCommandAdapter.java @@ -0,0 +1,32 @@ +/******************************************************************************* + * 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.core.internal.utility.command; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.jpt.common.core.utility.command.InterruptibleJobCommand; +import org.eclipse.jpt.common.utility.internal.ObjectTools; + +/** + * Convenience job command that does nothing. + */ +public class InterruptibleJobCommandAdapter + implements InterruptibleJobCommand +{ + public IStatus execute(IProgressMonitor monitor) throws InterruptedException { + return Status.OK_STATUS; + } + + @Override + public String toString() { + return ObjectTools.toString(this); + } +} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/command/JobCommandAdapter.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/command/JobCommandAdapter.java new file mode 100644 index 0000000000..f91c8a3c30 --- /dev/null +++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/command/JobCommandAdapter.java @@ -0,0 +1,32 @@ +/******************************************************************************* + * 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.core.internal.utility.command; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.jpt.common.core.utility.command.JobCommand; +import org.eclipse.jpt.common.utility.internal.ObjectTools; + +/** + * Convenience job command that does nothing. + */ +public class JobCommandAdapter + implements JobCommand +{ + public IStatus execute(IProgressMonitor monitor) { + return Status.OK_STATUS; + } + + @Override + public String toString() { + return ObjectTools.toString(this); + } +} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ExceptionHandlerAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ExceptionHandlerAdapter.java new file mode 100644 index 0000000000..c479a1eb24 --- /dev/null +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ExceptionHandlerAdapter.java @@ -0,0 +1,28 @@ +/******************************************************************************* + * 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; + +import org.eclipse.jpt.common.utility.ExceptionHandler; + +/** + * Convenience exception handler that does nothing. + */ +public class ExceptionHandlerAdapter + implements ExceptionHandler +{ + public void handleException(Throwable t) { + // NOP + } + + @Override + public String toString() { + return ObjectTools.toString(this); + } +} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/MultiThreadedExceptionHandlerAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/MultiThreadedExceptionHandlerAdapter.java new file mode 100644 index 0000000000..ef6946eb54 --- /dev/null +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/MultiThreadedExceptionHandlerAdapter.java @@ -0,0 +1,24 @@ +/******************************************************************************* + * 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; + +import org.eclipse.jpt.common.utility.MultiThreadedExceptionHandler; + +/** + * Convenience exception handler that does nothing. + */ +public class MultiThreadedExceptionHandlerAdapter + extends ExceptionHandlerAdapter + implements MultiThreadedExceptionHandler +{ + public void handleException(Thread thread, Throwable t) { + // NOP + } +} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/command/CommandAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/command/CommandAdapter.java new file mode 100644 index 0000000000..a6fecfceba --- /dev/null +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/command/CommandAdapter.java @@ -0,0 +1,29 @@ +/******************************************************************************* + * 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.command.Command; +import org.eclipse.jpt.common.utility.internal.ObjectTools; + +/** + * Convenience command that does nothing. + */ +public class CommandAdapter + implements Command +{ + public void execute() { + // NOP + } + + @Override + public String toString() { + return ObjectTools.toString(this); + } +} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/command/InterruptibleCommandAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/command/InterruptibleCommandAdapter.java new file mode 100644 index 0000000000..910c23b9e2 --- /dev/null +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/command/InterruptibleCommandAdapter.java @@ -0,0 +1,29 @@ +/******************************************************************************* + * 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.command.InterruptibleCommand; +import org.eclipse.jpt.common.utility.internal.ObjectTools; + +/** + * Convenience command that does nothing. + */ +public class InterruptibleCommandAdapter + implements InterruptibleCommand +{ + public void execute() throws InterruptedException { + // NOP + } + + @Override + public String toString() { + return ObjectTools.toString(this); + } +} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterable/ListIterableAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterable/ListIterableAdapter.java new file mode 100644 index 0000000000..3a337e3ef2 --- /dev/null +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterable/ListIterableAdapter.java @@ -0,0 +1,31 @@ +/******************************************************************************* + * 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.iterable; + +import java.util.ListIterator; +import org.eclipse.jpt.common.utility.internal.ObjectTools; +import org.eclipse.jpt.common.utility.internal.iterator.EmptyListIterator; +import org.eclipse.jpt.common.utility.iterable.ListIterable; + +/** + * Convenience list iterable that returns an empty iterator. + */ +public class ListIterableAdapter<E> + implements ListIterable<E> +{ + public ListIterator<E> iterator() { + return EmptyListIterator.instance(); + } + + @Override + public String toString() { + return ObjectTools.toString(this); + } +} |