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

    java.lang.Object
      org.eclipse.emf.common.command.AbstractCommand
          org.eclipse.emf.common.command.CompoundCommand
              org.eclipse.emf.edit.command.DeleteCommand

All Implemented Interfaces:
  Command

    public class DeleteCommand

extends CompoundCommand

This `removes` an object from its parent and, if that leaves the object orphaned from any resource, i.e. in the usual case where its parent was its container, additionally deletes all other references to it from within the editing domain.

Since:
  2.2

Nested Class Summary

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

Field Summary
`protected java.util.Collection<?>` `collection` This is the collection of objects to be deleted.
`protected static java.lang.String` `DESCRIPTION` This caches the description.
`protected EditingDomain` `domain` This is the editing domain in which this command operates.
`protected static java.lang.String` `LABEL` This caches the label.

Fields inherited from class org.eclipse.emf.common.command.CompoundCommand
`commandList, LAST_COMMAND_ALL, MERGE_COMMAND_ALL, resultIndex`

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

Constructor Summary
`DeleteCommand(EditingDomain domain, java.util.Collection<?> collection)` This constructs a command that deletes the objects in the given collection.

Method Summary
`static Command` `create(EditingDomain domain, java.util.Collection<?> collection)` This creates a command that deletes the objects in the given collection.
`static Command` `create(EditingDomain domain, java.lang.Object object)` This creates a command that deletes the given object.
`void` `execute()` Calls `Command.execute()` for each command in the list.
`protected java.util.Map<EObject,java.util.Collection<EStructuralFeature.Setting>>` `findReferences(java.util.Collection<EObject> eObjects)` Returns the references to the objects in the given collection that are to be cleared.
`java.util.Collection<?>` `getCollection()` This returns the collection of objects to be deleted.
`protected boolean` `prepare()` Returns whether all the commands can execute so that `AbstractCommand.isExecutable` can be cached.
`protected void` `prepareCommand()`

Methods inherited from class org.eclipse.emf.common.command.CompoundCommand
`append, appendAndExecute, appendIfCanExecute, canUndo, dispose, getAffectedObjects, getCommandList, getDescription, getLabel, getMergedAffectedObjectsCollection, getMergedResultCollection, getResult, getResultIndex, isEmpty, redo, toString, undo, unwrap`

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

### LABEL

    protected static final java.lang.String LABEL

  This caches the label.

### DESCRIPTION

    protected static final java.lang.String DESCRIPTION

  This caches the description.

### domain

    protected EditingDomain domain

  This is the editing domain in which this command operates.

### collection

    protected java.util.Collection<?> collection

  This is the collection of objects to be deleted.

Constructor Detail

### DeleteCommand

    public DeleteCommand(EditingDomain domain,
                         java.util.Collection<?> collection)

  This constructs a command that deletes the objects in the given collection.

Method Detail

### create

    public static Command create(EditingDomain domain,
                                 java.lang.Object object)

  This creates a command that deletes the given object.

### create

    public static Command create(EditingDomain domain,
                                 java.util.Collection<?> collection)

  This creates a command that deletes the objects in the given collection.

### getCollection

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

  This returns the collection of objects to be deleted.

### prepare

    protected boolean prepare()

  Description copied from class: `CompoundCommand`
  Returns whether all the commands can execute so that `AbstractCommand.isExecutable` can be cached. An empty command list causes `false` to be returned.

  Overrides:
    `prepare` in class `CompoundCommand`
  Returns:
    whether all the commands can execute.

### prepareCommand

    protected void prepareCommand()

### execute

    public void execute()

  Description copied from class: `CompoundCommand`
  Calls `Command.execute()` for each command in the list.

  Specified by:
    `execute` in interface `Command`
  Overrides:
    `execute` in class `CompoundCommand`

### findReferences

    protected java.util.Map<EObject,java.util.Collection<EStructuralFeature.Setting>> findReferences(java.util.Collection<EObject> eObjects)

  Returns the references to the objects in the given collection that are to be cleared. The default implementation uses `EcoreUtil.UsageCrossReferencer` to find all incoming cross references.

  Since:
    2.6
  See Also:
    `EcoreUtil.UsageCrossReferencer`

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