Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » Programmetic Create Connetor between Port
Programmetic Create Connetor between Port [message #471144] Mon, 26 February 2007 09:51 Go to next message
Jerry is currently offline JerryFriend
Messages: 32
Registered: July 2009
Member
Hi, Thanks for help me gettting started with the uml2.
Now I meet some problem to create two “port” and create a “connector”
linking them.

Suppose I have myport1 owned by myClass1 and myPort2 Owned by myClass2,
then I create a connector by :
org.eclipse.uml2.uml.Port myPort1=UMLFactory.eINSTANCE.createPort();
org.eclipse.uml2.uml.Port myPort2=UMLFactory.eINSTANCE.createPort();
Connector myConnector = UMLFactory.eINSTANCE.createConnector();

Now I would create the two ends for myConnector, if I use
"myConnector.createEnd", how could I ensure that these two ends are
attached to "myPort1" and "myPort2", respectively?

Thanks a lot!
Re: Programmetic Create Connetor between Port [message #471157 is a reply to message #471144] Mon, 26 February 2007 15:40 Go to previous message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Hi Jerry,

After creating your connector end, you need to call "setRole(..)". and pass
the ports as the connectable element.

Just a few points: The way you've created your ports below does not make
them owned by myClass1 and myClass2 ( you are probably just leaving out
steps ).
Connectors can only be created between
connectable elements within the same context. It would not be valid to
create a connector between ports the way you've described it below. It
would be valid to create a connector between two ports if the ports were
shown on the border of parts and those parts were owned by the same
structured classifier. In that case, you would have to call
"setPartWithPort()" on the Connector end.

Regards,

- James.

"Jerry" <sjianlin@hotmail.com> wrote in message
news:c03b74752567aa4b8d036fbafc53ca98$1@www.eclipse.org...
> Hi, Thanks for help me gettting started with the uml2.
> Now I meet some problem to create two
Re: Programmetic Create Connetor between Port [message #593859 is a reply to message #471144] Mon, 26 February 2007 15:40 Go to previous message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Hi Jerry,

After creating your connector end, you need to call "setRole(..)". and pass
the ports as the connectable element.

Just a few points: The way you've created your ports below does not make
them owned by myClass1 and myClass2 ( you are probably just leaving out
steps ).
Connectors can only be created between
connectable elements within the same context. It would not be valid to
create a connector between ports the way you've described it below. It
would be valid to create a connector between two ports if the ports were
shown on the border of parts and those parts were owned by the same
structured classifier. In that case, you would have to call
"setPartWithPort()" on the Connector end.

Regards,

- James.

"Jerry" <sjianlin@hotmail.com> wrote in message
news:c03b74752567aa4b8d036fbafc53ca98$1@www.eclipse.org...
> Hi, Thanks for help me gettting started with the uml2.
> Now I meet some problem to create two
Previous Topic:Changing the version number of a uml profile
Next Topic:initializing an UML2 model with .ecore contents
Goto Forum:
  


Current Time: Sat Mar 28 21:11:48 GMT 2020

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

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

Back to the top