Search in sources :

Example 1 with CreateConnectionViewRequest

use of org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest in project tdi-studio-se by Talend.

the class BusinessProcessCanonicalEditPolicy method createConnections.

/**
     * @generated
     */
private Collection createConnections(Collection linkDescriptors) {
    if (linkDescriptors.isEmpty()) {
        return Collections.EMPTY_LIST;
    }
    List adapters = new LinkedList();
    for (Iterator linkDescriptorsIterator = linkDescriptors.iterator(); linkDescriptorsIterator.hasNext(); ) {
        final LinkDescriptor nextLinkDescriptor = (LinkDescriptor) linkDescriptorsIterator.next();
        EditPart sourceEditPart = getEditPartFor(nextLinkDescriptor.getSource());
        EditPart targetEditPart = getEditPartFor(nextLinkDescriptor.getDestination());
        if (sourceEditPart == null || targetEditPart == null) {
            continue;
        }
        CreateConnectionViewRequest.ConnectionViewDescriptor descriptor = new CreateConnectionViewRequest.ConnectionViewDescriptor(nextLinkDescriptor.getSemanticAdapter(), null, ViewUtil.APPEND, false, ((IGraphicalEditPart) getHost()).getDiagramPreferencesHint());
        CreateConnectionViewRequest ccr = new CreateConnectionViewRequest(descriptor);
        ccr.setType(RequestConstants.REQ_CONNECTION_START);
        ccr.setSourceEditPart(sourceEditPart);
        sourceEditPart.getCommand(ccr);
        ccr.setTargetEditPart(targetEditPart);
        ccr.setType(RequestConstants.REQ_CONNECTION_END);
        Command cmd = targetEditPart.getCommand(ccr);
        if (cmd != null && cmd.canExecute()) {
            executeCommand(cmd);
            IAdaptable viewAdapter = (IAdaptable) ccr.getNewObject();
            if (viewAdapter != null) {
                adapters.add(viewAdapter);
            }
        }
    }
    return adapters;
}
Also used : IAdaptable(org.eclipse.core.runtime.IAdaptable) DeferredLayoutCommand(org.eclipse.gmf.runtime.diagram.ui.commands.DeferredLayoutCommand) Command(org.eclipse.gef.commands.Command) CreateConnectionViewRequest(org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest) Iterator(java.util.Iterator) DatabaseBusinessItemEditPart(org.talend.designer.business.model.business.diagram.edit.parts.DatabaseBusinessItemEditPart) TerminalBusinessItemEditPart(org.talend.designer.business.model.business.diagram.edit.parts.TerminalBusinessItemEditPart) ActionBusinessItemEditPart(org.talend.designer.business.model.business.diagram.edit.parts.ActionBusinessItemEditPart) DirectionalBusinessItemRelationshipEditPart(org.talend.designer.business.model.business.diagram.edit.parts.DirectionalBusinessItemRelationshipEditPart) ListBusinessItemEditPart(org.talend.designer.business.model.business.diagram.edit.parts.ListBusinessItemEditPart) DataBusinessItemEditPart(org.talend.designer.business.model.business.diagram.edit.parts.DataBusinessItemEditPart) BusinessItemRelationshipEditPart(org.talend.designer.business.model.business.diagram.edit.parts.BusinessItemRelationshipEditPart) GearBusinessItemEditPart(org.talend.designer.business.model.business.diagram.edit.parts.GearBusinessItemEditPart) InputBusinessItemEditPart(org.talend.designer.business.model.business.diagram.edit.parts.InputBusinessItemEditPart) ActorBusinessItemEditPart(org.talend.designer.business.model.business.diagram.edit.parts.ActorBusinessItemEditPart) DocumentBusinessItemEditPart(org.talend.designer.business.model.business.diagram.edit.parts.DocumentBusinessItemEditPart) EllipseBusinessItemEditPart(org.talend.designer.business.model.business.diagram.edit.parts.EllipseBusinessItemEditPart) BusinessProcessEditPart(org.talend.designer.business.model.business.diagram.edit.parts.BusinessProcessEditPart) BidirectionalBusinessItemRelationshipEditPart(org.talend.designer.business.model.business.diagram.edit.parts.BidirectionalBusinessItemRelationshipEditPart) DecisionBusinessItemEditPart(org.talend.designer.business.model.business.diagram.edit.parts.DecisionBusinessItemEditPart) EditPart(org.eclipse.gef.EditPart) IGraphicalEditPart(org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart) LinkedList(java.util.LinkedList) List(java.util.List) LinkedList(java.util.LinkedList)

Aggregations

Iterator (java.util.Iterator)1 LinkedList (java.util.LinkedList)1 List (java.util.List)1 IAdaptable (org.eclipse.core.runtime.IAdaptable)1 EditPart (org.eclipse.gef.EditPart)1 Command (org.eclipse.gef.commands.Command)1 DeferredLayoutCommand (org.eclipse.gmf.runtime.diagram.ui.commands.DeferredLayoutCommand)1 IGraphicalEditPart (org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart)1 CreateConnectionViewRequest (org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest)1 ActionBusinessItemEditPart (org.talend.designer.business.model.business.diagram.edit.parts.ActionBusinessItemEditPart)1 ActorBusinessItemEditPart (org.talend.designer.business.model.business.diagram.edit.parts.ActorBusinessItemEditPart)1 BidirectionalBusinessItemRelationshipEditPart (org.talend.designer.business.model.business.diagram.edit.parts.BidirectionalBusinessItemRelationshipEditPart)1 BusinessItemRelationshipEditPart (org.talend.designer.business.model.business.diagram.edit.parts.BusinessItemRelationshipEditPart)1 BusinessProcessEditPart (org.talend.designer.business.model.business.diagram.edit.parts.BusinessProcessEditPart)1 DataBusinessItemEditPart (org.talend.designer.business.model.business.diagram.edit.parts.DataBusinessItemEditPart)1 DatabaseBusinessItemEditPart (org.talend.designer.business.model.business.diagram.edit.parts.DatabaseBusinessItemEditPart)1 DecisionBusinessItemEditPart (org.talend.designer.business.model.business.diagram.edit.parts.DecisionBusinessItemEditPart)1 DirectionalBusinessItemRelationshipEditPart (org.talend.designer.business.model.business.diagram.edit.parts.DirectionalBusinessItemRelationshipEditPart)1 DocumentBusinessItemEditPart (org.talend.designer.business.model.business.diagram.edit.parts.DocumentBusinessItemEditPart)1 EllipseBusinessItemEditPart (org.talend.designer.business.model.business.diagram.edit.parts.EllipseBusinessItemEditPart)1