Search in sources :

Example 1 with AdjustIdentityAnchorCommand

use of org.yakindu.base.xtext.utils.gmf.commands.AdjustIdentityAnchorCommand in project statecharts by Yakindu.

the class RegionCompartmentEditPart method createDefaultEditPolicies.

@Override
protected void createDefaultEditPolicies() {
    super.createDefaultEditPolicies();
    installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CompartmentCreationEditPolicy());
    installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, new RegionCompartmentCanonicalEditPolicy());
    installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
    installEditPolicy(EditPolicy.LAYOUT_ROLE, new XYLayoutEditPolicy() {

        @Override
        protected Command getResizeChildrenCommand(ChangeBoundsRequest request) {
            // Remove dithering connection anchors
            CompoundCommand result = new CompoundCommand();
            result.add(super.getResizeChildrenCommand(request));
            AdjustIdentityAnchorCommand command = new AdjustIdentityAnchorCommand(TransactionUtil.getEditingDomain(resolveSemanticElement()), request);
            result.add(new ICommandProxy(command));
            return result;
        }
    });
    // Removes the collapse expand handler
    installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ResizableEditPolicyEx());
    installEditPolicy(EditPolicyRoles.SNAP_FEEDBACK_ROLE, new SimpleSnapFeedbackPolicy());
}
Also used : ChangeBoundsRequest(org.eclipse.gef.requests.ChangeBoundsRequest) ICommandProxy(org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy) ResizableEditPolicyEx(org.eclipse.gmf.runtime.diagram.ui.editpolicies.ResizableEditPolicyEx) XYLayoutEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.XYLayoutEditPolicy) AdjustIdentityAnchorCommand(org.yakindu.base.xtext.utils.gmf.commands.AdjustIdentityAnchorCommand) CompoundCommand(org.eclipse.gef.commands.CompoundCommand) Command(org.eclipse.gef.commands.Command) AdjustIdentityAnchorCommand(org.yakindu.base.xtext.utils.gmf.commands.AdjustIdentityAnchorCommand) CompartmentCreationEditPolicy(org.yakindu.sct.ui.editor.policies.CompartmentCreationEditPolicy) RegionCompartmentCanonicalEditPolicy(org.yakindu.sct.ui.editor.policies.RegionCompartmentCanonicalEditPolicy) DragDropEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy) CompoundCommand(org.eclipse.gef.commands.CompoundCommand)

Aggregations

Command (org.eclipse.gef.commands.Command)1 CompoundCommand (org.eclipse.gef.commands.CompoundCommand)1 ChangeBoundsRequest (org.eclipse.gef.requests.ChangeBoundsRequest)1 ICommandProxy (org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy)1 DragDropEditPolicy (org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy)1 ResizableEditPolicyEx (org.eclipse.gmf.runtime.diagram.ui.editpolicies.ResizableEditPolicyEx)1 XYLayoutEditPolicy (org.eclipse.gmf.runtime.diagram.ui.editpolicies.XYLayoutEditPolicy)1 AdjustIdentityAnchorCommand (org.yakindu.base.xtext.utils.gmf.commands.AdjustIdentityAnchorCommand)1 CompartmentCreationEditPolicy (org.yakindu.sct.ui.editor.policies.CompartmentCreationEditPolicy)1 RegionCompartmentCanonicalEditPolicy (org.yakindu.sct.ui.editor.policies.RegionCompartmentCanonicalEditPolicy)1