org.eclipse.emf.mapping.command
Class PersistentCommandStack

java.lang.Object
  extended by org.eclipse.emf.common.command.BasicCommandStack
      extended by org.eclipse.emf.mapping.command.PersistentCommandStack
All Implemented Interfaces:
CommandStack

public class PersistentCommandStack
extends BasicCommandStack

This implementation of a command stack records the command class and command parameter used to create each command. This information can be used to create and execute all the commands again in a different session.


Nested Class Summary
static class PersistentCommandStack.CommandCreationRecord
          This records and encodes the command class and command parameter.
static class PersistentCommandStack.Decoder
           
static class PersistentCommandStack.Encoder
           
 
Field Summary
protected  java.lang.ClassLoader classLoader
           
protected  java.util.HashMap<Command,PersistentCommandStack.CommandCreationRecord> commandCreationMap
          This keeps track of the mapping between commands and their PersistentCommandStack.CommandCreationRecords.
protected  MappingDomain domain
           
protected  java.lang.String encoding
           
 
Fields inherited from class org.eclipse.emf.common.command.BasicCommandStack
commandList, listeners, mostRecentCommand, saveIndex, top
 
Constructor Summary
PersistentCommandStack(java.lang.ClassLoader classLoader)
          This constructs and instance of a command stack that records commands using a persistent encoding.
 
Method Summary
protected  PersistentCommandStack.Decoder createDecoder(MappingRoot mappingRoot, ResourceSet resourceSet, java.lang.ClassLoader classLoader)
          You can overide this to create your own type of decoder.
protected  PersistentCommandStack.Encoder createEncoder()
          You can overide this to create your own type of encoder.
 void execute(Command command)
          This override of execute calls PersistentCommandStack.CommandCreationRecord.encode(org.eclipse.emf.mapping.command.PersistentCommandStack.Encoder) just before normal execution by super.
protected  void executeEncoding()
           
 java.lang.String getEncoding()
           
 void handleCreateCommand(java.lang.Class<? extends Command> commandClass, CommandParameter commandParameter, Command command)
          This is called by the mapping domain whenever a command (that may subsequently be executed) is created.
 void setEncoding(MappingDomain domain, java.lang.String encoding)
           
 
Methods inherited from class org.eclipse.emf.common.command.BasicCommandStack
addCommandStackListener, canRedo, canUndo, flush, getMostRecentCommand, getRedoCommand, getUndoCommand, handleError, isSaveNeeded, notifyListeners, redo, removeCommandStackListener, saveIsDone, undo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

commandCreationMap

protected java.util.HashMap<Command,PersistentCommandStack.CommandCreationRecord> commandCreationMap
This keeps track of the mapping between commands and their PersistentCommandStack.CommandCreationRecords.


domain

protected MappingDomain domain

classLoader

protected java.lang.ClassLoader classLoader

encoding

protected java.lang.String encoding
Constructor Detail

PersistentCommandStack

public PersistentCommandStack(java.lang.ClassLoader classLoader)
This constructs and instance of a command stack that records commands using a persistent encoding.

Method Detail

handleCreateCommand

public void handleCreateCommand(java.lang.Class<? extends Command> commandClass,
                                CommandParameter commandParameter,
                                Command command)
This is called by the mapping domain whenever a command (that may subsequently be executed) is created.


createEncoder

protected PersistentCommandStack.Encoder createEncoder()
You can overide this to create your own type of encoder.


createDecoder

protected PersistentCommandStack.Decoder createDecoder(MappingRoot mappingRoot,
                                                       ResourceSet resourceSet,
                                                       java.lang.ClassLoader classLoader)
You can overide this to create your own type of decoder.


execute

public void execute(Command command)
This override of execute calls PersistentCommandStack.CommandCreationRecord.encode(org.eclipse.emf.mapping.command.PersistentCommandStack.Encoder) just before normal execution by super.

Specified by:
execute in interface CommandStack
Overrides:
execute in class BasicCommandStack
Parameters:
command - the command to execute.

getEncoding

public java.lang.String getEncoding()

setEncoding

public void setEncoding(MappingDomain domain,
                        java.lang.String encoding)

executeEncoding

protected void executeEncoding()

Copyright 2001-2006 IBM Corporation and others.
All Rights Reserved.