diff options
author | Brian Vosburgh | 2013-03-13 18:53:48 +0000 |
---|---|---|
committer | Brian Vosburgh | 2013-03-13 18:53:48 +0000 |
commit | 111d6ad9ea8731905c19691264dcc2d196f9478f (patch) | |
tree | af1c4038b73a57e6b3296a48f7cfee9497d6e3c5 /common/plugins | |
parent | cd8c94d375dc19586fdb3249c82d980f733a18b4 (diff) | |
download | webtools.dali-111d6ad9ea8731905c19691264dcc2d196f9478f.tar.gz webtools.dali-111d6ad9ea8731905c19691264dcc2d196f9478f.tar.xz webtools.dali-111d6ad9ea8731905c19691264dcc2d196f9478f.zip |
clean up RepeatingJobCommand
Diffstat (limited to 'common/plugins')
2 files changed, 62 insertions, 45 deletions
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/command/NullRepeatingJobCommand.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/command/NullRepeatingJobCommand.java new file mode 100644 index 0000000000..fb4aef1e54 --- /dev/null +++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/command/NullRepeatingJobCommand.java @@ -0,0 +1,59 @@ +/******************************************************************************* + * Copyright (c) 2012, 2013 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 java.io.Serializable; +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.RepeatingJobCommand; +import org.eclipse.jpt.common.utility.internal.ObjectTools; + +/** + * Singleton implementation of the repeating job command interface that + * will do nothing when executed. + */ +public final class NullRepeatingJobCommand + implements RepeatingJobCommand, Serializable +{ + public static final RepeatingJobCommand INSTANCE = new NullRepeatingJobCommand(); + + public static RepeatingJobCommand instance() { + return INSTANCE; + } + + // ensure single instance + private NullRepeatingJobCommand() { + super(); + } + + public void start() { + // do nothing + } + + public IStatus execute(IProgressMonitor monitor) { + return Status.OK_STATUS; + } + + public void stop() { + // do nothing + } + + @Override + public String toString() { + return ObjectTools.singletonToString(this); + } + + private static final long serialVersionUID = 1L; + private Object readResolve() { + // replace this object with the singleton + return INSTANCE; + } +} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/command/RepeatingJobCommand.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/command/RepeatingJobCommand.java index 461d5671d6..35b0967ff3 100644 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/command/RepeatingJobCommand.java +++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/command/RepeatingJobCommand.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012 Oracle. All rights reserved. + * Copyright (c) 2012, 2013 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. @@ -9,12 +9,6 @@ ******************************************************************************/ package org.eclipse.jpt.common.core.utility.command; -import java.io.Serializable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jpt.common.utility.internal.ObjectTools; - /** * This job command will execute repeatedly the minimum * number of times. The assumption is the job command's effects are @@ -35,51 +29,15 @@ public interface RepeatingJobCommand { /** * Start the job command, allowing it to begin executing with the next call - * to {@link #execute(IProgressMonitor)}. + * to {@link #execute(org.eclipse.core.runtime.IProgressMonitor)}. * @exception IllegalStateException when the command is not stopped */ void start(); /** * Stop the job command; ignore further calls to - * {@link #execute(IProgressMonitor)}. + * {@link #execute(org.eclipse.core.runtime.IProgressMonitor)}. * @exception IllegalStateException when the command executor is not started */ void stop() throws InterruptedException; - - - /** - * Singleton implementation of the repeating job command interface that - * will do nothing when executed. - */ - final class Null - implements RepeatingJobCommand, Serializable - { - public static final RepeatingJobCommand INSTANCE = new Null(); - public static RepeatingJobCommand instance() { - return INSTANCE; - } - // ensure single instance - private Null() { - super(); - } - public void start() { - // do nothing - } - public IStatus execute(IProgressMonitor monitor) { - return Status.OK_STATUS; - } - public void stop() { - // do nothing - } - @Override - public String toString() { - return ObjectTools.singletonToString(this); - } - private static final long serialVersionUID = 1L; - private Object readResolve() { - // replace this object with the singleton - return INSTANCE; - } - } } |