Search in sources :

Example 1 with ConnectionEndpointEditPolicy

use of org.eclipse.gef.editpolicies.ConnectionEndpointEditPolicy in project tdi-studio-se by Talend.

the class RelationPart method createEditPolicies.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.gef.editparts.AbstractEditPart#createEditPolicies()
     */
@Override
protected void createEditPolicies() {
    // Selection handle edit policy.
    // Makes the connection show a feedback, when selected by the user.
    installEditPolicy(EditPolicy.CONNECTION_ENDPOINTS_ROLE, new ConnectionEndpointEditPolicy());
    // Allows the removal of the connection model element
    installEditPolicy(EditPolicy.CONNECTION_ROLE, new ConnectionEditPolicy() {

        protected Command getDeleteCommand(GroupRequest request) {
            List<Relation> connectionList = new ArrayList<Relation>();
            for (int i = 0; i < request.getEditParts().size(); i++) {
                if (request.getEditParts().get(i) instanceof RelationPart) {
                    connectionList.add(((Relation) ((RelationPart) request.getEditParts().get(i)).getModel()));
                }
            }
            return new RelationDeleteCommand(connectionList);
        }
    });
}
Also used : ConnectionEndpointEditPolicy(org.eclipse.gef.editpolicies.ConnectionEndpointEditPolicy) Relation(org.talend.sqlbuilder.erdiagram.ui.nodes.Relation) ConnectionEditPolicy(org.eclipse.gef.editpolicies.ConnectionEditPolicy) Command(org.eclipse.gef.commands.Command) RelationDeleteCommand(org.talend.sqlbuilder.erdiagram.ui.commands.RelationDeleteCommand) GroupRequest(org.eclipse.gef.requests.GroupRequest) RelationDeleteCommand(org.talend.sqlbuilder.erdiagram.ui.commands.RelationDeleteCommand) ArrayList(java.util.ArrayList) List(java.util.List)

Example 2 with ConnectionEndpointEditPolicy

use of org.eclipse.gef.editpolicies.ConnectionEndpointEditPolicy in project tdi-studio-se by Talend.

the class ConnectionPart method createEditPolicies.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.gef.editparts.AbstractEditPart#createEditPolicies()
     */
@Override
protected void createEditPolicies() {
    // Selection handle edit policy.
    // Makes the connection show a feedback, when selected by the user.
    installEditPolicy(EditPolicy.CONNECTION_ENDPOINTS_ROLE, new ConnectionEndpointEditPolicy());
    // Allows the removal of the connection model element
    installEditPolicy(EditPolicy.CONNECTION_ROLE, new ConnectionEditPolicy() {

        @Override
        protected Command getDeleteCommand(GroupRequest request) {
            if (((Connection) getModel()).isReadOnly()) {
                return null;
            }
            List<Connection> connectionList = new ArrayList<Connection>();
            for (int i = 0; i < request.getEditParts().size(); i++) {
                if (request.getEditParts().get(i) instanceof ConnectionPart) {
                    connectionList.add(((Connection) ((ConnectionPart) request.getEditParts().get(i)).getModel()));
                }
            }
            return new ConnectionDeleteCommand(connectionList);
        }
    });
}
Also used : ConnectionEndpointEditPolicy(org.eclipse.gef.editpolicies.ConnectionEndpointEditPolicy) ConnectionEditPolicy(org.eclipse.gef.editpolicies.ConnectionEditPolicy) ConnectionDeleteCommand(org.talend.designer.core.ui.editor.cmd.ConnectionDeleteCommand) Command(org.eclipse.gef.commands.Command) GroupRequest(org.eclipse.gef.requests.GroupRequest) IConnection(org.talend.core.model.process.IConnection) ConnectionDeleteCommand(org.talend.designer.core.ui.editor.cmd.ConnectionDeleteCommand) ArrayList(java.util.ArrayList) List(java.util.List)

Example 3 with ConnectionEndpointEditPolicy

use of org.eclipse.gef.editpolicies.ConnectionEndpointEditPolicy in project cubrid-manager by CUBRID.

the class RelationshipPart method createEditPolicies.

