Book a Demo

Author Topic: Add connector to diagram  (Read 6872 times)

Harley

  • EA Novice
  • *
  • Posts: 9
  • Karma: +0/-0
    • View Profile
Add connector to diagram
« on: November 10, 2005, 08:19:09 pm »
Hey there

I woulda thought that this would be pretty simple...

How can I add a connector to a diagram? I've tried using DiagramLinks.AddNew to no avail.

Thanks
Harley

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +55/-3
    • View Profile
Re: Add connector to diagram
« Reply #1 on: November 10, 2005, 08:48:34 pm »
You don't add connectors to a diagram, you add them between elements:

Code: [Select]

Dim con as EA.Connector
Set con = element1.Connectors.AddNew("Name","Dependency")
con.SupplierID = element2.ElementID
con.Update


Then if both element1 and element2 are on the diagram, you can refresh the diagram and the connector should appear.

HTH
« Last Edit: November 10, 2005, 08:49:28 pm by KP »
The Sparx Team
[email protected]

Harley

  • EA Novice
  • *
  • Posts: 9
  • Karma: +0/-0
    • View Profile
Re: Add connector to diagram
« Reply #2 on: November 11, 2005, 09:27:02 pm »
KP - thanks for the reply.

I have kinda got it working - not sure if this is something I'm doing wrong. If I create a connector using:
Code: [Select]

Target.Connectors.AddNew("", "Generalization") as Connector;

it works as expected. However, if I use:
Code: [Select]

Target.Connectors.AddNew("", "Realization") as Connector;

I don't get anything on the diagram. However, the link does appear in the properties of the elements I am linking.

Thanks
Harley

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +55/-3
    • View Profile
Re: Add connector to diagram
« Reply #3 on: November 14, 2005, 07:25:51 pm »
EA has a spelling mistake in its internals... Try spelling it "Realisation"  :-[  :-X  :-/
The Sparx Team
[email protected]

mikewhit

  • EA User
  • **
  • Posts: 608
  • Karma: +0/-0
  • Accessing ....
    • View Profile
Re: Add connector to diagram
« Reply #4 on: November 15, 2005, 04:40:56 am »
Excuse me, that's how you spell "Realisation" ... unless you're American !

Harley

  • EA Novice
  • *
  • Posts: 9
  • Karma: +0/-0
    • View Profile
Re: Add connector to diagram
« Reply #5 on: November 15, 2005, 06:33:50 am »
Indeed it is. Maybe the issue is simply a documentation typo then:

" When creating a new connector you must assign it a valid type. These are:    
· Aggregation  
· Association  
· Collaboration  
· Dependency  
· Generalization  
· Instantiation  
· Nesting  
· NoteLink  
· Realization  
· Sequence  
· StateFlow  
· UseCase"

Thanks
Harley

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Add connector to diagram
« Reply #6 on: November 20, 2005, 01:26:27 pm »
Quote
Excuse me, that's how you spell "Realisation" ... unless you're American !

I agree.  Unfortunately I believe the UML spec was written in American English.