## org.eclipse.emf.edit.command
Class InitializeCopyCommand

    java.lang.Object
      org.eclipse.emf.common.command.AbstractCommand
          org.eclipse.emf.edit.command.AbstractOverrideableCommand
              org.eclipse.emf.edit.command.InitializeCopyCommand

All Implemented Interfaces:
  Command, OverrideableCommand

    public class InitializeCopyCommand

extends AbstractOverrideableCommand

The initialize copy command is implemented to set the values of an object copy based on those of the original (copied) object. It is a helper command used by the CopyCommand.

An initialize copy command is an `OverrideableCommand`.

Nested Class Summary

Nested classes/interfaces inherited from class org.eclipse.emf.common.command.AbstractCommand
`AbstractCommand.NonDirtying`

Field Summary
`protected EObject` `copy` This is the object (copy) being initialized.
`protected CopyCommand.Helper` `copyHelper` This is a map of objects to their copies
`protected static java.lang.String` `DESCRIPTION` This caches the description.
`protected static java.lang.String` `LABEL` This caches the label.
`protected EObject` `owner` This is the object being copied.

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
`InitializeCopyCommand(EditingDomain domain, EObject owner, CopyCommand.Helper copyHelper)` This constructs an instance that will copy the attribute values of value to those of owner.

Method Summary
`protected void` `copyAttributes()` This method will iterate over the attributes of the owner object and set them accordingly in the copy.
`protected void` `copyReferences()` This method will iterate over the references of the owner object and sets them.
`static Command` `create(EditingDomain domain, java.lang.Object owner, CopyCommand.Helper copyHelper)`
`void` `doExecute()` This is overrideable command's implementation of execute.
`java.util.Collection<?>` `doGetAffectedObjects()` This is overrideable command's implementation of getAffectedObjects.
`java.util.Collection<?>` `doGetResult()` This is overrideable command's implementation of getResult.
`void` `doRedo()` This is overrideable command's implementation of redo.
`void` `doUndo()` This is overrideable command's implementation of undo.
`protected java.util.Collection<? extends EAttribute>` `getAttributesToCopy()`
`EObject` `getCopy()` This is the object (copy) being initialized.
`CopyCommand.Helper` `getCopyHelper()` This is the map of objects to their copies.
`EObject` `getOwner()` This is the object being copied.
`protected java.util.Collection<? extends EReference>` `getReferencesToCopy()`
`protected boolean` `prepare()` Called at most once in `AbstractCommand.canExecute()` to give the command an opportunity to ready itself for execution.
`java.lang.String` `toString()` This gives an abbreviated name using this object's own class' name, without package qualification, followed by a space separated list of `field:value` pairs.

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, undo`

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

### LABEL

    protected static final java.lang.String LABEL

  This caches the label.

### DESCRIPTION

    protected static final java.lang.String DESCRIPTION

  This caches the description.

### owner

    protected EObject owner

  This is the object being copied.

### copy

    protected EObject copy

  This is the object (copy) being initialized.

### copyHelper

    protected CopyCommand.Helper copyHelper

  This is a map of objects to their copies

Constructor Detail

### InitializeCopyCommand

    public InitializeCopyCommand(EditingDomain domain,
                                 EObject owner,
                                 CopyCommand.Helper copyHelper)

  This constructs an instance that will copy the attribute values of value to those of owner.

Method Detail

### create

    public static Command create(EditingDomain domain,
                                 java.lang.Object owner,
                                 CopyCommand.Helper copyHelper)

### getOwner

    public EObject getOwner()

  This is the object being copied.

### getCopy

    public EObject getCopy()

  This is the object (copy) being initialized.

### getCopyHelper

    public CopyCommand.Helper getCopyHelper()

  This is the map of objects to their copies.

### prepare

    protected boolean prepare()

  Description copied from class: `AbstractCommand`
  Called at most once in `AbstractCommand.canExecute()` to give the command an opportunity to ready itself for execution. The returned value is stored in `AbstractCommand.canExecute()`. In other words, you can override this method to initialize and to yield a cached value for the all subsequent calls to canExecute.

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

### doExecute

    public void doExecute()

  Description copied from interface: `OverrideableCommand`
  This is overrideable command's implementation of execute.

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

### getAttributesToCopy

    protected java.util.Collection<? extends EAttribute> getAttributesToCopy()

### copyAttributes

    protected void copyAttributes()

  This method will iterate over the attributes of the owner object and set them accordingly in the copy.

### getReferencesToCopy

    protected java.util.Collection<? extends EReference> getReferencesToCopy()

### copyReferences

    protected void copyReferences()

  This method will iterate over the references of the owner object and sets them. accordingly in the copy.

### doUndo

    public void doUndo()

  Description copied from interface: `OverrideableCommand`
  This is overrideable command's implementation of undo.

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

### doRedo

    public void doRedo()

  Description copied from interface: `OverrideableCommand`
  This is overrideable command's implementation of redo.

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

### doGetResult

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

  Description copied from interface: `OverrideableCommand`
  This is overrideable command's implementation of getResult.

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

### doGetAffectedObjects

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

  Description copied from interface: `OverrideableCommand`
  This is overrideable command's implementation of getAffectedObjects.

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

### toString

    public java.lang.String toString()

  This gives an abbreviated name using this object's own class' name, without package qualification, followed by a space separated list of `field:value` pairs.

  Overrides:
    `toString` in class `AbstractOverrideableCommand`
  Returns:
    string representation.

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