Search in sources :

Example 1 with DnDOverCompositeRequest

use of org.whole.lang.ui.requests.DnDOverCompositeRequest in project whole by wholeplatform.

the class AbstractConnectedFreeformRootPart method createEditPolicies.

// public IFigure getContentPane() {
// return pane;
// }
protected void createEditPolicies() {
    installEditPolicy(EditPolicy.CONTAINER_ROLE, new WholeContainerEditPolicy(getCommandFactory()));
    installEditPolicy(EditPolicy.COMPONENT_ROLE, new WholeComponentEditPolicy(getCommandFactory()));
    installEditPolicy(EditPolicy.LAYOUT_ROLE, new WholeFreeformLayoutEditPolicy((XYLayout) getContentPane().getLayoutManager(), getCommandFactory()) {

        protected DnDOverCompositeRequest createDnDOverCompositeRequest(IEntity entity) {
            return new DnDOverCompositeRequest(PartRequest.MOVE_ADD_CHILD, (IEntityPart) getHost(), entity, null) {

                @Override
                public IEntity getModelEntity() {
                    // FIXME workaround to get nodes composite
                    IEntity modelEntity = super.getModelEntity().wGet(0);
                    return modelEntity;
                }
            };
        }
    });
    installEditPolicy("Snap Feedback", new SnapFeedbackPolicy());
}
Also used : WholeContainerEditPolicy(org.whole.lang.ui.editpolicies.WholeContainerEditPolicy) DnDOverCompositeRequest(org.whole.lang.ui.requests.DnDOverCompositeRequest) WholeComponentEditPolicy(org.whole.lang.ui.editpolicies.WholeComponentEditPolicy) WholeFreeformLayoutEditPolicy(org.whole.lang.ui.editpolicies.WholeFreeformLayoutEditPolicy) IEntity(org.whole.lang.model.IEntity) EntityXYLayout(org.whole.lang.ui.layout.EntityXYLayout) XYLayout(org.eclipse.draw2d.XYLayout) SnapFeedbackPolicy(org.eclipse.gef.editpolicies.SnapFeedbackPolicy)

Example 2 with DnDOverCompositeRequest

use of org.whole.lang.ui.requests.DnDOverCompositeRequest in project whole by wholeplatform.

the class WholeFlowLayoutEditPolicy method getCreateCommand.

protected Command getCreateCommand(CreateRequest request) {
    Object newObject = request.getNewObject();
    if (newObject instanceof IEntity) {
        IEntityPart compositePart = (IEntityPart) getHost();
        IEntityPart afterPart = (IEntityPart) getInsertionReference(request);
        return commandFactory.create(new DnDOverCompositeRequest(PartRequest.MOVE_ADD_CHILD, compositePart, (IEntity) newObject, afterPart));
    // CompositeAddCommand cmd = new CompositeAddCommand();
    // cmd.setComposite(compositePart.getModelEntity());
    // cmd.setNewChild((IEntity) newObject);
    // cmd.setPrevChild(afterPart == null ? null : afterPart.getModelEntity());
    // return cmd;
    }
    return UnexecutableCommand.INSTANCE;
}
Also used : DnDOverCompositeRequest(org.whole.lang.ui.requests.DnDOverCompositeRequest) IEntity(org.whole.lang.model.IEntity) IEntityPart(org.whole.lang.ui.editparts.IEntityPart)

Aggregations

IEntity (org.whole.lang.model.IEntity)2 DnDOverCompositeRequest (org.whole.lang.ui.requests.DnDOverCompositeRequest)2 XYLayout (org.eclipse.draw2d.XYLayout)1 SnapFeedbackPolicy (org.eclipse.gef.editpolicies.SnapFeedbackPolicy)1 IEntityPart (org.whole.lang.ui.editparts.IEntityPart)1 WholeComponentEditPolicy (org.whole.lang.ui.editpolicies.WholeComponentEditPolicy)1 WholeContainerEditPolicy (org.whole.lang.ui.editpolicies.WholeContainerEditPolicy)1 WholeFreeformLayoutEditPolicy (org.whole.lang.ui.editpolicies.WholeFreeformLayoutEditPolicy)1 EntityXYLayout (org.whole.lang.ui.layout.EntityXYLayout)1