* @see org.eclipse.gef.editpolicies.AbstractEditPolicy#getCommand(org.eclipse.gef.Request)
*/
@Override
public Command getCommand(Request request) {
if (request instanceof ItemCreationRequest) {
ItemCreationRequest r = (ItemCreationRequest) request;
DesignPosition position = findPosition((ItemCreationRequest)request);
if (position == null) {
return null;
}
IDOMPosition domposition = DOMPositionHelper.toDOMPosition(position);
if (domposition == null) {
return null;
}
// since the head tag is a widget, the offset will need
// to be updated in the position so that new node is
// appended to the list of children.
Node node = domposition.getContainerNode();
domposition = new DOMPosition(node, node.getChildNodes().getLength());
return new CreateItemCommand(
PDPlugin
.getResourceString("ItemCreationEditPolicy.CommandLabel.CreateItem"),//$NON-NLS-1$
getViewer(getHost()).getModel(), domposition, r.getTagCreationProvider());
}
return null;
}