Book a Demo

Author Topic: Replace a class with a different class  (Read 3790 times)

davida2000

  • EA Novice
  • *
  • Posts: 1
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Replace a class with a different class
« on: March 15, 2006, 02:18:51 pm »
I want to replace a class on a diagram with a different class without having to redo all of the associations. For example, I have a data logging class that I want to replace with a different data logging class that is more sophisticated and complete. I want the class to be added to the diagram as a simple link. The only way I know how to do this is to:

1.
Delete the old class from the diagram.
2.
add the new class to the diagram as a simple link
3.
redo all of the class associations

If possible I would like to simply replace the old class with the new class. Is this possible?

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Replace a class with a different class
« Reply #1 on: March 15, 2006, 03:02:21 pm »
It's not much of a savings, but you could right-click each connection (you may have to select each one first), and then select Connection Detail / Set Source and Target from the context menu. This will allow you to set the appropriate end to your new class.

If you have filled in connection details they will be preserved.
No, you can't have it!

thomaskilian

  • Guest
Re: Replace a class with a different class
« Reply #2 on: March 16, 2006, 11:53:09 am »
You can copy the contents of the new class from the browser onto the old class on the diagram. That will copy methods and attributes. Delete old attributes/methods before that. That should have the effect you need. If you need a copy of the class you can use a transformation (I posted the code here recently - and did not place it on EA Usergroup :-[).

Aaron B

  • EA Administrator
  • EA User
  • *****
  • Posts: 941
  • Karma: +18/-0
    • View Profile
Re: Replace a class with a different class
« Reply #3 on: March 16, 2006, 02:11:10 pm »
Quote
... you could right-click each connection (you may have to select each one first), and then select Connection Detail / Set Source and Target from the context menu. This will allow you to set the appropriate end to your new class.

As a shortcut to this, you could use Shift+Click to re-assign the connector on the diagram.
- Drop your new class on the diagram (place near your old class)
- Shift+Click on a connector end to be moved
- Click on the new target element