Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Runtime

org.eclipse.gmf.runtime.emf.commands.core.commands
Class DuplicateEObjectsCommand

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 
org.eclipse.gmf.runtime.emf.commands.core.commands.DuplicateEObjectsCommand
All Implemented Interfaces:
IUndoableOperation, ICommand, org.eclipse.gmf.runtime.common.core.internal.command.ICommandWithSettableResult

public abstract class DuplicateEObjectsCommand
extends AbstractTransactionalCommand

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, 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

DuplicateEObjectsCommand

public 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.

Parameters:
editingDomain - the editing domain through which model changes are made
label - The label for the new command.
eObjectsToBeDuplicated - The list of EObjects to be duplicated.

DuplicateEObjectsCommand

public 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.

Parameters:
editingDomain - the editing domain through which model changes are made
label - 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.

DuplicateEObjectsCommand

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)
Constructs a new duplicate EObjects command with the specified label and list of EObjects. Also sets the list of affected files to be the files, where the targetContainer is stored. Target container specifies the eObject into which the duplicated eObjects will be added.

Parameters:
editingDomain - the editing domain through which model changes are made
label - 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

getAllDuplicatedObjectsMap

protected java.util.Map getAllDuplicatedObjectsMap()
Returns a map which contains all the 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.

Returns:
The map of duplicated objects.

getObjectsToBeDuplicated

protected java.util.List getObjectsToBeDuplicated()
Returns the list of objects to be duplicated.

Returns:
The list of objects to be duplicated.

canExecute

public boolean canExecute()
Verifies that the container of all the original objects can contain multiple objects.

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

doExecuteWithResult

protected 
CommandResult doExecuteWithResult(
IProgressMonitor progressMonitor,
                                            
IAdaptable info)
                                     throws 
ExecutionException
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.

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

Runtime

Guidelines for using Eclipse APIs.

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


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire