Runtime

## org.eclipse.gmf.runtime.emf.type.core.commands
Class EditElementCommand

    java.lang.Object
      org.eclipse.core.commands.operations.AbstractOperation
          org.eclipse.emf.workspace.AbstractEMFOperation
              org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand
                  org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand

All Implemented Interfaces:
  IUndoableOperation, ICommand, org.eclipse.gmf.runtime.common.core.internal.command.ICommandWithSettableResult

Direct Known Subclasses:
  ConfigureElementCommand, CreateElementCommand, DestroyElementCommand, DestroyReferenceCommand, GetEditContextCommand, MoveElementsCommand, SetValueCommand

    public abstract class EditElementCommand

extends AbstractTransactionalCommand

Abstract superclass for commands that modify model elements.

Constructor Summary
`protected` `EditElementCommand(java.lang.String label, org.eclipse.emf.ecore.EObject elementToEdit, IEditCommandRequest request)` Constructs a new command instance.

Method Summary
`boolean` `canExecute()` Checks that the element to be modified by this command is of the correct kind.
`protected static java.util.List` `getAffectedFiles(IEditCommandRequest request)`
`protected org.eclipse.emf.ecore.EClass` `getEClass()` Gets the kind of element that can be modified by this command.
`protected org.eclipse.emf.ecore.EClass` `getEClassToEdit()`
`protected org.eclipse.emf.ecore.EObject` `getElementToEdit()` Gets the element to be modified by this command.
`protected IEditCommandRequest` `getRequest()` Gets the edit request.
`protected boolean` `isOK(CommandResult commandResult)` Convenience method to check the status of `commandRequest`.
`protected void` `setEClass(org.eclipse.emf.ecore.EClass eClass)` Sets the kind of element that can be modified by this command.
`protected void` `setElementToEdit(org.eclipse.emf.ecore.EObject element)` Sets the element to be modified by this command.

Methods inherited from class org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand
`aggregateStatuses, cleanup, compose, didRedo, didUndo, doExecute, doExecuteWithResult, doRedo, doUndo, getAffectedFiles, getCommandResult, getWorkspaceFiles, getWorkspaceFiles, internalSetResult, reduce, setResult`

Methods inherited from class org.eclipse.emf.workspace.AbstractEMFOperation
`canRedo, canSetOptions, canUndo, didCommit, dispose, execute, getChange, getEditingDomain, getOptions, isReuseParentTransaction, redo, setOptions, setReuseParentTransaction, undo`

Methods inherited from class org.eclipse.core.commands.operations.AbstractOperation
`addContext, getContexts, getLabel, hasContext, removeContext, setLabel, toString`

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

Methods inherited from interface org.eclipse.gmf.runtime.common.core.command.ICommand
`setLabel`

Methods inherited from interface org.eclipse.core.commands.operations.IUndoableOperation
`addContext, canRedo, canUndo, dispose, execute, getContexts, getLabel, hasContext, redo, removeContext, undo`

Constructor Detail

### EditElementCommand

    protected EditElementCommand(java.lang.String label,
                                 org.eclipse.emf.ecore.EObject elementToEdit,
                                 IEditCommandRequest request)

  Constructs a new command instance.

  Parameters:
    `label` - the command label
    `elementToEdit` - the element to be modified
    `request` - the edt request

Method Detail

### getAffectedFiles

    protected static java.util.List getAffectedFiles(IEditCommandRequest request)

### canExecute

    public boolean canExecute()

  Checks that the element to be modified by this command is of the correct kind.

  Specified by:
    `canExecute` in interface `IUndoableOperation`
  Overrides:
    `canExecute` in class `AbstractOperation`

### getElementToEdit

    protected org.eclipse.emf.ecore.EObject getElementToEdit()

  Gets the element to be modified by this command.

  Returns:
    the element to be modified

### getEClassToEdit

    protected org.eclipse.emf.ecore.EClass getEClassToEdit()

### setElementToEdit

    protected void setElementToEdit(org.eclipse.emf.ecore.EObject element)

  Sets the element to be modified by this command.

### getRequest

    protected IEditCommandRequest getRequest()

  Gets the edit request.

  Returns:
    the edit request

### getEClass

    protected org.eclipse.emf.ecore.EClass getEClass()

  Gets the kind of element that can be modified by this command.

  Returns:
    the kind of element

### setEClass

    protected void setEClass(org.eclipse.emf.ecore.EClass eClass)

  Sets the kind of element that can be modified by this command.

  Parameters:
    `eClass` - the kind of element

### isOK

    protected boolean isOK(CommandResult commandResult)

  Convenience method to check the status of `commandRequest`.

  Parameters:
    `commandResult` - the command result to check
  Returns:
    `true` if the result is OK, `false` otherwise.

Runtime

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp., Borland Software Corp., and others 2005,2006. All rights reserved.