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

  




 

 


org.eclipse.emf.workspace
Class EMFOperationCommand


java.lang.Object
  extended by 
org.eclipse.emf.workspace.EMFOperationCommand
All Implemented Interfaces:
Command, ConditionalRedoCommand

public class EMFOperationCommand
extends Object
implements ConditionalRedoCommand

An implementation of the EMF Command API that wraps an IUndoableOperation. It is particularly useful for returning triggers from a ResourceSetListener that perform non-EMF changes. An EMFOperationCommand, when executed, automatically inserts itself into the change description of the active transaction to support the inclusion of these non-EMF changes in:

  • transaction rollback (in case of validation failure, etc.)
  • undo/redo of RecordingCommands


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.eclipse.emf.transaction.util. ConditionalRedoCommand
ConditionalRedoCommand.Compound
 
Constructor Summary
EMFOperationCommand ( TransactionalEditingDomain domain, IUndoableOperation operation)
          Initializes me with the undoable operation that I wrap.
EMFOperationCommand ( TransactionalEditingDomain domain, IUndoableOperation operation, IAdaptable adaptable)
          Initializes me with the undoable operation that I wrap and an adaptable to pass to it when I execute/undo/redo.
 
Method Summary
 boolean canExecute ()
          I can execute if my wrapped operation can execute.
 boolean canRedo ()
          I can redo if my wrapped operation can redo.
 boolean canUndo ()
          I can undo if my wrapped operation can undo.
  Command chain ( Command command)
           
 void dispose ()
          Forgets my operation and the adaptable with which I was initialized, if any.
 void execute ()
          Executes my wrapped operation and inserts it into the active transaction's change description for rollback and undo/redo support.
  Collection<?> getAffectedObjects ()
          Obtains the affected objects from my wrapped operation, if it is an IAdvancedUndoableOperation.
  String getDescription ()
          My description is my wrapped operation's label.
  String getLabel ()
          My label is my wrapped operation's label.
  Collection<?> getResult ()
           
 void redo ()
          I redo my wrapped operation.
 void undo ()
          I undo my wrapped operation.
 
Methods inherited from class java.lang. Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EMFOperationCommand

public EMFOperationCommand(
TransactionalEditingDomain domain,
                           
IUndoableOperation operation)
Initializes me with the undoable operation that I wrap.

Parameters:
domain - the editing domain in which I will be executed
operation - my operation
Throws:
IllegalArgumentException - if either the domain or operation is null

EMFOperationCommand

public EMFOperationCommand(
TransactionalEditingDomain domain,
                           
IUndoableOperation operation,
                           
IAdaptable adaptable)
Initializes me with the undoable operation that I wrap and an adaptable to pass to it when I execute/undo/redo.

Parameters:
domain - the editing domain in which I will be executed
operation - my operation
adaptable - the adaptable to provide UI context to the operation
Throws:
IllegalArgumentException - if either the domain or operation is null
Method Detail

canExecute

public boolean canExecute()
I can execute if my wrapped operation can execute.

Specified by:
canExecute in interface Command

execute

public void execute()
Executes my wrapped operation and inserts it into the active transaction's change description for rollback and undo/redo support.

Specified by:
execute in interface Command
Throws:
IllegalStateException - if I am being executed outside of a read/write transaction context

canUndo

public boolean canUndo()
I can undo if my wrapped operation can undo.

Specified by:
canUndo in interface Command

undo

public void undo()
I undo my wrapped operation. If an adaptable was initially provided to me and it is still available, then it is passed along to the operation.

Specified by:
undo in interface Command
Throws:
IllegalStateException - if I am being undone outside of a read/write transaction context

canRedo

public boolean canRedo()
I can redo if my wrapped operation can redo.

Specified by:
canRedo in interface ConditionalRedoCommand
Returns:
true if I can be redone; false, otherwise

redo

public void redo()
I redo my wrapped operation. If an adaptable was initially provided to me and it is still available, then it is passed along to the operation.

Specified by:
redo in interface Command
Throws:
IllegalStateException - if I am being redone outside of a read/write transaction context

getResult

public 
Collection<?> getResult()
Specified by:
getResult in interface Command

getAffectedObjects

public 
Collection<?> getAffectedObjects()
Obtains the affected objects from my wrapped operation, if it is an IAdvancedUndoableOperation.

Specified by:
getAffectedObjects in interface Command

getLabel

public 
String getLabel()
My label is my wrapped operation's label.

Specified by:
getLabel in interface Command

getDescription

public 
String getDescription()
My description is my wrapped operation's label.

Specified by:
getDescription in interface Command

dispose

public void dispose()
Forgets my operation and the adaptable with which I was initialized, if any.

Specified by:
dispose in interface Command

chain

public 
Command chain(
Command command)
Specified by:
chain in interface 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