I have been trying to set the order of my packages through the API with no success. Here is what I am doing:
newPackage = (EA.Package)parentPackage.Packages.AddNew("BETA", "Nothing");
newPackage.Update();
parentPackage.Packages.Refresh();
newPackage = (EA.Package)parentPackage.Packages.AddNew("GAMMA", "Nothing");
newPackage.Update();
parentPackage.Packages.Refresh();
newPackage = (EA.Package)parentPackage.Packages.AddNew("ALPHA", "Nothing");
newPackage.Update();
parentPackage.Packages.Refresh();
Once the packages are created and show up in the Explorer, they are not ordered in the order that I created them, but instead are in alphabetical order (ALPHA, BETA, GAMMA). In fact, even the Packages array shows ALPHA as the first element right after I create it and call Packages.Refresh.
I thought that using the property TreePos on each package would help, I assigned TreePos 0 to the first element and TreePos 2 to the last element, and this seemed to help as everything was in the correct order in the array, but when I looked in the EA explorer, everything was still in alphabetical order.
Any idea how I can control the order of my added packages?