{
Figure selection = fe.nextFigure();
if (selection instanceof MultiSocketNodeFigure)
{
// Get the node figure to add the sockets to
MultiSocketNodeFigure nodeFigure = (MultiSocketNodeFigure) selection;
MultiSocketNode targetNode = (MultiSocketNode) nodeFigure.getNode();
// Get the source node that contains the sockets
ActivityNodeImpl node = (ActivityNodeImpl) source.getNodeByName("NodeDummy");
workspaceView.clearSelection();
// Add all sockets to the selected node
List sockets = node.getSocketList();
int n = sockets.size();
for (int i = 0; i < n; ++i)
{
NodeSocket socket = (NodeSocket) sockets.get(i);
socket = (NodeSocket) socket.clone();
NamedObjectCollectionUtil.createUniqueName(socket, targetNode.getSocketList());
targetNode.addSocket(socket);
socket.maintainReferences(ModelObject.RESOLVE_GLOBAL_REFS | ModelObject.RESOLVE_LOCAL_REFS);
// Add the corresponding socket figure and select it
// TODO Feature 5: We should take care that an existing socket is not overlayed by the new socket
SocketFigure socketFigure = nodeFigure.addSocket(socket);
workspaceView.addToSelection(socketFigure);
}
return true;
}