use of org.talend.designer.core.ui.action.TalendCreateConnectionTool in project tdi-studio-se by Talend.
the class TalendConnectionHandle method createDragTracker.
/*
* (non-Javadoc)
*
* @see org.eclipse.gef.handles.AbstractHandle#createDragTracker()
*/
@Override
protected DragTracker createDragTracker() {
if (this.mainConnector == null) {
this.mainConnector = new NodeConnectorTool(nodePart).getConnector();
}
if (this.mainConnector == null) {
return null;
}
final List<Object> listArgs = new ArrayList<Object>();
listArgs.add(null);
listArgs.add(null);
listArgs.add(null);
TalendCreateConnectionTool myConnectTool = new TalendCreateConnectionTool(new CreationFactory() {
@Override
public Object getNewObject() {
return listArgs;
}
@Override
public Object getObjectType() {
// should get the connector at realtime
mainConnector = new NodeConnectorTool(nodePart).getConnector();
if (mainConnector == null) {
// if no connector is available, maybe can return "on componnet ok" connector to avoid NPE
Node node = (Node) nodePart.getModel();
mainConnector = node.getConnectorFromType(EConnectionType.ON_COMPONENT_OK);
// specify the connection name
listArgs.set(1, mainConnector.getLinkName());
} else {
// no need to specify the connection name
listArgs.set(1, null);
}
return mainConnector.getName();
}
}, nodePart);
return myConnectTool;
}
Aggregations