Book a Demo

Author Topic: Example for Scripts of type "Find in Project"  (Read 4592 times)

gko

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Example for Scripts of type "Find in Project"
« on: November 04, 2015, 07:50:17 pm »
In EA 12.0.1214 I detect the new “Model Search Group” where I can place Scripts of type “Find in Project”. Scripts placed there are accessible from search result lines via the context menu (right mouse -> Scripts -> ScriptName).

Unfortunately, the default code provided when creating a new script of type “Find in Project” does not show up, how to access one or several selected lines of the search result in order to do some further processing.

Trials to find some documentation or API method end up with no result (i.e. I cannot find a method equivilant to Repository.GetTreeSelectedElements like Repository.GetSelectedSearchResults).

Could you please provide example code or documentation link, how to access the (selected) search result lines.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Example for Scripts of type "Find in Project"
« Reply #1 on: November 04, 2015, 07:56:45 pm »
You cannot access the selected elements in the model search.

All you can do is use the selected element (single) using Repository.GetContextObject()


Geert

PS. "Find in project browser" is a standard feature for search results. Why would you want to create a script for it?

gko

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: Example for Scripts of type "Find in Project"
« Reply #2 on: November 04, 2015, 08:35:54 pm »
Thanks for this very good hint, Geert. That solves paar of my problem.

Within a Script placed in a "Model Search Group" Repository.GetContextObject delivers the first selected Element in the search result list. Unfortunatelly further Elements cannot be determined.

What i am looking for is something which can be reached selecting search results, using the result context menu item "Copy selected to Clipboard" and then parsing the clipboard text to get the selected elements for further processing.  

Find in project brower is limited to names placed in the browser tree and selects only the first occurance. Find in Project provides more powerful queries.

Gerhard

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Example for Scripts of type "Find in Project"
« Reply #3 on: November 04, 2015, 08:54:10 pm »
You can't access the the selected search results, but there might be other options you can use.

If you explain the actual requirements it migth help us to help you. It feels like you are too much focused on specific solution.

Geert