Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to move exisiting elements between packages with an EA Addin in c#?

I am working on an EA Addin in c# (thanks Geert) and would like to move exisiting elements from a package to another using the code.

It is clear how to add or delete elements to/from EA.Collection p.Elements, but this does not work sincethis procedure changes the GUID of the element.

Is it possible at all?

like image 605
mrhpogie Avatar asked Mar 02 '15 21:03

mrhpogie


1 Answers

Yes. You simply need to change the packageId property to be that of the new package and you're done. Don't forget the update() after you changed it.

Additionally you can change the position in the browser with TreePos in which case you should explicitly number all elements that are listed for the according package. Ordering ad hoc will likely produce strange results since the sort order in EA is - I have no words for that ;-)

like image 184
qwerty_so Avatar answered Oct 11 '22 12:10

qwerty_so