Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Runtime

org.eclipse.gmf.runtime.common.core.command
Class OneTimeCommand

java.lang.Object
  extended by 

org.eclipse.core.commands.operations.AbstractOperation
      extended by 

org.eclipse.gmf.runtime.common.core.command.AbstractCommand
          extended by 
org.eclipse.gmf.runtime.common.core.command.OneTimeCommand
All Implemented Interfaces:
IUndoableOperation, ICommand, org.eclipse.gmf.runtime.common.core.internal.command.ICommandWithSettableResult

public abstract class OneTimeCommand
extends AbstractCommand

A command does its work once, and can never be undone or redone. It does not do any work that invalidates the undo history in a linear undo model.

By default, it is assigned the NULL_CONTEXT when it is constructed, and no other contexts can be added to it or removed from it.

This class is meant to be subclassed by clients who have work to do in a command that should have no effect on the operation history.


Field Summary
protected static  IUndoContext NULL_CONTEXT
          The null undo context.
 
Constructor Summary
OneTimeCommand (java.lang.String label)
          Initializes me with a label.
OneTimeCommand (java.lang.String label, java.util.List affectedFiles)
          Initializes me with a label and a list of IFiles that anticipate modifying when I am executed.
 
Method Summary
 void addContext ( IUndoContext context)
          Does nothing.
 boolean canRedo ()
          Not redoable.
 boolean canUndo ()
          Not undoable.
protected   CommandResult doRedoWithResult ( IProgressMonitor progressMonitor, IAdaptable info)
          Not redoable.
protected   CommandResult doUndoWithResult ( IProgressMonitor progressMonitor, IAdaptable info)
          Not undoable.
 void removeContext ( IUndoContext context)
          Does nothing.
 
Methods inherited from class org.eclipse.gmf.runtime.common.core.command. AbstractCommand
compose, dispose, doExecuteWithResult, execute, getAffectedFiles, getCommandResult, internalSetResult, redo, reduce, setResult, undo
 
Methods inherited from class org.eclipse.core.commands.operations. AbstractOperation
canExecute, getContexts, getLabel, hasContext, setLabel, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.gmf.runtime.common.core.command. ICommand
setLabel
 
Methods inherited from interface org.eclipse.core.commands.operations. IUndoableOperation
canExecute, getContexts, getLabel, hasContext
 

Field Detail

NULL_CONTEXT

protected static final 
IUndoContext NULL_CONTEXT
The null undo context.

Constructor Detail

OneTimeCommand

public OneTimeCommand(java.lang.String label)
Initializes me with a label.

Parameters:
label - the operation label

OneTimeCommand

public OneTimeCommand(java.lang.String label,
                      java.util.List affectedFiles)
Initializes me with a label and a list of IFiles that anticipate modifying when I am executed.

Parameters:
label - the operation label
affectedFiles - the list of affected IFiles; may be null
Method Detail

addContext

public final void addContext(
IUndoContext context)
Does nothing. The context will not be added to the operation.

Specified by:
addContext in interface IUndoableOperation
Overrides:
addContext in class AbstractOperation

removeContext

public final void removeContext(
IUndoContext context)
Does nothing. The context will not be removed from the operation.

Specified by:
removeContext in interface IUndoableOperation
Overrides:
removeContext in class AbstractOperation

canUndo

public final boolean canUndo()
Not undoable. Returns false.

Specified by:
canUndo in interface IUndoableOperation
Overrides:
canUndo in class AbstractOperation

canRedo

public final boolean canRedo()
Not redoable. Returns false.

Specified by:
canRedo in interface IUndoableOperation
Overrides:
canRedo in class AbstractOperation

doUndoWithResult

protected final 
CommandResult doUndoWithResult(
IProgressMonitor progressMonitor,
                                               
IAdaptable info)
                                        throws 
ExecutionException
Not undoable. Throws an ExecutionException.

Specified by:
doUndoWithResult in class AbstractCommand
Parameters:
progressMonitor - the progress monitor provided by the operation history. Must never be null.
info - the IAdaptable (or null) provided by the caller in order to supply UI information for prompting the user if necessary. When this parameter is not null, it should minimally contain an adapter for the org.eclipse.swt.widgets.Shell.class.
Returns:
The result of undoing this command. May be null if the execution status is OK, but there is no meaningful result to be returned.
Throws:
ExecutionException - on failure to undo

doRedoWithResult

protected final 
CommandResult doRedoWithResult(
IProgressMonitor progressMonitor,
                                               
IAdaptable info)
                                        throws 
ExecutionException
Not redoable. Throws an ExecutionException.

Specified by:
doRedoWithResult in class AbstractCommand
Parameters:
progressMonitor - the progress monitor provided by the operation history. Must never be null.
info - the IAdaptable (or null) provided by the caller in order to supply UI information for prompting the user if necessary. When this parameter is not null, it should minimally contain an adapter for the org.eclipse.swt.widgets.Shell.class.
Returns:
The result of redoing this command. May be null if the execution status is OK, but there is no meaningful result to be returned.
Throws:
ExecutionException - on failure to redo

Runtime

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp., Borland Software Corp., and others 2005,2006. All rights reserved.


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire