Search in sources :

Example 1 with ReplaceChildCommand

use of org.whole.lang.ui.commands.ReplaceChildCommand in project whole by wholeplatform.

the class WholeLayoutEditPolicy method getCreateCommand.

protected Command getCreateCommand(CreateRequest request) {
    // TODO incapsulate in command factory
    Object newObject = request.getNewObject();
    if (newObject instanceof IEntity) {
        IEntityPart hostPart = (IEntityPart) getHost();
        // TODO
        // return commandFactory.create(new
        // DnDOverPartRequest(PartRequest.MOVE_ADD_CHILD,
        // hostPart, ((GroupRequest)request).getEditParts()));
        ReplaceChildCommand cmd = new ReplaceChildCommand();
        cmd.setParent(hostPart.getParentModelEntity());
        cmd.setOldChild(hostPart.getModelEntity());
        cmd.setNewChild((IEntity) newObject);
        return cmd;
    }
    return null;
}
Also used : IEntity(org.whole.lang.model.IEntity) ReplaceChildCommand(org.whole.lang.ui.commands.ReplaceChildCommand) IEntityPart(org.whole.lang.ui.editparts.IEntityPart)

Aggregations

IEntity (org.whole.lang.model.IEntity)1 ReplaceChildCommand (org.whole.lang.ui.commands.ReplaceChildCommand)1 IEntityPart (org.whole.lang.ui.editparts.IEntityPart)1