de.cau.cs.kieler.ksbase.ui.handler
Class TransformationCommand

java.lang.Object
  extended by org.eclipse.core.commands.operations.AbstractOperation
      extended by org.eclipse.emf.workspace.AbstractEMFOperation
          extended by org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand
              extended by de.cau.cs.kieler.ksbase.ui.handler.TransformationCommand
All Implemented Interfaces:
IUndoableOperation, ICommand, org.eclipse.gmf.runtime.common.core.internal.command.ICommandWithSettableResult

public class TransformationCommand
extends AbstractTransactionalCommand

The command to execute a transformation.

Rating proposed yellow
(2009-12-15)

Constructor Summary
TransformationCommand(TransactionalEditingDomain domain, String label, IAdaptable adapter)
          Creates a command to execute a transformation.
 
Method Summary
protected  CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info)
          Executes the transformation.
 boolean initialize(IEditorPart editPart, List<Object> selection, String command, String fileName, List<String> packages, ITransformationFramework framework)
          Initializes the transformation.
 
Methods inherited from class org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand
aggregateStatuses, cleanup, compose, didRedo, didUndo, doExecute, 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, canExecute, 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, canExecute, canRedo, canUndo, dispose, execute, getContexts, getLabel, hasContext, redo, removeContext, undo
 

Constructor Detail

TransformationCommand

public TransformationCommand(TransactionalEditingDomain domain,
                             String label,
                             IAdaptable adapter)
Creates a command to execute a transformation.

Parameters:
domain - the editing domain through which model changes are made
label - the command label
adapter - an adapter to the View of the base diagram
Method Detail

doExecuteWithResult

protected CommandResult doExecuteWithResult(IProgressMonitor monitor,
                                            IAdaptable info)
                                     throws ExecutionException
Executes the transformation. This will only work, if a component has been set before.

Specified by:
doExecuteWithResult in class AbstractTransactionalCommand
Parameters:
monitor - Progress monitor for the execution
info - Additional informations for the command
Returns:
Either an Error/Warning command result if the execution failed, or else OK
Throws:
ExecutionException - if the Execution failed due to a critical error.
See Also:
AbstractTransactionalCommand #doExecuteWithResult(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)

initialize

public final boolean initialize(IEditorPart editPart,
                                List<Object> selection,
                                String command,
                                String fileName,
                                List<String> packages,
                                ITransformationFramework framework)
Initializes the transformation.

Parameters:
editPart - Current edit part
selection - Current selection
command - The command to execute
fileName - Name of the transformation file
packages - The packages of the underlying meta model
framework - The transformation framework to use for execution
Returns:
False if an error occurred