Modelers

org.topcased.modeler.commands
Class CreateGraphEdgeCommand

java.lang.Object
  extended by org.eclipse.gef.commands.Command
      extended by org.topcased.modeler.commands.CreateGraphEdgeCommand
Direct Known Subclasses:
CreateTypedEdgeCommand

public class CreateGraphEdgeCommand
extends org.eclipse.gef.commands.Command

Creation command for association
This command just add a graphEdge into a graphNode. It also add the contained element to the element of the parent graph node if needed.

creation : 30 nov. 2004


Constructor Summary
CreateGraphEdgeCommand(org.eclipse.gef.EditDomain domain, GraphEdge newObj, GraphElement src, boolean needModelUpdate)
          Constructor.
CreateGraphEdgeCommand(org.eclipse.gef.EditDomain domain, GraphEdge newObj, GraphElement src, java.util.List featuresList, boolean needModelUpdate)
          Constructor
 
Method Summary
 boolean canExecute()
           
 void execute()
           
 GraphElement getContainer()
          Get the container GraphElement
 GraphEdge getEdge()
          Get the GraphEdge
 org.eclipse.gef.EditDomain getEditDomain()
          Get the EditDomain
 GraphElement getSource()
          Get the source GraphNode
 GraphElement getTarget()
          Get the target GraphNode
protected  void initName()
          Give a unique name to the model object inside the current diagram
protected  void initName(EObject cont)
          Give a unique name to the model object inside the current diagram
protected  boolean isUpdateModel()
          Return a boolean value used to update or not the model
 void redo()
           
protected  void redoModel()
          Update the model after at the end of the redo() method.
 void setTarget(GraphElement target)
          Set the target node
 void undo()
           
protected  void undoModel()
          Update the model at the end of the undo() method.
 
Methods inherited from class org.eclipse.gef.commands.Command
canUndo, chain, dispose, getDebugLabel, getLabel, setDebugLabel, setLabel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CreateGraphEdgeCommand

public CreateGraphEdgeCommand(org.eclipse.gef.EditDomain domain,
                              GraphEdge newObj,
                              GraphElement src,
                              boolean needModelUpdate)
Constructor. Call the super constructor with : - the container for the edge = the container of the source node - the features list = null

Parameters:
domain - the EditDomain (used to init the name)
newObj - the edge to create
src - the source node
needModelUpdate - true if the model must be modified during this command, false if objects already exist in the mode.

CreateGraphEdgeCommand

public CreateGraphEdgeCommand(org.eclipse.gef.EditDomain domain,
                              GraphEdge newObj,
                              GraphElement src,
                              java.util.List featuresList,
                              boolean needModelUpdate)
Constructor

Parameters:
domain - the EditDomain (used to init the name)
newObj - the edge to create
src - the source node
featuresList - to be define
needModelUpdate - true if the model must be modified during this command, false if objects already exist in the mode.
Method Detail

setTarget

public void setTarget(GraphElement target)
Set the target node

Parameters:
target - the target node

canExecute

public boolean canExecute()
Overrides:
canExecute in class org.eclipse.gef.commands.Command
See Also:
Command.canExecute()

execute

public void execute()
Overrides:
execute in class org.eclipse.gef.commands.Command
See Also:
Command.execute()

redo

public void redo()
Overrides:
redo in class org.eclipse.gef.commands.Command
See Also:
Command.redo()

redoModel

protected void redoModel()
Update the model after at the end of the redo() method. This method should be overriden by subclasses.


initName

protected void initName()
Give a unique name to the model object inside the current diagram


initName

protected void initName(EObject cont)
Give a unique name to the model object inside the current diagram

Parameters:
cont - The container model object of the connection

undo

public void undo()
Overrides:
undo in class org.eclipse.gef.commands.Command
See Also:
Command.undo()

undoModel

protected void undoModel()
Update the model at the end of the undo() method. This method should be overriden by subclasses.


isUpdateModel

protected boolean isUpdateModel()
Return a boolean value used to update or not the model

Returns:
false if the command is coming from a DND request

getEdge

public GraphEdge getEdge()
Get the GraphEdge

Returns:
GraphEdge

getSource

public GraphElement getSource()
Get the source GraphNode

Returns:
GraphElement

getTarget

public GraphElement getTarget()
Get the target GraphNode

Returns:
GraphElement

getContainer

public GraphElement getContainer()
Get the container GraphElement

Returns:
GraphElement

getEditDomain

public org.eclipse.gef.EditDomain getEditDomain()
Get the EditDomain

Returns:
EditDomain

Modelers

Copyright (c) 2005 TOPCASED Contributors 2005 - 2007. All rights reserved.