Runtime

## org.eclipse.gmf.runtime.diagram.core.commands
Class SetPropertyCommand

    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.diagram.core.commands.SetPropertyCommand

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

    public class SetPropertyCommand

extends AbstractTransactionalCommand

A command to a set a property of a view

Constructor Summary
`SetPropertyCommand(TransactionalEditingDomain editingDomain, IAdaptable viewAdapter, java.lang.String propertyId, java.lang.String propertyName, java.lang.Object newValue)` Creates a set property command with a default label based on property name
`SetPropertyCommand(TransactionalEditingDomain editingDomain, java.lang.String label, IAdaptable viewAdapter, java.lang.String propertyId, java.lang.Object newValue)` Creates a set property command with a given label

Method Summary
`protected CommandResult` `doExecuteWithResult(IProgressMonitor progressMonitor, IAdaptable info)` Implemented by subclasses to perform the model changes.
`java.util.List` `getAffectedFiles()` Returns the `IFile`s for resources that may be modified when the operation is executed, undone or redone.
`java.lang.String` `getLabel()`
`protected java.lang.Object` `getNewValue()` Returns the new value of the property.
`protected java.lang.Object` `getPropertyId()` Returns the property Id.
`protected java.lang.String` `getPropertyName()` Gets the property name
`protected org.eclipse.emf.ecore.EStructuralFeature` `getPropertyStructuralFeature()` Returns the value of the feature of the property
`protected IAdaptable` `getViewAdapter()` Returns the view Adapter that owns the property.
`protected void` `setNewValue(java.lang.Object newValue)` Sets the newValue that will be set for the property.
`protected void` `setPropertyId(java.lang.String propertyId)` Sets the propertyId of the property.
`protected void` `setPropertyName(java.lang.String string)` Sets the property name
`protected void` `setViewAdapter(IAdaptable viewAdapter)` Sets the viewAdapter that owns the property.

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

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

Methods inherited from class org.eclipse.core.commands.operations.AbstractOperation
`addContext, canExecute, getContexts, 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, canExecute, canRedo, canUndo, dispose, execute, getContexts, hasContext, redo, removeContext, undo`

Constructor Detail

### SetPropertyCommand

    public SetPropertyCommand(TransactionalEditingDomain editingDomain,
                              java.lang.String label,
                              IAdaptable viewAdapter,
                              java.lang.String propertyId,
                              java.lang.Object newValue)

  Creates a set property command with a given label

  Parameters:
    `editingDomain` - the editing domain
    `label` - the command label
    `viewAdapter` - the view adapter of the `View`that owns the property``
    `propertyId` - the property Id of the property to set
    `newValue` - the new value of the property

### SetPropertyCommand

    public SetPropertyCommand(TransactionalEditingDomain editingDomain,
                              IAdaptable viewAdapter,
                              java.lang.String propertyId,
                              java.lang.String propertyName,
                              java.lang.Object newValue)

  Creates a set property command with a default label based on property name

  Parameters:
    `editingDomain` - the editing domain
    `viewAdapter` - the view adapter of the `View`that owns the property``
    `propertyId` - the property Id of the property to set
    `propertyName` - the property name
    `newValue` - the new value of the property

Method Detail

### getAffectedFiles

    public java.util.List getAffectedFiles()

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

  Specified by:
    `getAffectedFiles` in interface `ICommand`
  Overrides:
    `getAffectedFiles` in class `AbstractTransactionalCommand`
  Returns:
    the list of `IFile`s that will be modified

### getLabel

    public java.lang.String getLabel()

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

### doExecuteWithResult

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

  Description copied from class: `AbstractTransactionalCommand`
  Implemented by subclasses to perform the model changes. These changes are applied by manipulation of the EMF metamodel's API, not by executing commands on the editing domain's command stack.

  Specified by:
    `doExecuteWithResult` in class `AbstractTransactionalCommand`
  Parameters:
    `progressMonitor` - the progress monitor provided by the operation history
    `info` - the adaptable provided by the operation history
  Returns:
    the result of the execution
  Throws:
    `ExecutionException` - if, for some reason, I fail to complete the operation

### getNewValue

    protected java.lang.Object getNewValue()

  Returns the new value of the property.

  Returns:
    the new value

### getPropertyId

    protected java.lang.Object getPropertyId()

  Returns the property Id.

  Returns:
    property Id

### getViewAdapter

    protected IAdaptable getViewAdapter()

  Returns the view Adapter that owns the property.

  Returns:
    the view adapter

### getPropertyName

    protected java.lang.String getPropertyName()

  Gets the property name

  Returns:
    the property name

### setNewValue

    protected void setNewValue(java.lang.Object newValue)

  Sets the newValue that will be set for the property.

  Parameters:
    `newValue` - The newValue to set

### setPropertyId

    protected void setPropertyId(java.lang.String propertyId)

  Sets the propertyId of the property.

  Parameters:
    `propertyId` - The propertyId to set

### setViewAdapter

    protected void setViewAdapter(IAdaptable viewAdapter)

  Sets the viewAdapter that owns the property.

  Parameters:
    `viewAdapter` - The viewAdapter to set

### setPropertyName

    protected void setPropertyName(java.lang.String string)

  Sets the property name

  Parameters:
    `string` - the property name

### getPropertyStructuralFeature

    protected org.eclipse.emf.ecore.EStructuralFeature getPropertyStructuralFeature()

  Returns the value of the feature of the property

  Parameters:
    `view` - the view to use to get the value
    `feature` - the feature to use
  Returns:
    the value of the property, or `null`

Runtime

Guidelines for using Eclipse APIs.

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