Author Topic: How to see what is selected, properly  (Read 8615 times)

ChrisMW

  • EA User
  • **
  • Posts: 90
  • Karma: +2/-0
    • View Profile
How to see what is selected, properly
« 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?

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13387
  • Karma: +566/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: How to see what is selected, properly
« Reply #1 on: November 19, 2014, 06:33:58 pm »
You can't.
The only thing you can do is send in a feature request and have lots of patience.

Geert

ChrisMW

  • EA User
  • **
  • Posts: 90
  • Karma: +2/-0
    • View Profile
Re: How to see what is selected, properly
« Reply #2 on: November 19, 2014, 07:11:06 pm »
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....  :(

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13387
  • Karma: +566/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: How to see what is selected, properly
« Reply #3 on: November 19, 2014, 07:18:47 pm »
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.

ChrisMW

  • EA User
  • **
  • Posts: 90
  • Karma: +2/-0
    • View Profile
Re: How to see what is selected, properly
« Reply #4 on: November 21, 2014, 12:14:24 am »
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.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: How to see what is selected, properly
« Reply #5 on: November 21, 2014, 01:55:47 am »
Check UserImages.bmp in the EA program folder.

q.

ChrisMW

  • EA User
  • **
  • Posts: 90
  • Karma: +2/-0
    • View Profile
Re: How to see what is selected, properly
« Reply #6 on: November 21, 2014, 02:27:25 am »
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?

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: How to see what is selected, properly
« Reply #7 on: November 21, 2014, 05:22:00 am »
No, unfortunately not. Happy counting  :D

q.

ChrisMW

  • EA User
  • **
  • Posts: 90
  • Karma: +2/-0
    • View Profile
Re: How to see what is selected, properly
« Reply #8 on: November 21, 2014, 05:49:21 am »
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?

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: How to see what is selected, properly
« Reply #9 on: November 21, 2014, 07:14:06 am »
See Package Flags in chap. 9.8 of my Inside book.

q.
« Last Edit: November 21, 2014, 07:14:22 am by qwerty »

ChrisMW

  • EA User
  • **
  • Posts: 90
  • Karma: +2/-0
    • View Profile
Re: How to see what is selected, properly
« Reply #10 on: November 21, 2014, 09:21:53 am »
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?

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8083
  • Karma: +118/-20
    • View Profile
Re: How to see what is selected, properly
« Reply #11 on: November 21, 2014, 09:48:49 am »
Look at Package.Flags for VICON.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: How to see what is selected, properly
« Reply #12 on: November 21, 2014, 10:03:22 am »
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.

ChrisMW

  • EA User
  • **
  • Posts: 90
  • Karma: +2/-0
    • View Profile
Re: How to see what is selected, properly
« Reply #13 on: November 21, 2014, 10:26:42 am »
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

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13387
  • Karma: +566/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: How to see what is selected, properly
« Reply #14 on: November 21, 2014, 06:14:45 pm »
Quote
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