Runtime

## org.eclipse.gmf.runtime.diagram.ui.commands
Class SemanticCreateCommand

    java.lang.Object
      org.eclipse.core.commands.operations.AbstractOperation
          org.eclipse.gmf.runtime.common.core.command.AbstractCommand
              org.eclipse.gmf.runtime.diagram.ui.commands.SemanticCreateCommand

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

public class SemanticCreateCommand
extends AbstractCommand

A Wrapper around a real element creation command The main use of this command is to ensure that the semantic adapter is updated appropriately upon undo and redo of the real command

Constructor Summary
`SemanticCreateCommand(CreateElementRequestAdapter requestAdapter, Command realSemanticCommand)` Creates a new semantic create command that wraps around a real command

Method Summary
`void` `addContext(IUndoContext context)` Adds the context to my wrapped command.
`boolean` `canExecute()`
`boolean` `canRedo()`
`boolean` `canUndo()`
`void` `dispose()`
`protected CommandResult` `doExecuteWithResult(IProgressMonitor progressMonitor, IAdaptable info)` Performs the actual work of executing this command.
`protected CommandResult` `doRedoWithResult(IProgressMonitor progressMonitor, IAdaptable info)` Performs the actual work of redoing this command.
`protected CommandResult` `doUndoWithResult(IProgressMonitor progressMonitor, IAdaptable info)` Performs the actual work of undoing this command.
`java.util.List` `getAffectedFiles()` Returns the `IFile`s that may be modified when the operation is executed, undone or redone.
`void` `removeContext(IUndoContext context)` Removes the context from my wrapped command.

Methods inherited from class org.eclipse.gmf.runtime.common.core.command.AbstractCommand
`compose, execute, getCommandResult, internalSetResult, redo, reduce, setResult, undo`

Methods inherited from class org.eclipse.core.commands.operations.AbstractOperation
`getContexts, getLabel, hasContext, 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.core.commands.operations.IUndoableOperation
`getContexts, getLabel, hasContext`

Constructor Detail

### SemanticCreateCommand

    public SemanticCreateCommand(CreateElementRequestAdapter requestAdapter,
                                 Command realSemanticCommand)

  Creates a new semantic create command that wraps around a real command

Parameters:
  `requestAdapter` -
  `realSemanticCommand` -

Method Detail

### doExecuteWithResult

    protected CommandResult doExecuteWithResult(IProgressMonitor progressMonitor,
                                                IAdaptable info)
                                         throws ExecutionException

  Description copied from class: `AbstractCommand`
  Performs the actual work of executing this command. Subclasses must implement this method to perform some operation.

  Specified by:
    `doExecuteWithResult` in class `AbstractCommand`
  Parameters:
    `progressMonitor` - the progress monitor provided by the operation history. Must never be `null`.
    `info` - the IAdaptable (or `null`) provided by the caller in order to supply UI information for prompting the user if necessary. When this parameter is not `null`, it should minimally contain an adapter for the org.eclipse.swt.widgets.Shell.class.
  Returns:
    The result of executing this command. May be `null` if the execution status is OK, but there is no meaningful result to be returned.
  Throws:
    `ExecutionException` - if, for some reason, I fail to complete the operation

### doRedoWithResult

    protected CommandResult doRedoWithResult(IProgressMonitor progressMonitor,
                                             IAdaptable info)
                                      throws ExecutionException

  Description copied from class: `AbstractCommand`
  Performs the actual work of redoing this command. Subclasses must implement this method to perform the redo.

  Specified by:
    `doRedoWithResult` in class `AbstractCommand`
  Parameters:
    `progressMonitor` - the progress monitor provided by the operation history. Must never be `null`.
    `info` - the IAdaptable (or `null`) provided by the caller in order to supply UI information for prompting the user if necessary. When this parameter is not `null`, it should minimally contain an adapter for the org.eclipse.swt.widgets.Shell.class.
  Returns:
    The result of redoing this command. May be `null` if the execution status is OK, but there is no meaningful result to be returned.
  Throws:
    `ExecutionException` - on failure to redo

### doUndoWithResult

    protected CommandResult doUndoWithResult(IProgressMonitor progressMonitor,
                                             IAdaptable info)
                                      throws ExecutionException

  Description copied from class: `AbstractCommand`
  Performs the actual work of undoing this command. Subclasses must implement this method to perform the undo.

  Specified by:
    `doUndoWithResult` in class `AbstractCommand`
  Parameters:
    `progressMonitor` - the progress monitor provided by the operation history. Must never be `null`.
    `info` - the IAdaptable (or `null`) provided by the caller in order to supply UI information for prompting the user if necessary. When this parameter is not `null`, it should minimally contain an adapter for the org.eclipse.swt.widgets.Shell.class.
  Returns:
    The result of undoing this command. May be `null` if the execution status is OK, but there is no meaningful result to be returned.
  Throws:
    `ExecutionException` - on failure to undo

### canExecute

    public boolean canExecute()

### canUndo

    public boolean canUndo()

### canRedo

    public boolean canRedo()

### getAffectedFiles

    public java.util.List getAffectedFiles()

  Description copied from class: `AbstractCommand`
  Returns the `IFile`s that may be modified when the operation is executed, undone or redone.

  Specified by:
    `getAffectedFiles` in interface `ICommand`
  Overrides:
    `getAffectedFiles` in class `AbstractCommand`

### addContext

    public void addContext(IUndoContext context)

  Adds the context to my wrapped command.

### removeContext

    public void removeContext(IUndoContext context)

  Removes the context from my wrapped command.

### dispose

    public void dispose()

  Specified by:
    `dispose` in interface `IUndoableOperation`
  Overrides:
    `dispose` in class `AbstractCommand`

Runtime

Guidelines for using Eclipse APIs.

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