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

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

  




 

 


org.eclipse.emf.workspace
Class EMFCommandOperation

java.lang.Object
  extended by 

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

org.eclipse.emf.workspace.AbstractEMFOperation
          extended by 
org.eclipse.emf.workspace.EMFCommandOperation
All Implemented Interfaces:
IUndoableOperation

public class EMFCommandOperation
extends AbstractEMFOperation

An operation that wraps an EMF Command to execute it in a read/write transaction on an IOperationHistory. This class may be created explicitly by a client of the operation history, or it may be used implicitly by executing a command on the TransactionalCommandStack.


Constructor Summary
EMFCommandOperation ( TransactionalEditingDomain domain, Command command)
          Initializes me with my editing domain and a command to execute.
EMFCommandOperation ( TransactionalEditingDomain domain, Command command, Map<?,?> options)
          Initializes me with my editing domain, a command to execute, and transaction options.
 
Method Summary
 boolean canExecute ()
          I can execute if my command can execute.
 boolean canRedo ()
          I can redo if either my wrapped command is a ConditionalRedoCommand that can undo, or it is not a conditionally redoable command.
 boolean canUndo ()
          I can undo if my command or (if any) trigger command can undo.
protected  void didCommit ( Transaction transaction)
           Hook for subclasses to learn that the specified transaction has been successfully committed and, if necessary, to extract information from it.
 void dispose ()
          Extends the inherited implementation to additionally dispose my command and my trigger command (if any).
protected   IStatus doExecute ( IProgressMonitor monitor, IAdaptable info)
          Executes me by executing my command.
protected   IStatus doRedo ( IProgressMonitor monitor, IAdaptable info)
          Redoes me by redoing my command and my trigger command (if any).
protected   IStatus doUndo ( IProgressMonitor monitor, IAdaptable info)
          Undoes me by undoing my trigger command (if any) and my command.
  Command getCommand ()
          Obtains the command that I wrap.
protected  void improveLabel ( Command cmd)
          Computes a more user-friendly label for the operation than the label created by default for EMF's feature-changing commands.
 
Methods inherited from class org.eclipse.emf.workspace. AbstractEMFOperation
aggregateStatuses, canSetOptions, didRedo, didUndo, execute, getChange, getEditingDomain, getOptions, isReuseParentTransaction, redo, setOptions, setReuseParentTransaction, undo
 
Methods inherited from class org.eclipse.core.commands.operations. AbstractOperation
addContext, getContexts, getLabel, hasContext, removeContext, setLabel, toString
 
Methods inherited from class java.lang. Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EMFCommandOperation

public EMFCommandOperation(
TransactionalEditingDomain domain,
                           
Command command)
Initializes me with my editing domain and a command to execute.

Parameters:
domain - my domain
command - my command

EMFCommandOperation

public EMFCommandOperation(
TransactionalEditingDomain domain,
                           
Command command,
                           
Map<?,?> options)
Initializes me with my editing domain, a command to execute, and transaction options.

Parameters:
domain - my domain
command - my command
options - transaction options, or null for the defaults
Method Detail

getCommand

public final 
Command getCommand()
Obtains the command that I wrap.

Returns:
my command

canExecute

public boolean canExecute()
I can execute if my command can execute.

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

doExecute

protected 
IStatus doExecute(
IProgressMonitor monitor,
                            
IAdaptable info)
                     throws 
ExecutionException
Executes me by executing my command.

Specified by:
doExecute in class AbstractEMFOperation
Parameters:
monitor - the progress monitor provided by the operation history. Will never be null because the AbstractEMFOperation.execute(IProgressMonitor, IAdaptable) method would substitute a NullProgressMonitor in that case
info - the adaptable provided by the operation history
Returns:
the status of the execution
Throws:
ExecutionException - if, for some reason, I fail to complete the operation

didCommit

protected void didCommit(
Transaction transaction)
Description copied from class: AbstractEMFOperation

Hook for subclasses to learn that the specified transaction has been successfully committed and, if necessary, to extract information from it.

Note: subclasses should call this super implementation to get some default behaviours.

Overrides:
didCommit in class AbstractEMFOperation
Parameters:
transaction - a transaction that has committed, which has recorded our changes

canUndo

public boolean canUndo()
I can undo if my command or (if any) trigger command can undo.

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

doUndo

protected 
IStatus doUndo(
IProgressMonitor monitor,
                         
IAdaptable info)
                  throws 
ExecutionException
Undoes me by undoing my trigger command (if any) and my command.

Overrides:
doUndo in class AbstractEMFOperation
Parameters:
monitor - the progress monitor provided by the operation history Will never be null because the AbstractEMFOperation.undo(IProgressMonitor, IAdaptable) method would substitute a NullProgressMonitor in that case
info - the adaptable provided by the operation history
Returns:
the status of the undo operation
Throws:
ExecutionException - on failure to undo

canRedo

public boolean canRedo()
I can redo if either my wrapped command is a ConditionalRedoCommand that can undo, or it is not a conditionally redoable command.

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

doRedo

protected 
IStatus doRedo(
IProgressMonitor monitor,
                         
IAdaptable info)
                  throws 
ExecutionException
Redoes me by redoing my command and my trigger command (if any).

Overrides:
doRedo in class AbstractEMFOperation
Parameters:
monitor - the progress monitor provided by the operation history Will never be null because the AbstractEMFOperation.redo(IProgressMonitor, IAdaptable) method would substitute a NullProgressMonitor in that case
info - the adaptable provided by the operation history
Returns:
the status of the redo operation
Throws:
ExecutionException - on failure to redo

dispose

public void dispose()
Extends the inherited implementation to additionally dispose my command and my trigger command (if any).

Specified by:
dispose in interface IUndoableOperation
Overrides:
dispose in class AbstractEMFOperation

improveLabel

protected void improveLabel(
Command cmd)
Computes a more user-friendly label for the operation than the label created by default for EMF's feature-changing commands.

Parameters:
cmd - a command

Copyright 2002, 2007 IBM Corporation and others.
All Rights Reserved.


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