Search in sources :

Example 1 with SemanticEditPolicy

use of org.eclipse.gmf.runtime.diagram.ui.editpolicies.SemanticEditPolicy in project statecharts by Yakindu.

the class StatechartTextEditPart method createDefaultEditPolicies.

@Override
protected void createDefaultEditPolicies() {
    super.createDefaultEditPolicies();
    // Disables deletion of the text compartment view if additional elements
    // are selected too
    installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new SemanticEditPolicy() {

        @Override
        protected boolean shouldProceed(DestroyRequest destroyRequest) {
            return false;
        }
    });
    // Disables deletion of the text compartment view via keyboard
    installEditPolicy(EditPolicy.COMPONENT_ROLE, new RootComponentEditPolicy());
    removeEditPolicy(EditPolicyRoles.CONNECTION_HANDLES_ROLE);
    installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new PreferredSizeHandlerEditPolicy() {

        @Override
        protected IFigure getPreferredSizeFigure() {
            return getChildBySemanticHint(SemanticHints.STATECHART_NAME).getFigure();
        }
    });
}
Also used : SemanticEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.SemanticEditPolicy) RootComponentEditPolicy(org.eclipse.gef.editpolicies.RootComponentEditPolicy) DestroyRequest(org.eclipse.gmf.runtime.emf.type.core.requests.DestroyRequest) PreferredSizeHandlerEditPolicy(org.yakindu.sct.ui.editor.policies.PreferredSizeHandlerEditPolicy) IFigure(org.eclipse.draw2d.IFigure)

Aggregations

IFigure (org.eclipse.draw2d.IFigure)1 RootComponentEditPolicy (org.eclipse.gef.editpolicies.RootComponentEditPolicy)1 SemanticEditPolicy (org.eclipse.gmf.runtime.diagram.ui.editpolicies.SemanticEditPolicy)1 DestroyRequest (org.eclipse.gmf.runtime.emf.type.core.requests.DestroyRequest)1 PreferredSizeHandlerEditPolicy (org.yakindu.sct.ui.editor.policies.PreferredSizeHandlerEditPolicy)1