|
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.edithelper.AbstractEditHelper
public abstract class AbstractEditHelper
Abstract edit helper implementation. Implements the default edit command algorithm, which returns a composite command containing the following:
The before and after commands are obtained by consulting the edit helper advice that is bound to the edit helper context in the edit request. Edit helper advice can be inherited from supertypes.
Clients should subclass this class when creating new edit helpers.
Constructor Summary | |
---|---|
AbstractEditHelper()
|
Method Summary | |
---|---|
protected boolean |
approveRequest(IEditCommandRequest request)
Approves the edit gesture described in the request . |
boolean |
canEdit(IEditCommandRequest req)
Checks that I can get an executable edit command. |
protected void |
configureRequest(IEditCommandRequest request)
Approves the edit gesture described in the request . |
protected ICompositeCommand |
createCommand(IEditCommandRequest req)
Creates a new composite command. |
protected ICommand |
getBasicDestroyElementCommand(DestroyElementRequest req)
Gets the command to destroy a single child of an element of my kind, and only it. |
protected ICommand |
getConfigureCommand(ConfigureRequest req)
Gets the command to configure a new element of my kind. |
java.util.List |
getContainedValues(org.eclipse.emf.ecore.EObject eContainer,
org.eclipse.emf.ecore.EReference feature)
Gets the values that can be contained in the feature of
eContainer . |
protected ICommand |
getCreateCommand(CreateElementRequest req)
Gets the command to create a new element in an element of my kind. |
protected ICommand |
getCreateRelationshipCommand(CreateRelationshipRequest req)
Gets the command to create a new relationship in an element of my kind. |
protected org.eclipse.emf.ecore.EReference |
getDefaultContainmentFeature(org.eclipse.emf.ecore.EClass eClass)
Gets the default feature to contain the eClass . |
protected java.util.Map |
getDefaultContainmentFeatures()
|
protected ICommand |
getDestroyDependentsCommand(DestroyDependentsRequest req)
Gets the command to destroy dependents of an element of my kind. |
protected ICommand |
getDestroyElementCommand(DestroyElementRequest req)
Gets the command to destroy a child of an element of my kind. |
protected ICommand |
getDestroyElementWithDependentsCommand(DestroyElementRequest req)
Gets the command to destroy a single child of an element of my kind along with its dependents (not related by containment). |
protected ICommand |
getDestroyReferenceCommand(DestroyReferenceRequest req)
Gets the command to remove a reference from an element of my kind. |
protected ICommand |
getDuplicateCommand(DuplicateElementsRequest req)
Gets the command to duplicate a child in an element of my kind. |
ICommand |
getEditCommand(IEditCommandRequest req)
Builds and returns the edit command, which is a composite command containing the following: 'before' commands from matching element type specializations 'instead' command from this edit helper 'after' commands from matching element type specializations Verifies that the edit request is approved before constructing the edit command. |
protected ICommand |
getEditContextCommand(GetEditContextRequest req)
Gets the command to create or return the edit context element for the creation of a new element of my kind (e.g., when creating a relationship, the relationship may be owned by the source or target, or some ancestor of one or the other, or both). |
protected IEditHelperAdvice[] |
getEditHelperAdvice(IEditCommandRequest req)
Gets the array of edit helper advice for this request. |
protected ICommand |
getInsteadCommand(IEditCommandRequest req)
Gets my command to do the work described in req . |
protected ICommand |
getMoveCommand(MoveRequest req)
Gets the command to move an element into an element of my kind. |
protected ICommand |
getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req)
Gets the command to change the source or target of a reference in an element of my kind. |
protected ICommand |
getReorientRelationshipCommand(ReorientRelationshipRequest req)
Gets the command to change the source or target of a relationship in an element of my kind. |
protected ICommand |
getSetCommand(SetRequest req)
Gets the command to set a value of an element of my kind. |
void |
initializeDefaultFeature(CreateElementRequest req)
Sets the default feature in req , if there is no
containment feature already in the request. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AbstractEditHelper()
Method Detail |
---|
public boolean canEdit(IEditCommandRequest req)
Subclasses should override if they have a different way to decide whether or not the edit is allowed.
canEdit
in interface IEditHelper
req
- the edit request
true
if the requested edit can be performed,
false
otherwise.public ICommand getEditCommand(IEditCommandRequest req)
Verifies that the edit request is approved before constructing the edit command.
getEditCommand
in interface IEditHelper
req
- the edit request
null
if none could be foundprotected void configureRequest(IEditCommandRequest request)
request
. This
method will be consulted before the edit request is approved.
The default implementation does nothing. Subclasses should override if they wish to change the request parameters.
request
- the edit requestprotected boolean approveRequest(IEditCommandRequest request)
request
. This
method will be consulted before the edit command is constructed.
The default implementation returns true
. Subclasses
should override if they wish to provide a different answer.
req
- the edit request
true
if the edit request is approved,
false
otherwise. No edit command will be
constructed if the request is not approved.protected IEditHelperAdvice[] getEditHelperAdvice(IEditCommandRequest req)
req
- the edit request
null
if there is noneprotected ICompositeCommand createCommand(IEditCommandRequest req)
Subclasses may override to provide their own kind of composite command.
req
- the edit request
protected ICommand getInsteadCommand(IEditCommandRequest req)
req
.
Delegates to the more specific methods in this class to actually get the command. Subclasses should override these more specific methods.
req
- the edit request
null
if I
don't support the requested work.public java.util.List getContainedValues(org.eclipse.emf.ecore.EObject eContainer, org.eclipse.emf.ecore.EReference feature)
IEditHelper
feature
of
eContainer
. Such values may be element types that could
be owned by the eContainer
, or actual model element
instances that can be referenced by the feature.
getContainedValues
in interface IEditHelper
eContainer
- the container objectfeature
- the feature of the container object
protected ICommand getConfigureCommand(ConfigureRequest req)
null
. Subclasses may override to provide their
command.
req
- the configure request
protected ICommand getCreateRelationshipCommand(CreateRelationshipRequest req)
Returns the IdentityCommand
if the request does not have a source
or a target. This ensures that the create relationship gesture is enabled
until the request can be completely specified.
Subclasses may override to provide their own command.
req
- the create relationship request
protected ICommand getCreateCommand(CreateElementRequest req)
req
- the create request
public void initializeDefaultFeature(CreateElementRequest req)
req
, if there is no
containment feature already in the request.
req
- the create requestprotected org.eclipse.emf.ecore.EReference getDefaultContainmentFeature(org.eclipse.emf.ecore.EClass eClass)
eClass
.
Returns null
by default. Subclasses should override to
provide the default feature, if there is one.
eClass
- the EClass
protected java.util.Map getDefaultContainmentFeatures()
protected ICommand getSetCommand(SetRequest req)
null
. Subclasses may override to provide their
command.
req
- the set request
protected ICommand getEditContextCommand(GetEditContextRequest req)
null
edit context.
Subclasses may override to provide their command.
req
- the get edit context request
protected ICommand getBasicDestroyElementCommand(DestroyElementRequest req)
DestroyElementCommand
. Subclasses
may override to provide their own command.
req
- the destroy request
protected ICommand getDestroyElementWithDependentsCommand(DestroyElementRequest req)
req
- the destroy request
protected ICommand getDestroyElementCommand(DestroyElementRequest req)
req
- the destroy request
element to destroy
along with its contents and other dependentsprotected ICommand getDestroyDependentsCommand(DestroyDependentsRequest req)
null
. Subclasses may override to provide
a command.
req
- the destroy dependents request
null
protected ICommand getDestroyReferenceCommand(DestroyReferenceRequest req)
null
. Subclasses may override to provide
their command.
req
- the destroy reference request
protected ICommand getDuplicateCommand(DuplicateElementsRequest req)
null
. Subclasses may override to provide
their command.
req
- the duplicate request
protected ICommand getMoveCommand(MoveRequest req)
null
. Subclasses may override to provide
their command.
req
- the move request
protected ICommand getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req)
null
. Subclasses
may override to provide their command.
req
- the reorient reference request
protected ICommand getReorientRelationshipCommand(ReorientRelationshipRequest req)
null
. Subclasses
may override to provide their command.
req
- the reorient relationship request
|
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.