Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: ChrisMW on November 19, 2014, 02:47:40 am
-
I've just started writing an add-in, so perhaps I am missing something really obvious, but I seem unable to see all things selected in the project browser.
So far I've come up with three approaches, one yields all selected elements, which is handy for multiple selects, one yields the selected package (or containing package), but won't tell me all the selected packages (when you select more than one). One will let me see diagrams, attributes and methods, but again, in a multi select it won't tell me all.
And then there are some scenario's where it gets a little tougher, like when you select diagrams and elements (you can, at least my 11.1 allows this).
I was looking in the online help for something that would return a collection of sorts that contain all and I could work out (using object type seems easy enough) what's what. I see the GetTreeXML, but haven't found any docs on it. Even so, if it is what the name suggests it might not give what I want.
So how can I process multi selects on things other than elements?
-
You can't.
The only thing you can do is send in a feature request (http://www.sparxsystems.com/support/feature_request.html) and have lots of patience.
Geert
-
The Tree XML method, is there any documentation, because it would not be that hard to construct my own tree view, populate it and use that. Of course there's some user comfort issues to consider, but in all I think it is probably better to have the user re-select rather than partially ignore the already selected.
Ah well, if there's no other way, there's no other way.... :(
-
I don't think there more documentation then the one you find in the help file.
If I were you I would indeed create my own control to have the user select the elements needed.
I've never though of using the tree xml method. I would probably use the regular operations.
Unless you want the open all levels of the tree, that might still be acceptable in terms of performance.
-
Yes, makes sense. Any tips on how to use the same tree icons as EA? It would be good to present something people are already used to.
-
Check UserImages.bmp in the EA program folder.
q.
-
Great, precisely what I was looking for. I count 95 icons, I wonder, is there some index as what image position means what.... :) Before I start counting, is there a quicker way for that also?
-
No, unfortunately not. Happy counting :D
q.
-
Thanks.....
Still more to discover, like how do I determine the kind of model, like EA does, the type is otPackage, but some are decorated with a folder icon that represents the model contained therein. I assume this is done through the element, specifically the element type of the package, but the value range is unclear to me. Does anyone know how this is done?
-
See Package Flags in chap. 9.8 of my Inside book.
q.
-
Hmmm, does that imply I need to dive into the database? This would complicate things somewhat, or (if I buy the book(s)), will this also provide a path via the API?
-
Look at Package.Flags for VICON.
-
Sooner or later you need to go that deep. But as Simon pointed out: check what EAPackage.Flags contains. You'll find a string like VICON=<val>; wher <val> is a number corresponding to the View type. My book also details such tidbits which are not explained in EA's help.
q.
-
Ok, I don't mind going that deep, but would not want to access functionality via that route (unless there is no workaround). It feels like tying things to back, rather than the front. I'm just wanting to get something that works for me, and perhaps others, but stay away from DB access as it would currently makes things too complex in the wrong area.
Nonetheless, having a good understanding of the innards is never a bad idea, as it will make understanding all the alternatives given a particular situation all the easier.
In the meantime, I'll look into the excellent pointers provided.... many thanks
-
Yes, makes sense. Any tips on how to use the same tree icons as EA? It would be good to present something people are already used to.
You could use the same method I did for the EA Navigator.
I created a class precisely for this purpose https://github.com/GeertBellekens/Enterprise-Architect-Toolpack/blob/master/EANavigator/NavigatorVisuals.cs
Should be reasonably easy to re-use that.
Geert