Search in sources :

Example 1 with ChopboxAnchor

use of org.eclipse.draw2d.ChopboxAnchor in project tdi-studio-se by Talend.

the class NodePart method getSourceConnectionAnchor.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.gef.NodeEditPart#getSourceConnectionAnchor(org.eclipse.gef.Request)
     */
@Override
public ConnectionAnchor getSourceConnectionAnchor(final Request request) {
    if (!DesignerPlugin.getDefault().getPreferenceStore().getBoolean(TalendDesignerPrefConstants.EDITOR_LINESTYLE)) {
        return new ChopboxAnchor(getFigure());
    }
    if (!(request instanceof CreateConnectionRequest)) {
        if (request instanceof ReconnectRequest) {
            IFigure figure = ((ReconnectRequest) request).getConnectionEditPart().getFigure();
            if (figure instanceof ConnectionFigure) {
                ((ConnectionFigure) figure).setConnectionRouter(new TalendBorderItemRectilinearRouter(request));
            }
        }
        return new ChopboxAnchor(getFigure());
    }
    CreateConnectionRequest connReq = (CreateConnectionRequest) request;
    Node source = (Node) ((NodePart) connReq.getSourceEditPart()).getModel();
    // Node target = (Node) ((NodePart) connReq.getTargetEditPart()).getModel();
    // // System.out.println("getSource=> location:" + connReq.getLocation() + " / source:" + source.getLocation() +
    // "
    // // / target:"
    // // + target.getLocation());
    sourceAnchor = new DummyNodeAnchor((NodeFigure) getFigure(), source, false);
    return sourceAnchor;
}
Also used : ReconnectRequest(org.eclipse.gef.requests.ReconnectRequest) ChopboxAnchor(org.eclipse.draw2d.ChopboxAnchor) TalendBorderItemRectilinearRouter(org.talend.designer.core.ui.editor.connections.TalendBorderItemRectilinearRouter) ConnectionFigure(org.talend.designer.core.ui.editor.connections.ConnectionFigure) IExternalNode(org.talend.core.model.process.IExternalNode) INode(org.talend.core.model.process.INode) IGraphicalNode(org.talend.core.ui.process.IGraphicalNode) CreateConnectionRequest(org.eclipse.gef.requests.CreateConnectionRequest) IFigure(org.eclipse.draw2d.IFigure)

Example 2 with ChopboxAnchor

use of org.eclipse.draw2d.ChopboxAnchor in project cogtool by cogtool.

the class DesignEditorTransition method changeTarget.

public void changeTarget(DesignEditorFrame newTargetFigure) {
    setTargetAnchor(new ChopboxAnchor(newTargetFigure));
    connections = transition.getCurveIndex();
}
Also used : ChopboxAnchor(org.eclipse.draw2d.ChopboxAnchor)

Example 3 with ChopboxAnchor

use of org.eclipse.draw2d.ChopboxAnchor in project tdi-studio-se by Talend.

the class NodePart method getTargetConnectionAnchor.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.gef.NodeEditPart#getTargetConnectionAnchor(org.eclipse.gef.Request)
     */
@Override
public ConnectionAnchor getTargetConnectionAnchor(final Request request) {
    if (!DesignerPlugin.getDefault().getPreferenceStore().getBoolean(TalendDesignerPrefConstants.EDITOR_LINESTYLE)) {
        return new ChopboxAnchor(getFigure());
    }
    if (!(request instanceof CreateConnectionRequest)) {
        if (request instanceof ReconnectRequest) {
            IFigure figure = ((ReconnectRequest) request).getConnectionEditPart().getFigure();
            if (figure instanceof ConnectionFigure) {
                ((ConnectionFigure) figure).setConnectionRouter(new TalendBorderItemRectilinearRouter(request));
            }
        }
        return new ChopboxAnchor(getFigure());
    }
    CreateConnectionRequest connReq = (CreateConnectionRequest) request;
    Node source = (Node) ((NodePart) connReq.getSourceEditPart()).getModel();
    Node target = (Node) ((NodePart) connReq.getTargetEditPart()).getModel();
    // // + target.getLocation());
    if (sourceAnchor != null) {
        sourceAnchor.setTarget(target);
    }
    return new DummyNodeAnchor((NodeFigure) getFigure(), source, target, true);
}
Also used : ReconnectRequest(org.eclipse.gef.requests.ReconnectRequest) ChopboxAnchor(org.eclipse.draw2d.ChopboxAnchor) TalendBorderItemRectilinearRouter(org.talend.designer.core.ui.editor.connections.TalendBorderItemRectilinearRouter) ConnectionFigure(org.talend.designer.core.ui.editor.connections.ConnectionFigure) IExternalNode(org.talend.core.model.process.IExternalNode) INode(org.talend.core.model.process.INode) IGraphicalNode(org.talend.core.ui.process.IGraphicalNode) CreateConnectionRequest(org.eclipse.gef.requests.CreateConnectionRequest) IFigure(org.eclipse.draw2d.IFigure)

Aggregations

ChopboxAnchor (org.eclipse.draw2d.ChopboxAnchor)3 IFigure (org.eclipse.draw2d.IFigure)2 CreateConnectionRequest (org.eclipse.gef.requests.CreateConnectionRequest)2 ReconnectRequest (org.eclipse.gef.requests.ReconnectRequest)2 IExternalNode (org.talend.core.model.process.IExternalNode)2 INode (org.talend.core.model.process.INode)2 IGraphicalNode (org.talend.core.ui.process.IGraphicalNode)2 ConnectionFigure (org.talend.designer.core.ui.editor.connections.ConnectionFigure)2 TalendBorderItemRectilinearRouter (org.talend.designer.core.ui.editor.connections.TalendBorderItemRectilinearRouter)2