public interface IBoxTool extends IDiagramTool
In a diagram, graphic boxes are graphic objects that display diagram nodes. For example Packages and Classes are
IBoxCommand is the interface that drives the interaction of creating a box
The interaction is started when the user clicks on the button in the diagram palette. Once the interaction is started
the user can use the mouse to create a new graphic box in the diagram. The
acceptElement method is called to know if the element flown
over by the mouse is valid for the command. If it is not valid the user cannot finish the interaction. If the element
is valid the user can terminates the interaction by either clicking or by pressing the left mouse button doing a drag
and drop and releasing the mouse button. Once this is done the
actionPerformed is called.
actionPerformed is in charge of creating the
model element in the model and of unmasking the element in the diagram.
This interface is intended to be implemented by MDA Components in order to add commands in a diagram palette.
|Modifier and Type||Method and Description|
This method accepts or refuses the interaction in the diagram.
This method is called when the interaction is validated by the user.
boolean acceptElement(IDiagramHandle diagramHandle, IDiagramGraphic targetNode)
This method is called until the interaction is validated by the user.
If the interaction is allowed the method returns
If the interaction is not allowed the method return
false. In this case the mouse pointer is changed
to a "forbidden" icon
diagramHandle- a handle of the diagram in which the interaction occurs.
targetNode- the graphic that is below the mouse pointer.
void actionPerformed(IDiagramHandle diagramHandle, IDiagramGraphic parent, org.eclipse.draw2d.geometry.Rectangle rect)
The method is in charge of creating the model element in the model and of unmasking the element in the diagram.
If the user click or click and drag in a graphic box the parent argument contains the diagram node container corresponding to graphic box. If the user click or click and drag in the diagram background, parent is null.
The rect argument is the rectangle that result from the user interaction with the diagram. This rect should be used to manage the unmasking of the model element in the diagram.
diagramHandle- the representation of the diagram where the command has been triggered.
parent- the graphic parent where the user has clicked.
rect- the rectangle of the object to create.
IDiagramHandle.unmask(MObject, int, int)