Runtime

org.eclipse.gmf.runtime.emf.type.core.edithelper
Class AbstractEditHelperAdvice

java.lang.Object
  extended by org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice
All Implemented Interfaces:
IEditHelperAdvice
Direct Known Subclasses:
NotationViewDependentsAdvice, RemoveBookmarksAdvice

public class AbstractEditHelperAdvice
extends java.lang.Object
implements IEditHelperAdvice

Abstract superclass for edit helper advice classes that provide 'before' and 'after' advice for modifying model elements.

Subclasses can override the implementation for only the specific methods for the kinds of requests that they provide advice for. For convenience, these methods all return null by default.

Edit helper advice can be registered against one or more element types using the org.eclipse.gmf.runtime.emf.type.core.elementTypes extension point.


Constructor Summary
AbstractEditHelperAdvice()
           
 
Method Summary
 boolean approveRequest(IEditCommandRequest request)
          Returns true by default.
 void configureRequest(IEditCommandRequest request)
          Does nothing by default.
protected  org.eclipse.emf.ecore.EObject createType(org.eclipse.emf.ecore.EObject container, IElementType typeToCreate, IProgressMonitor progressMonitor)
          Convenience method to create a new element of kind typeToCreate in the context of container.
protected  org.eclipse.emf.ecore.EObject createType(org.eclipse.emf.ecore.EObject container, IElementType typeToCreate, java.util.Map requestParameters, IProgressMonitor progressMonitor)
          Convenience method to create a new element of kind typeToCreate in the context of container.
protected  ICommand getAfterConfigureCommand(ConfigureRequest request)
          Gets my 'after' advice for configuring a new element.
protected  ICommand getAfterCreateCommand(CreateElementRequest request)
          Gets my 'after' advice for creating the new element.
protected  ICommand getAfterCreateRelationshipCommand(CreateRelationshipRequest request)
          Gets my 'after' advice for creating the new relationship.
protected  ICommand getAfterDestroyDependentsCommand(DestroyDependentsRequest request)
          Gets my 'after' advice for destroying the dependents of an element that is being destroyed.
protected  ICommand getAfterDestroyElementCommand(DestroyElementRequest request)
          Gets my 'after' advice for destroying an element.
protected  ICommand getAfterDestroyReferenceCommand(DestroyReferenceRequest request)
          Gets my 'after' advice for destroying an reference.
protected  ICommand getAfterDuplicateCommand(DuplicateElementsRequest request)
          Gets my 'after' advice for duplicating an element.
 ICommand getAfterEditCommand(IEditCommandRequest request)
          Gets a command to be executed after the base editing behaviour.
protected  ICommand getAfterEditContextCommand(GetEditContextRequest request)
          Gets my 'after' advice for getting the edit context for an edit request.
protected  ICommand getAfterMoveCommand(MoveRequest request)
          Gets my 'after' advice for moving an element into a new container.
protected  ICommand getAfterReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest request)
          Gets my 'after' advice for changing the source or target of a reference relationship.
protected  ICommand getAfterReorientRelationshipCommand(ReorientRelationshipRequest request)
          Gets my 'after' advice for changing the source or target of a relationship.
protected  ICommand getAfterSetCommand(SetRequest request)
          Gets my 'after' advice for setting the value of a feature in an element.
protected  ICommand getBeforeConfigureCommand(ConfigureRequest request)
          Gets my 'before' advice for configuring a new element.
protected  ICommand getBeforeCreateCommand(CreateElementRequest request)
          Gets my 'before' advice for creating the new element.
protected  ICommand getBeforeCreateRelationshipCommand(CreateRelationshipRequest request)
          Gets my 'before' advice for creating the new relationship.
protected  ICommand getBeforeDestroyDependentsCommand(DestroyDependentsRequest request)
          Gets my 'before' advice for destroying the dependents of an element that is being destroyed.
protected  ICommand getBeforeDestroyElementCommand(DestroyElementRequest request)
          Gets my 'before' advice for destroying an element.
protected  ICommand getBeforeDestroyReferenceCommand(DestroyReferenceRequest request)
          Gets my 'before' advice for destroying a reference.
protected  ICommand getBeforeDuplicateCommand(DuplicateElementsRequest request)
          Gets my 'before' advice for duplicating an element.
 ICommand getBeforeEditCommand(IEditCommandRequest request)
          Gets a command to be executed before the base editing behaviour.
