|
Runtime | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.gmf.runtime.emf.type.core.requests.AbstractEditCommandRequest
org.eclipse.gmf.runtime.emf.type.core.requests.DestroyRequest
org.eclipse.gmf.runtime.emf.type.core.requests.DestroyDependentsRequest
public class DestroyDependentsRequest
Request to destroy the dependents of a model element. It is expected that
the request will be served primarily by advice, which can invoke the
getDestroyDependentCommand(EObject)
to obtain a command to destroy
an object dependent on the element being destroyed
and have it added to the edit command. However, an edit helper can also
provide an "instead" command by overriding its
getDestroyDependentsCommand(DestroyDependentsRequest)
method
to do the same.
The destruction of dependents is an edit requested of the element being
destroyed, unlike the DestroyElementRequest
, which is requested of
the container of the element being destroyed.
Field Summary |
---|
Fields inherited from interface org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest |
---|
REPLACE_DEFAULT_COMMAND |
Constructor Summary | |
---|---|
DestroyDependentsRequest(org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain,
org.eclipse.emf.ecore.EObject elementToDestroy,
boolean confirmationRequired)
Constructs a new request to destroy the dependents of a model element. |
Method Summary | |
---|---|
protected boolean |
addDependentElementToDestroy(org.eclipse.emf.ecore.EObject dependent)
Indicates that the command that fulfils this request will also destroy the specified dependent of the element to be destroyed . |
org.eclipse.emf.ecore.EObject |
getContainer()
Gets the container of the element to be destroyed. |
protected java.lang.String |
getDefaultLabel()
Gets the default edit command label. |
java.util.Set |
getDependentElementsToDestroy()
Obtains an immutable view of the set of dependent elements to destroy. |
ICommand |
getDestroyDependentCommand(org.eclipse.emf.ecore.EObject dependent)
Obtains a command that destroys the specified dependent of
the element to be destroyed, if it
is not already being destroyed by the processing of the current
DestroyElementRequest . |
ICommand |
getDestroyDependentsCommand(java.util.Collection dependents)
Obtains a command that destroys the specified dependents of
the element to be destroyed, if they
are not already being destroyed by the processing of the current
DestroyElementRequest . |
java.lang.Object |
getEditHelperContext()
Gets the edit helper context for this request. |
org.eclipse.emf.transaction.TransactionalEditingDomain |
getEditingDomain()
Derives the editing domain from the object to be destroyed, if it hasn't already been specified. |
java.util.List |
getElementsToEdit()
Gets the elements that will be changed when the work is done for this request. |
org.eclipse.emf.ecore.EObject |
getElementToDestroy()
Gets the element to be destroyed. |
protected java.util.Set |
internalGetDependentElementsToDestroy()
Obtains the mutable set of dependent elements to destroy. |
protected boolean |
isElementToBeDestroyed(org.eclipse.emf.ecore.EObject eObject)
Queries whether the specified element will be destroyed as a result of the fulfillment of this request. |
void |
setElementToDestroy(org.eclipse.emf.ecore.EObject elementToDestroy)
Sets the element to be destroyed. |
Methods inherited from class org.eclipse.gmf.runtime.emf.type.core.requests.DestroyRequest |
---|
isConfirmationRequired, setConfirm |
Methods inherited from class org.eclipse.gmf.runtime.emf.type.core.requests.AbstractEditCommandRequest |
---|
addParameters, getClientContext, getLabel, getParameter, getParameters, setClientContext, setEditingDomain, setLabel, setParameter |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DestroyDependentsRequest(org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain, org.eclipse.emf.ecore.EObject elementToDestroy, boolean confirmationRequired)
editingDomain
- the editing domain in which I am requesting to make modelelementToDestroy
- the element to be destroyedconfirmationRequired
- true
if the user should be prompted to confirm
the element deletion, false
otherwise.Method Detail |
---|
public final org.eclipse.emf.ecore.EObject getElementToDestroy()
public final void setElementToDestroy(org.eclipse.emf.ecore.EObject elementToDestroy)
elementToDestroy
- the element to be destroyedpublic org.eclipse.emf.ecore.EObject getContainer()
DestroyRequest
getContainer
in class DestroyRequest
public java.util.List getElementsToEdit()
IEditCommandRequest
getElementsToEdit
in interface IEditCommandRequest
getElementsToEdit
in class DestroyRequest
protected java.lang.String getDefaultLabel()
AbstractEditCommandRequest
getDefaultLabel
in class DestroyRequest
public java.lang.Object getEditHelperContext()
IEditCommandRequest
IElementType
or an EObject
, or an
IEditHelperContext
. It determines which edit helper should be
used to find a command to do the work in the request.
getEditHelperContext
in interface IEditCommandRequest
getEditHelperContext
in class DestroyRequest
public org.eclipse.emf.transaction.TransactionalEditingDomain getEditingDomain()
getEditingDomain
in interface IEditCommandRequest
getEditingDomain
in class AbstractEditCommandRequest
protected final java.util.Set internalGetDependentElementsToDestroy()
public final java.util.Set getDependentElementsToDestroy()
public ICommand getDestroyDependentCommand(org.eclipse.emf.ecore.EObject dependent)
dependent
of
the element to be destroyed, if it
is not already being destroyed by the processing of the current
DestroyElementRequest
. This command can then be composed with
others by the edit helper processing the DestroyDependentsRequest
.
dependent
- an object dependent on the element being destroyed,
which must also be destroyed
dependent
, or
null
if the element is already being destroyed
java.lang.IllegalArgumentException
- on an attempt to destroy the
element to be destroyed (as a
dependent of itself)
java.lang.NullPointerException
- on attempt to destroy a null
dependentgetDestroyDependentsCommand(Collection)
public ICommand getDestroyDependentsCommand(java.util.Collection dependents)
dependents
of
the element to be destroyed, if they
are not already being destroyed by the processing of the current
DestroyElementRequest
. This command can then be composed with
others by the edit helper processing the DestroyDependentsRequest
.
dependents
- dependents of the element being destroyed
dependents
,
or null
if they are all already being destroyedgetDestroyDependentCommand(EObject)
protected boolean addDependentElementToDestroy(org.eclipse.emf.ecore.EObject dependent)
element to be destroyed
. Note that
contained elements are implicitly considered to be dependent; they need
not be handled by this mechanism.
Advice that provides a command to destroy a dependent element
must indicate that fact by calling this method (only after
checking whether it isn't already
being destroyed
, anyway).
dependent
- another object to destroy, which is dependent on the
element for which we are requesting destruction
true
if the dependent
was not already
in the set of elements being destroyed; false
, otherwise
java.lang.IllegalArgumentException
- on an attempt to add the
element to be destroyed
as a dependent
of itself
java.lang.NullPointerException
- on attempt to add a null
objectisElementToBeDestroyed(EObject)
,
getElementToDestroy()
,
getDestroyDependentCommand(EObject)
protected boolean isElementToBeDestroyed(org.eclipse.emf.ecore.EObject eObject)
eObject
- an element
true
if the command that fulfils this request
would destroy the specified element; false
if a new
command would have to be composed with it to destroy the element
|
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.