Package org.eclipse.gef.requests
Class CreateRequest
- java.lang.Object
-
- org.eclipse.gef.Request
-
- org.eclipse.gef.requests.CreateRequest
-
- All Implemented Interfaces:
DropRequest
- Direct Known Subclasses:
CreateConnectionRequest
public class CreateRequest extends Request implements DropRequest
A Request to create a new object.
-
-
Constructor Summary
Constructors Constructor Description CreateRequest()
Creates a CreateRequest with the default type.CreateRequest(java.lang.Object type)
Creates a CreateRequest with the given type.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected CreationFactory
getFactory()
Returns the CreationFactory for this request.org.eclipse.draw2d.geometry.Point
getLocation()
Returns the location of the object to be created.java.lang.Object
getNewObject()
Gets the new object from the factory and returns that object.java.lang.Object
getNewObjectType()
Returns the type of the new object.org.eclipse.draw2d.geometry.Dimension
getSize()
Returns the size of the object to be created.boolean
isSnapToEnabled()
Returnstrue
if snap-to is enabledvoid
setFactory(CreationFactory factory)
Sets the factory to be used when creating the new object.void
setLocation(org.eclipse.draw2d.geometry.Point location)
Sets the location where the new object will be placed.void
setSize(org.eclipse.draw2d.geometry.Dimension size)
Sets the size of the new object.void
setSnapToEnabled(boolean value)
Used to set whether snap-to is being performed.-
Methods inherited from class org.eclipse.gef.Request
getExtendedData, getType, setExtendedData, setType
-
-
-
-
Method Detail
-
getFactory
protected CreationFactory getFactory()
Returns the CreationFactory for this request.- Returns:
- the CreationFactory
-
getLocation
public org.eclipse.draw2d.geometry.Point getLocation()
Returns the location of the object to be created.- Specified by:
getLocation
in interfaceDropRequest
- Returns:
- the location
-
getNewObject
public java.lang.Object getNewObject()
Gets the new object from the factory and returns that object.- Returns:
- the new object
-
getNewObjectType
public java.lang.Object getNewObjectType()
Returns the type of the new object.- Returns:
- the type of the new object
-
getSize
public org.eclipse.draw2d.geometry.Dimension getSize()
Returns the size of the object to be created.- Returns:
- the size
-
isSnapToEnabled
public boolean isSnapToEnabled()
Returnstrue
if snap-to is enabled- Returns:
true
if the request is for a creation with snap-to enabled- Since:
- 3.7
-
setFactory
public void setFactory(CreationFactory factory)
Sets the factory to be used when creating the new object.- Parameters:
factory
- the factory
-
setLocation
public void setLocation(org.eclipse.draw2d.geometry.Point location)
Sets the location where the new object will be placed.- Parameters:
location
- the location
-
setSize
public void setSize(org.eclipse.draw2d.geometry.Dimension size)
Sets the size of the new object.- Parameters:
size
- the size
-
setSnapToEnabled
public void setSnapToEnabled(boolean value)
Used to set whether snap-to is being performed.- Parameters:
value
-true
if the request is for a creation with snap-to enabled- Since:
- 3.7
-
-