Author Topic: Duplication of Objects on Shallow Diagram Copy - Can this be changed?  (Read 344 times)

Rich Anderson

  • EA User
  • **
  • Posts: 115
  • Karma: +7/-0
    • View Profile
    • LinkedIn
Hi there, I've just worked out that when copy/pasting diagrams in shallow mode that UML objects are always duplicated as they are "part of" the diagram.  However, I can copy/paste links of objects between diagrams and they won't be duplicated. I've looked at previous posts on this topic (there are not many) and the help system.   Is there any setting that allows me to change this?  For my purposes, I frequently want to copy/paste object diagrams without duplicating the objects.  Is there some underlying UML reason that this is so?   
Rich Anderson
Urgnt Limited

Sunshine

  • EA User
  • **
  • Posts: 855
  • Karma: +66/-4
  • Its the results that count
    • View Profile
Interesting, what version are you using. Reason I ask is I'm using V14.1 and don't get that behaviour and it sounds like you may be doing a smart copy.
The options in V14.1 are;
Shallow - links to existing elements
Deep - Duplicates visual elements
Smart - Duplicates all owned elements
Happy to help
:)

Takeshi K

  • EA User
  • **
  • Posts: 353
  • Karma: +9/-1
    • View Profile
Hi all,

The behaviour which Rich said can be reproduced for Objects in Object diagrams and Sequence Lifelines in Sequence diagrams.

If I understand correctly, there is no way to do 'shallow copy' for these 'instance' elements.

HTH,
--
t-kouno

Rich Anderson

  • EA User
  • **
  • Posts: 115
  • Karma: +7/-0
    • View Profile
    • LinkedIn
Thanks, for the replies.  I'm getting the behavior on 14.1 and the 15RC.  I just created a test repository and tried it on object diagrams with shallow copy.   This seems to be just the way it works. Maybe there is a UML reason why this is so.  Too bad this cannot be over-ridden with a setting.   
Rich Anderson
Urgnt Limited

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 9480
  • Karma: +266/-27
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
I can understand perfectly for sequence diagram lifelines.
But not so much for object diagrams I guess.

Geert

Rich Anderson

  • EA User
  • **
  • Posts: 115
  • Karma: +7/-0
    • View Profile
    • LinkedIn
Yes,  Geert, it does seem strange.   Do you think making a change request to Sparx would be worth doing?
Rich Anderson
Urgnt Limited

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 9480
  • Karma: +266/-27
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Yes,  Geert, it does seem strange.   Do you think making a change request to Sparx would be worth doing?
I'm not sure. There's an easy enough workaround, so they might nog feel that this would be very urgent.

Geert

PS. Workaround would be select all (Ctr-A), copy (Ctrl-C), open new diagram, paste (Ctrl-V)

Rich Anderson

  • EA User
  • **
  • Posts: 115
  • Karma: +7/-0
    • View Profile
    • LinkedIn
Yes, that works great if the diagram doesn't have swimlanes!   :o
Rich Anderson
Urgnt Limited

Sunshine

  • EA User
  • **
  • Posts: 855
  • Karma: +66/-4
  • Its the results that count
    • View Profile
I suppose the work around with a diagram with swimlanes where you get unwanted copies is to alter Geert's suggestion by merging the two methods;
a) Shallow copy the diagram
b) Delete all the new elements you don't want. You now have the swimlanes
c) Ctrl-A on on old diagram and Ctrl-C to copy then in new diagram paste with Ctrl-V

That should get the result you want but a bit painful to execute.

In defence of the default behaviour encountered, I can see the logic of having shallow copy for classes and deep copy for objects as you generally want to not duplicate classes but duplicate instances of classes like objects. I guess this may be a left over of how it used to work before options of shallow and deep copy were available.

However I absolutely agree when there is a option for shallow and deep copy it should be consistent and actually do a shallow copy.
Happy to help
:)