protected  ICommand getBeforeEditContextCommand(GetEditContextRequest request)
          Gets my 'before' advice for getting the edit context for an edit request.
protected  ICommand getBeforeMoveCommand(MoveRequest request)
          Gets my 'before' advice for moving an element into a new container.
protected  ICommand getBeforeReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest request)
          Gets my 'before' advice for changing the source or target of a reference relationship.
protected  ICommand getBeforeReorientRelationshipCommand(ReorientRelationshipRequest request)
          Gets my 'before' advice for changing the source or target of a relationship.
protected  ICommand getBeforeSetCommand(SetRequest request)
          Gets my 'before' advice for setting the value of a feature in an element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractEditHelperAdvice

public AbstractEditHelperAdvice()
Method Detail

getBeforeEditCommand

public ICommand getBeforeEditCommand(IEditCommandRequest request)
Description copied from interface: IEditHelperAdvice
Gets a command to be executed before the base editing behaviour.

Specified by:
getBeforeEditCommand in interface IEditHelperAdvice
Parameters:
request - the request
Returns:
the 'before' command, or null if I do not provide 'before' behaviour.

getAfterEditCommand

public ICommand getAfterEditCommand(IEditCommandRequest request)
Description copied from interface: IEditHelperAdvice
Gets a command to be executed after the base editing behaviour.

Specified by:
getAfterEditCommand in interface IEditHelperAdvice
Parameters:
request - the request
Returns:
the 'after' command, or null if I do not provide 'after' behaviour.

getBeforeCreateRelationshipCommand

protected ICommand getBeforeCreateRelationshipCommand(CreateRelationshipRequest request)
Gets my 'before' advice for creating the new relationship.

Parameters:
request - the request
Returns:
the command to execute before the edit helper work is done

getAfterCreateRelationshipCommand

protected ICommand getAfterCreateRelationshipCommand(CreateRelationshipRequest request)
Gets my 'after' advice for creating the new relationship.

Parameters:
request - the request
Returns:
the command to execute after the edit helper work is done

getBeforeCreateCommand

protected ICommand getBeforeCreateCommand(CreateElementRequest request)
Gets my 'before' advice for creating the new element.

Parameters:
request - the request
Returns:
the command to execute before the edit helper work is done

getAfterCreateCommand

protected ICommand getAfterCreateCommand(CreateElementRequest request)
Gets my 'after' advice for creating the new element.

Parameters:
request - the request
Returns:
the command to execute after the edit helper work is done

getBeforeConfigureCommand

protected ICommand getBeforeConfigureCommand(ConfigureRequest request)
Gets my 'before' advice for configuring a new element.

Parameters:
request - the request
Returns:
the command to execute before the edit helper work is done

getAfterConfigureCommand

protected ICommand getAfterConfigureCommand(ConfigureRequest request)
Gets my 'after' advice for configuring a new element.

Parameters:
request - the request
Returns:
the command to execute after the edit helper work is done

getBeforeDestroyElementCommand

protected ICommand getBeforeDestroyElementCommand(DestroyElementRequest request)
Gets my 'before' advice for destroying an element.

Parameters:
request - the request
Returns:
the command to execute before the edit helper work is done

getAfterDestroyElementCommand

protected ICommand getAfterDestroyElementCommand(DestroyElementRequest request)
Gets my 'after' advice for destroying an element.

Parameters:
request - the request
Returns:
the command to execute after the edit helper work is done

getBeforeDestroyDependentsCommand

protected ICommand getBeforeDestroyDependentsCommand(DestroyDependentsRequest request)
Gets my 'before' advice for destroying the dependents of an element that is being destroyed.

Parameters:
request - the request
Returns:
the command to execute before the edit helper work is done

getAfterDestroyDependentsCommand

protected ICommand getAfterDestroyDependentsCommand(DestroyDependentsRequest request)
Gets my 'after' advice for destroying the dependents of an element that is being destroyed.

Parameters:
request - the request
Returns:
the command to execute after the edit helper work is done

getBeforeDestroyReferenceCommand

protected ICommand getBeforeDestroyReferenceCommand(DestroyReferenceRequest request)
Gets my 'before' advice for destroying a reference.

Parameters:
request - the request
Returns:
the command to execute before the edit helper work is done

getAfterDestroyReferenceCommand

protected ICommand getAfterDestroyReferenceCommand(DestroyReferenceRequest request)
Gets my 'after' advice for destroying an reference.

Parameters:
request - the request
Returns:
the command to execute after the edit helper work is done

