## org.eclipse.emf.edit.provider
Class WrapperItemProvider.WrappingCopyCommand

    java.lang.Object
      org.eclipse.emf.common.command.AbstractCommand
          org.eclipse.emf.common.command.CommandWrapper
              org.eclipse.emf.edit.provider.WrapperItemProvider.WrappingCopyCommand

All Implemented Interfaces:
  Command

Enclosing class:
  WrapperItemProvider

    protected abstract class WrapperItemProvider.WrappingCopyCommand

extends CommandWrapper

A command base class for copying the wrapper for a value that is partly copied by another command. This is useful when the value includes a model object that is able provide an adapter to return a copy command, but also includes an element that is not adaptable, such as a feature map entry. This command copies the non-adapter element and the wrapper, which ensures the copy can be copied again.

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.common.command.CommandWrapper
`command`

Fields inherited from class org.eclipse.emf.common.command.AbstractCommand
`description, isExecutable, isPrepared, label`

Constructor Summary
`WrapperItemProvider.WrappingCopyCommand(Command command)` Creates an instance where some adaptable value is copied by the given command.

Method Summary
`abstract IWrapperItemProvider` `copy()` Concrete subclasses must implement this to copy and return the value and wrapper.
`void` `execute()` Executes the adaptable-value-copying command, then calls `copy` to copy the rest of the value and the wrapper, `disposes` the copy, and sets it to be the result of the command.
`java.util.Collection<?>` `getAffectedObjects()` Returns a list containing only the original wrapper itself.
`java.util.Collection<?>` `getResult()` If the command has executed, returns a list containing only the copy of the wrapper.

Methods inherited from class org.eclipse.emf.common.command.CommandWrapper
`canUndo, createCommand, dispose, getCommand, getDescription, getLabel, prepare, redo, toString, undo`

Methods inherited from class org.eclipse.emf.common.command.AbstractCommand
`canExecute, chain, setDescription, setLabel`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### result

    protected java.util.Collection<?> result

### affectedObjects

    protected java.util.Collection<?> affectedObjects

Constructor Detail

### WrapperItemProvider.WrappingCopyCommand

    public WrapperItemProvider.WrappingCopyCommand(Command command)

  Creates an instance where some adaptable value is copied by the given command.

Method Detail

### execute

    public void execute()

  Executes the adaptable-value-copying command, then calls `copy` to copy the rest of the value and the wrapper, `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:
    `execute` in interface `Command`
  Overrides:
    `execute` in class `CommandWrapper`

### copy

    public abstract IWrapperItemProvider copy()

  Concrete subclasses must implement this to copy and return the value and wrapper. The result of the adaptable-value-copying command is available from `getCommand().getResult()`.

### getResult

    public java.util.Collection<?> getResult()

  If the command has executed, returns a list containing only the copy of the wrapper.

  Specified by:
    `getResult` in interface `Command`
  Overrides:
    `getResult` in class `CommandWrapper`
  Returns:
    the result.

### getAffectedObjects

    public java.util.Collection<?> getAffectedObjects()

  Returns a list containing only the original wrapper itself.

  Specified by:
    `getAffectedObjects` in interface `Command`
  Overrides:
    `getAffectedObjects` in class `CommandWrapper`
  Returns:
    the result.

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