{
System.err.println("Missing target parameter for data link '" + link.getQualifier() + "'");
return null;
}
ParamFigure sourceFigure = null;
ParamFigure targetFigure = null;
if (source instanceof NodeParam)
{
sourceFigure = (ParamFigure) source.getRepresentation();
if (sourceFigure == null)
{
System.err.println("Data link source parameter '" + source.getQualifier() + "' has no figure representation.");
return null;
}
}
if (target instanceof NodeParam)
{
targetFigure = (ParamFigure) target.getRepresentation();
if (targetFigure == null)
{
System.err.println("Data link target parameter '" + target.getQualifier() + "' has no figure representation.");
return null;
}
}
if (source instanceof ProcessVariable && targetFigure != null)
{
// Global -> Node
targetFigure.setProcessVariableConnection((ProcessVariable) source, link);
}
else if (target instanceof ProcessVariable && sourceFigure != null)
{
// Node -> Global
sourceFigure.setProcessVariableConnection((ProcessVariable) target, link);
}
else if (sourceFigure != null && targetFigure != null)
{
// Node -> Node
Connector start = sourceFigure.connectorAt(0, 0);
Connector end = targetFigure.connectorAt(0, 0);
link.unlink();
return new ParamConnection(link, start, end, this);
}