getBeforeDuplicateCommand

protected ICommand getBeforeDuplicateCommand(DuplicateElementsRequest request)
Gets my 'before' advice for duplicating an element.

Parameters:
request - the request
Returns:
the command to execute before the edit helper work is done

getAfterDuplicateCommand

protected ICommand getAfterDuplicateCommand(DuplicateElementsRequest request)
Gets my 'after' advice for duplicating an element.

Parameters:
request - the request
Returns:
the command to execute after the edit helper work is done

getBeforeEditContextCommand

protected ICommand getBeforeEditContextCommand(GetEditContextRequest request)
Gets my 'before' advice for getting the edit context for an edit request.

Parameters:
request - the request
Returns:
the command to execute before the edit helper work is done

getAfterEditContextCommand

protected ICommand getAfterEditContextCommand(GetEditContextRequest request)
Gets my 'after' advice for getting the edit context for an edit request.

Parameters:
request - the request
Returns:
the command to execute after the edit helper work is done

getBeforeMoveCommand

protected ICommand getBeforeMoveCommand(MoveRequest request)
Gets my 'before' advice for moving an element into a new container.

Parameters:
request - the request
Returns:
the command to execute before the edit helper work is done

getAfterMoveCommand

protected ICommand getAfterMoveCommand(MoveRequest request)
Gets my 'after' advice for moving an element into a new container.

Parameters:
request - the request
Returns:
the command to execute after the edit helper work is done

getBeforeReorientReferenceRelationshipCommand

protected ICommand getBeforeReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest request)
Gets my 'before' advice for changing the source or target of a reference relationship.

Parameters:
request - the request
Returns:
the command to execute before the edit helper work is done

getAfterReorientReferenceRelationshipCommand

protected ICommand getAfterReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest request)
Gets my 'after' advice for changing the source or target of a reference relationship.

Parameters:
request - the request
Returns:
the command to execute after the edit helper work is done

getBeforeReorientRelationshipCommand

protected ICommand getBeforeReorientRelationshipCommand(ReorientRelationshipRequest request)
Gets my 'before' advice for changing the source or target of a relationship.

Parameters:
request - the request
Returns:
the command to execute before the edit helper work is done

getAfterReorientRelationshipCommand

protected ICommand getAfterReorientRelationshipCommand(ReorientRelationshipRequest request)
Gets my 'after' advice for changing the source or target of a relationship.

Parameters:
request - the request
Returns:
the command to execute after the edit helper work is done

getBeforeSetCommand

protected ICommand getBeforeSetCommand(SetRequest request)
Gets my 'before' advice for setting the value of a feature in an element.

Parameters:
request - the request
Returns:
the command to execute before the edit helper work is done

getAfterSetCommand

protected ICommand getAfterSetCommand(SetRequest request)
Gets my 'after' advice for setting the value of a feature in an element.

Parameters:
request - the request
Returns:
the command to execute after the edit helper work is done

createType

protected org.eclipse.emf.ecore.EObject createType(org.eclipse.emf.ecore.EObject container,
                                                   IElementType typeToCreate,
                                                   IProgressMonitor progressMonitor)
Convenience method to create a new element of kind typeToCreate in the context of container.

Parameters:
container - the container element
typeToCreate - the kind of element to create
Returns:
the newly created element, or null if it wasn't created

createType

protected org.eclipse.emf.ecore.EObject createType(org.eclipse.emf.ecore.EObject container,
                                                   IElementType typeToCreate,
                                                   java.util.Map requestParameters,
                                                   IProgressMonitor progressMonitor)
Convenience method to create a new element of kind typeToCreate in the context of container.

Parameters:
container - the container element
typeToCreate - the kind of element to create
requestParameters - parameters to be set in the creation request
Returns:
the newly created element, or null if it wasn't created

configureRequest

public void configureRequest(IEditCommandRequest request)
Does nothing by default. Subclasses should override if they want to add, modify or remove parameters in the request.

Specified by:
configureRequest in interface IEditHelperAdvice
Parameters:
request - the edit request to be configured.

approveRequest

public boolean approveRequest(IEditCommandRequest request)
Returns true by default. Subclasses should override if they want to give a different answer.

Specified by:
approveRequest in interface IEditHelperAdvice
Parameters:
request - the edit request
Returns:
true if the edit request is approved, false otherwise. No edit command will be constructed if the request is not approved.

Runtime

Guidelines for using Eclipse APIs.

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