@Override
protected void createEditPolicies() {
    installEditPolicy(EditPolicy.CONNECTION_ENDPOINTS_ROLE, new ConnectionEndpointEditPolicy());
    installEditPolicy(EditPolicy.COMPONENT_ROLE, new RelationshipEditPolicy());
}
Also used : ConnectionEndpointEditPolicy(org.eclipse.gef.editpolicies.ConnectionEndpointEditPolicy) RelationshipEditPolicy(com.cubrid.common.ui.er.policy.RelationshipEditPolicy)

Example 4 with ConnectionEndpointEditPolicy

use of org.eclipse.gef.editpolicies.ConnectionEndpointEditPolicy in project cubrid-manager by CUBRID.

the class ConnectionPart method createEditPolicies.

/**
	 * @see org.eclipse.gef.editparts.AbstractEditPart#createEditPolicies()
	 */
protected void createEditPolicies() {
    installEditPolicy(EditPolicy.COMPONENT_ROLE, new ConnectionEditPolicy());
    installEditPolicy(EditPolicy.CONNECTION_ENDPOINTS_ROLE, new ConnectionEndpointEditPolicy());
}
Also used : ConnectionEndpointEditPolicy(org.eclipse.gef.editpolicies.ConnectionEndpointEditPolicy) ConnectionEditPolicy(com.cubrid.cubridmanager.ui.replication.editor.policies.ConnectionEditPolicy)

Example 5 with ConnectionEndpointEditPolicy

use of org.eclipse.gef.editpolicies.ConnectionEndpointEditPolicy in project knime-core by knime.

the class ConnectionContainerEditPart method createEditPolicies.

/**
 * {@inheritDoc}
 */
@Override
protected void createEditPolicies() {
    installEditPolicy(EditPolicy.CONNECTION_ENDPOINTS_ROLE, new ConnectionEndpointEditPolicy());
    // enable bendpoints (must be stored in extra info)
    installEditPolicy(EditPolicy.CONNECTION_BENDPOINTS_ROLE, new ConnectionBendpointEditPolicy());
}
Also used : ConnectionEndpointEditPolicy(org.eclipse.gef.editpolicies.ConnectionEndpointEditPolicy) ConnectionBendpointEditPolicy(org.knime.workbench.editor2.editparts.policy.ConnectionBendpointEditPolicy)

Aggregations

ConnectionEndpointEditPolicy (org.eclipse.gef.editpolicies.ConnectionEndpointEditPolicy)13 Command (org.eclipse.gef.commands.Command)3 ConnectionEditPolicy (org.eclipse.gef.editpolicies.ConnectionEditPolicy)3 GroupRequest (org.eclipse.gef.requests.GroupRequest)3 ArrayList (java.util.ArrayList)2 List (java.util.List)2 AssociationBendEditPolicy (org.jkiss.dbeaver.erd.ui.policy.AssociationBendEditPolicy)2 AssociationEditPolicy (org.jkiss.dbeaver.erd.ui.policy.AssociationEditPolicy)2 AssociationBendEditPolicy (org.jkiss.dbeaver.ext.erd.policy.AssociationBendEditPolicy)2 AssociationEditPolicy (org.jkiss.dbeaver.ext.erd.policy.AssociationEditPolicy)2 RelationshipEditPolicy (com.cubrid.common.ui.er.policy.RelationshipEditPolicy)1 ConnectionEditPolicy (com.cubrid.cubridmanager.ui.replication.editor.policies.ConnectionEditPolicy)1 ConnectionDeleteCommand (org.csstudio.opibuilder.commands.ConnectionDeleteCommand)1 ManhattanBendpointEditPolicy (org.csstudio.opibuilder.editpolicies.ManhattanBendpointEditPolicy)1 ConnectionRouter (org.eclipse.draw2d.ConnectionRouter)1 ManhattanConnectionRouter (org.eclipse.draw2d.ManhattanConnectionRouter)1 ReconnectRequest (org.eclipse.gef.requests.ReconnectRequest)1 ConnectionBendpointEditPolicy (org.knime.workbench.editor2.editparts.policy.ConnectionBendpointEditPolicy)1 IConnection (org.talend.core.model.process.IConnection)1 ConnectionDeleteCommand (org.talend.designer.core.ui.editor.cmd.ConnectionDeleteCommand)1