org.eclipse.emf.edit.provider
Class WrapperItemProvider.SimpleCopyCommand

java.lang.Object
  extended by org.eclipse.emf.common.command.AbstractCommand
      extended by org.eclipse.emf.edit.command.AbstractOverrideableCommand
          extended by org.eclipse.emf.edit.provider.WrapperItemProvider.SimpleCopyCommand
All Implemented Interfaces:
Command, OverrideableCommand
Enclosing class:
WrapperItemProvider

protected abstract class WrapperItemProvider.SimpleCopyCommand
extends AbstractOverrideableCommand

A command base class for copying a simple value and the wrapper. This is useful when the value isn't able provide an adapter to return a copy command, itself. This class just provides the scaffolding; concrete subclasses must implement copy to do the copying.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.eclipse.emf.common.command.AbstractCommand
AbstractCommand.NonDirtying
 
Field Summary
protected  java.util.Collection<?> affectedObjects
           
protected  java.util.Collection<?> result
           
 
Fields inherited from class org.eclipse.emf.edit.command.AbstractOverrideableCommand
domain, overrideCommand
 
Fields inherited from class org.eclipse.emf.common.command.AbstractCommand
description, isExecutable, isPrepared, label
 
Constructor Summary
WrapperItemProvider.SimpleCopyCommand(EditingDomain domain)
          Creates an instance for the given domain.
 
Method Summary
abstract  IWrapperItemProvider copy()
          Concrete subclasses must implement this to copy and return the value and wrapper.
 void doExecute()
          Calls copy() to do the copying, disposes the copy, and sets it to be the result of the command.
 java.util.Collection<?> doGetAffectedObjects()
          Returns a list containing only the original wrapper itself.
 java.util.Collection<?> doGetResult()
          If the command has executed, returns a list containing only the copy of the wrapper.
 void doRedo()
          Does nothing.
 void doUndo()
          Does nothing.
protected  boolean prepare()
          Returns true; this command can requires now preparation and can always be executed.
 
Methods inherited from class org.eclipse.emf.edit.command.AbstractOverrideableCommand
canExecute, canUndo, dispose, doCanExecute, doCanUndo, doDispose, doGetChildrenToCopy, doGetDescription, doGetLabel, execute, getAffectedObjects, getChildrenToCopy, getDescription, getDomain, getLabel, getOverride, getOwnerList, getResult, redo, setOverride, toString, undo, updateEMap
 
Methods inherited from class org.eclipse.emf.common.command.AbstractCommand
chain, setDescription, setLabel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.emf.common.command.Command
chain
 

Field Detail

result

protected java.util.Collection<?> result

affectedObjects

protected java.util.Collection<?> affectedObjects
Constructor Detail

WrapperItemProvider.SimpleCopyCommand

public WrapperItemProvider.SimpleCopyCommand(EditingDomain domain)
Creates an instance for the given domain.

Method Detail

prepare

protected boolean prepare()
Returns true; this command can requires now preparation and can always be executed.

Overrides:
prepare in class AbstractCommand
Returns:
whether the command is executable.

doExecute

public void doExecute()
Calls copy() to do the copying, disposes the copy, and sets it to be the result of the command. Since the copy has not been created within the viewed model, it should never do any kind of notification, which is why it is immediately disposed.

Specified by:
doExecute in interface OverrideableCommand
Specified by:
doExecute in class AbstractOverrideableCommand

copy

public abstract IWrapperItemProvider copy()
Concrete subclasses must implement this to copy and return the value and wrapper.


doUndo

public void doUndo()
Does nothing.

Specified by:
doUndo in interface OverrideableCommand
Specified by:
doUndo in class AbstractOverrideableCommand

doRedo

public void doRedo()
Does nothing.

Specified by:
doRedo in interface OverrideableCommand
Specified by:
doRedo in class AbstractOverrideableCommand

doGetResult

public java.util.Collection<?> doGetResult()
If the command has executed, returns a list containing only the copy of the wrapper.

Specified by:
doGetResult in interface OverrideableCommand
Overrides:
doGetResult in class AbstractOverrideableCommand

doGetAffectedObjects

public java.util.Collection<?> doGetAffectedObjects()
Returns a list containing only the original wrapper itself.

Specified by:
doGetAffectedObjects in interface OverrideableCommand
Overrides:
doGetAffectedObjects in class AbstractOverrideableCommand

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