Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » Creating connector
Creating connector [message #559816] Sun, 19 September 2010 10:30 Go to next message
123star  is currently offline 123star Friend
Messages: 70
Registered: June 2010

I need to create a Connector between two ports, I listened to the notification on the model when I create a Connector by hand and I discovered that the Connector is owned by the Class and not by the Port and that no notification is fired from Port, so I don't know if this code is right:

//port1, port2 are the ports to be connected

Connector conn = UMLFactory.eINSTANCE.createConnector();

Is it right?

Thanks in advance, 123star

Re: Creating connector [message #559822 is a reply to message #559816] Sun, 19 September 2010 16:11 Go to previous message
Rafael Chaves is currently offline Rafael ChavesFriend
Messages: 161
Registered: July 2009
Senior Member
I would expect you to have to add the connector to some parent in the model.

StructuredClassifier#createOwnedConnector(String) would do that for you:

StructuredClassifier parent = (StructuredClassifier) port1.getNamespace();
Connector conn = parent.createOwnedConnector(null);

Re: linking connector end with the port - what you are doing should work, but in the end, adding to the ends collection will result on setRole(port) on the connection end. IOW:


is equivalent to:

ConnectorEnd end1 = conn.createEnd();

But I haven't tried any of the code above. Cheers,


Previous Topic:Problem adding comment
Next Topic:Problem adding comment
Goto Forum:

Current Time: Wed Apr 25 16:28:41 GMT 2018

Powered by FUDForum. Page generated in 0.01301 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software