use of org.talend.designer.core.ui.editor.connections.ConnectionFigure in project tdi-studio-se by Talend.
the class TalendEditorComponentCreationAssist method highlightOveredConnection.
private void highlightOveredConnection(org.eclipse.swt.graphics.Point cursorRelativePosition) {
if (overedConnection != null) {
overedConnection.setLineWidth(1);
overedConnection = null;
}
EditPart findObjectAt = graphicViewer.findObjectAt(new Point(cursorRelativePosition.x, cursorRelativePosition.y));
if (findObjectAt instanceof ConnectionPart) {
overedConnection = (ConnectionFigure) ((ConnectionPart) findObjectAt).getFigure();
} else if (findObjectAt instanceof ConnLabelEditPart) {
overedConnection = (ConnectionFigure) ((ConnectionPart) ((ConnLabelEditPart) findObjectAt).getParent()).getFigure();
}
if (overedConnection != null) {
overedConnection.setLineWidth(2);
}
}
use of org.talend.designer.core.ui.editor.connections.ConnectionFigure 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;
}
use of org.talend.designer.core.ui.editor.connections.ConnectionFigure in project tdi-studio-se by Talend.
the class CreateComponentOnLinkHelper method unselectAllConnections.
public static void unselectAllConnections(SubjobContainerPart containerPart) {
List children = containerPart.getChildren();
for (int i = 0; i < children.size(); i++) {
Object object = children.get(i);
if (object instanceof NodeContainerPart) {
NodeContainerPart nodeContainerPart = (NodeContainerPart) object;
Object nodePart = nodeContainerPart.getChildren().get(0);
if (nodePart instanceof NodePart) {
List sourceConnections = ((NodePart) nodePart).getSourceConnections();
for (int j = 0; j < sourceConnections.size(); j++) {
Object connectionPart = sourceConnections.get(j);
if (connectionPart instanceof ConnectionPart) {
ConnectionPart connPart = (ConnectionPart) connectionPart;
org.talend.designer.core.ui.editor.connections.Connection conn = (org.talend.designer.core.ui.editor.connections.Connection) connPart.getModel();
ConnectionFigure fig = (ConnectionFigure) connPart.getFigure();
if (fig.getLineWidth() != 1) {
fig.setLineWidth(1);
connPart.refresh();
}
}
}
}
}
}
}
use of org.talend.designer.core.ui.editor.connections.ConnectionFigure in project tdi-studio-se by Talend.
the class CreateComponentOnLinkHelper method selectConnection.
public static void selectConnection(Connection connection, SubjobContainerPart containerPart) {
List children = containerPart.getChildren();
for (int i = 0; i < children.size(); i++) {
Object object = children.get(i);
if (object instanceof NodeContainerPart) {
NodeContainerPart nodeContainerPart = (NodeContainerPart) object;
Object nodePart = nodeContainerPart.getChildren().get(0);
if (nodePart instanceof NodePart) {
List sourceConnections = ((NodePart) nodePart).getSourceConnections();
for (int j = 0; j < sourceConnections.size(); j++) {
Object connectionPart = sourceConnections.get(j);
if (connectionPart instanceof ConnectionPart) {
ConnectionPart connPart = (ConnectionPart) connectionPart;
org.talend.designer.core.ui.editor.connections.Connection conn = (org.talend.designer.core.ui.editor.connections.Connection) connPart.getModel();
if (conn.equals(connection)) {
ConnectionFigure fig = (ConnectionFigure) connPart.getFigure();
if (fig.getLineWidth() != 2) {
fig.setLineWidth(2);
connPart.refresh();
}
} else {
ConnectionFigure fig = (ConnectionFigure) connPart.getFigure();
if (fig.getLineWidth() != 1) {
fig.setLineWidth(1);
connPart.refresh();
}
}
}
}
}
}
}
}
use of org.talend.designer.core.ui.editor.connections.ConnectionFigure 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);
}
Aggregations