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
Answertopia.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.type.core.requests
Class CreateElementRequest

java.lang.Object
  extended by 

org.eclipse.gmf.runtime.emf.type.core.requests.AbstractEditCommandRequest
      extended by 
org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest
All Implemented Interfaces:
IEditCommandRequest
Direct Known Subclasses:
CreateRelationshipRequest

public class CreateElementRequest
extends AbstractEditCommandRequest

Request to create a new model element.

If the request is not constructed with the editing domain through which to create the new model element, it will be derived from the container element.


Field Summary
 
Fields inherited from interface org.eclipse.gmf.runtime.emf.type.core.requests. IEditCommandRequest
REPLACE_DEFAULT_COMMAND
 
Constructor Summary
CreateElementRequest (org.eclipse.emf.ecore.EObject container, IElementType elementType)
          Creates a request to create a new model element.
CreateElementRequest (org.eclipse.emf.ecore.EObject container, IElementType elementType, org.eclipse.emf.ecore.EReference containmentFeature)
          Creates a request to create a new model element.
CreateElementRequest ( IElementType elementType)
          Creates a request to create a new model element.
CreateElementRequest (org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain, org.eclipse.emf.ecore.EObject container, IElementType elementType)
          Creates a request to create a new model element.
CreateElementRequest (org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain, org.eclipse.emf.ecore.EObject container, IElementType elementType, org.eclipse.emf.ecore.EReference containmentFeature)
          Creates a request to create a new model element.
CreateElementRequest (org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain, IElementType elementType)
          Creates a request to create a new model element.
 
Method Summary
 org.eclipse.emf.ecore.EObject createContainer ()
          Sets the appropriate container for the new element.
  IClientContext getClientContext ()
          Infers the client context from getElementType() if the context has not be explicity set.
 org.eclipse.emf.ecore.EObject getContainer ()
          Gets the original context in which the new element will be created.
 org.eclipse.emf.ecore.EReference getContainmentFeature ()
          Gets the containment feature in which to create the new element.
protected  java.lang.String getDefaultLabel ()
          Gets the default edit command label.
 java.lang.Object getEditHelperContext ()
          Makes a request for the context of the new element from its element type.
 org.eclipse.emf.transaction.TransactionalEditingDomain getEditingDomain ()
          Gets the editing domain in which I am requesting to make model changes.
 java.util.List getElementsToEdit ()
          Gets the elements that will be changed when the work is done for this request.
  IElementType getElementType ()
          Gets the element type for the new model element.
 org.eclipse.emf.ecore.EObject getNewElement ()
          Gets the new element that has been created by this request.
 void initializeContainmentFeature (org.eclipse.emf.ecore.EReference feature)
          Sets the containment feature in which to create the new element.
protected  void invalidateContainmentFeature ()
          Invalidates the cached containment feature.
protected  void invalidateEditHelperContext ()
          Invalidates the cached edit context request and command.
 void setClientContext ( IClientContext clientContext)
          Sets the client context for this request.
 void setContainer (org.eclipse.emf.ecore.EObject container)
          Sets the container for the new element.
 void setContainmentFeature (org.eclipse.emf.ecore.EReference containmentFeature)
          Sets the containment feature in which to create the new element.
 void setNewElement (org.eclipse.emf.ecore.EObject element)
          Sets the element that has been created by this request.
 void setParameter (java.lang.String parameterName, java.lang.Object value)
          Sets the value of the parameter named parameterName to value.
 
Methods inherited from class org.eclipse.gmf.runtime.emf.type.core.requests. AbstractEditCommandRequest
addParameters, getLabel, getParameter, getParameters, setEditingDomain, setLabel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CreateElementRequest

public CreateElementRequest(org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain,
                            org.eclipse.emf.ecore.EObject container,
                            
IElementType elementType)
Creates a request to create a new model element.

Parameters:
editingDomain - the editing domain in which I am requesting to make model changes.
container - the container for the new model element
elementType - the element type of the new model element

CreateElementRequest

public CreateElementRequest(org.eclipse.emf.ecore.EObject container,
                            
IElementType elementType)
Creates a request to create a new model element. The editing domain will be derived from the container.

Parameters:
container - the container for the new model element
elementType - the element type of the new model element

CreateElementRequest

public CreateElementRequest(
IElementType elementType)
Creates a request to create a new model element. The editing domain will be derived from the result of getContainer().

Parameters:
elementType - the element type of the new model element

CreateElementRequest

public CreateElementRequest(org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain,
                            
IElementType elementType)
Creates a request to create a new model element.

Parameters:
editingDomain - the editing domain in which I am requesting to make model changes.
elementType - the element type of the new model element

CreateElementRequest

public CreateElementRequest(org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain,
                            org.eclipse.emf.ecore.EObject container,
                            
IElementType elementType,
                            org.eclipse.emf.ecore.EReference containmentFeature)
Creates a request to create a new model element.

