|
Runtime | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.core.commands.operations.AbstractOperation
org.eclipse.emf.workspace.AbstractEMFOperation
org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand
org.eclipse.gmf.runtime.emf.commands.core.commands.DuplicateEObjectsCommand
public abstract class DuplicateEObjectsCommand
This command duplicates a list of EObjects
and adds each
duplicate to it's originator's container. All references between objects that
are duplicated are updated to refer to the new duplicated objects.
The command returns a map which contains all the EObjects
that
were duplicated mapped to their new duplicated objects. This map can also be
retrieved prior to having executed the command (it will be populated when the
command is executed). NOTE: The keyset of this map is not just the original
objects passed in; more objects may have been duplicated as well (e.g.
contained objects).
Constructor Summary | |
---|---|
DuplicateEObjectsCommand(org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain,
java.lang.String label,
java.util.List eObjectsToBeDuplicated)
Constructs a new duplicate EObjects command with the specified label and list of EObjects. |
|
DuplicateEObjectsCommand(org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain,
java.lang.String label,
java.util.List eObjectsToBeDuplicated,
java.util.Map allDuplicatedObjectsMap)
Constructs a new duplicate EObjects command with the specified label and list of EObjects. |
|
DuplicateEObjectsCommand(org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain,
java.lang.String label,
java.util.List eObjectsToBeDuplicated,
java.util.Map allDuplicatedObjectsMap,
org.eclipse.emf.ecore.EObject targetContainer)
Constructs a new duplicate EObjects command with the specified label and list of EObjects. |
Method Summary | |
---|---|
boolean |
canExecute()
Verifies that the container of all the original objects can contain multiple objects. |
protected CommandResult |
doExecuteWithResult(IProgressMonitor progressMonitor,
IAdaptable info)
Executes this command by duplicating the orignal eobjects, adding the duplicates to the original's container, and populating the map of duplicates to be returned. |
protected java.util.Map |
getAllDuplicatedObjectsMap()
Returns a map which contains all the EObjects that were
duplicated mapped to their new duplicated objects. |
protected java.util.List |
getObjectsToBeDuplicated()
Returns the list of objects to be duplicated. |
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, canUndo, didCommit, dispose, execute, getChange, getEditingDomain, getOptions, redo, 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 |
---|
public DuplicateEObjectsCommand(org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain, java.lang.String label, java.util.List eObjectsToBeDuplicated)
editingDomain
- the editing domain through which model changes are madelabel
- The label for the new command.eObjectsToBeDuplicated
- The list of EObjects
to be duplicated.public DuplicateEObjectsCommand(org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain, java.lang.String label, java.util.List eObjectsToBeDuplicated, java.util.Map allDuplicatedObjectsMap)
editingDomain
- the editing domain through which model changes are madelabel
- The label for the new command.eObjectsToBeDuplicated
- The list of EObjects
to be duplicated.allDuplicatedObjectsMap
- An empty map to be populated with the duplicated objects.public DuplicateEObjectsCommand(org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain, java.lang.String label, java.util.List eObjectsToBeDuplicated, java.util.Map allDuplicatedObjectsMap, org.eclipse.emf.ecore.EObject targetContainer)
editingDomain
- the editing domain through which model changes are madelabel
- The label for the new command.eObjectsToBeDuplicated
- The list of EObjects
to be duplicated.allDuplicatedObjectsMap
- An empty map to be populated with the duplicated objects.Method Detail |
---|
protected java.util.Map getAllDuplicatedObjectsMap()
EObjects
that were
duplicated mapped to their new duplicated objects. NOTE: The keyset of
this map is not just the original objects passed in; more objects may
have been duplicated as well (e.g. contained objects). This map can be
retrieved prior to command execution time. It will be populated when the
command is executed.
protected java.util.List getObjectsToBeDuplicated()
public boolean canExecute()
canExecute
in interface IUndoableOperation
canExecute
in class AbstractOperation
protected CommandResult doExecuteWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException
doExecuteWithResult
in class AbstractTransactionalCommand
progressMonitor
- the progress monitor provided by the operation historyinfo
- the adaptable provided by the operation history
ExecutionException
- if, for some reason, I fail to complete
the operation
|
Runtime | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Guidelines for using Eclipse APIs.
Copyright (c) IBM Corp., Borland Software Corp., and others 2005,2006. All rights reserved.