Parameters:
editingDomain - the editing domain in which I am requesting to make model changes.
container - the container for the new model element
elementType - the element type of the new model element
containmentFeature - The feature in the container which will hold the new model element. Can be null, in which case a default feature will be used.

CreateElementRequest

public CreateElementRequest(org.eclipse.emf.ecore.EObject container,
                            
IElementType elementType,
                            org.eclipse.emf.ecore.EReference containmentFeature)
Creates a request to create a new model element. The editing domain will be derived from the container.

Parameters:
container - the container for the new model element
elementType - the element type of the new model element
containmentFeature - The feature in the container which will hold the new model element. Can be null, in which case a default feature will be used.
Method Detail

getNewElement

public org.eclipse.emf.ecore.EObject getNewElement()
Gets the new element that has been created by this request.

Returns:
the newly created element

setNewElement

public void setNewElement(org.eclipse.emf.ecore.EObject element)
Sets the element that has been created by this request.

Parameters:
element - the newly created element

getContainmentFeature

public org.eclipse.emf.ecore.EReference getContainmentFeature()
Gets the containment feature in which to create the new element. May be null.

Returns:
the containment feature or null if one has not been specified.O

setContainmentFeature

public void setContainmentFeature(org.eclipse.emf.ecore.EReference containmentFeature)
Sets the containment feature in which to create the new element.

Does nothing of the feature has not changed. Othewise, invalidates the edit helper context.

Parameters:
containmentFeature - the containment feature

initializeContainmentFeature

public void initializeContainmentFeature(org.eclipse.emf.ecore.EReference feature)
Sets the containment feature in which to create the new element.

Does nothing of the feature has not changed. Does not invalidate the edit helper context.

Parameters:
containmentFeature - the containment feature

getContainer

public org.eclipse.emf.ecore.EObject getContainer()
Gets the original context in which the new element will be created. This may not be the actual container of the new element until the createContainer method is called.

Returns:
the container for the new element.

createContainer

public org.eclipse.emf.ecore.EObject createContainer()
Sets the appropriate container for the new element. May prompt the user to create the container, so this method should only be called when the command honouring the request is executed.

Updates the value returned by the getContainer, if appropriate.

Returns:
the container for the new element

setContainer

public void setContainer(org.eclipse.emf.ecore.EObject container)
Sets the container for the new element.

Does nothing of the container has not changed. Othewise, invalidates the edit helper context and containment feature.

Parameters:
container - the container for the new element.

setClientContext

public void setClientContext(
IClientContext clientContext)
Description copied from interface: IEditCommandRequest
Sets the client context for this request.

Specified by:
setClientContext in interface IEditCommandRequest
Overrides:
setClientContext in class AbstractEditCommandRequest
Parameters:
clientContext - the client context

getClientContext

public 
IClientContext getClientContext()
Infers the client context from getElementType() if the context has not be explicity set.

Specified by:
getClientContext in interface IEditCommandRequest
Overrides:
getClientContext in class AbstractEditCommandRequest
Returns:
the client context

getElementType

public 
IElementType getElementType()
Gets the element type for the new model element.

Returns:
the element type

getElementsToEdit

public java.util.List getElementsToEdit()
Description copied from interface: IEditCommandRequest
Gets the elements that will be changed when the work is done for this request.

Specified by:
getElementsToEdit in interface IEditCommandRequest
Overrides:
getElementsToEdit in class AbstractEditCommandRequest
Returns:
the elements that will be edited

getDefaultLabel

protected java.lang.String getDefaultLabel()
Description copied from class: AbstractEditCommandRequest
Gets the default edit command label.

Overrides:
getDefaultLabel in class AbstractEditCommandRequest
Returns:
the default label

getEditHelperContext

public java.lang.Object getEditHelperContext()
Makes a request for the context of the new element from its element type. Allows specializations and advice bindings to return the appropriate context, if necessary.

The GetContextCommand will not be executed. This method relies on the command to return the new context element type until it is executed, at which point it can return the real context element, if a new one needs to be created.

Returns:
The edit helper context which can be either the context object or type of context object or a command which is not executable that could contain status information.

setParameter

public void setParameter(java.lang.String parameterName,
                         java.lang.Object value)
Description copied from class: AbstractEditCommandRequest
Sets the value of the parameter named parameterName to value.

Specified by:
setParameter in interface IEditCommandRequest
Overrides:
setParameter in class AbstractEditCommandRequest
Parameters:
parameterName - the parameter name
value - the parameter value

invalidateEditHelperContext

protected void invalidateEditHelperContext()
Invalidates the cached edit context request and command.


invalidateContainmentFeature

protected void invalidateContainmentFeature()
Invalidates the cached containment feature.


getEditingDomain

public org.eclipse.emf.transaction.TransactionalEditingDomain getEditingDomain()
Description copied from interface: IEditCommandRequest
Gets the editing domain in which I am requesting to make model changes.

Specified by:
getEditingDomain in interface IEditCommandRequest
Overrides:
getEditingDomain in class AbstractEditCommandRequest
Returns:
the editing domain

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