Book a Demo

Author Topic: Project Browser Multi Selection Example  (Read 6826 times)

pH

  • EA User
  • **
  • Posts: 72
  • Karma: +0/-0
    • View Profile
Project Browser Multi Selection Example
« on: August 19, 2010, 03:16:39 am »
The JScript/VBScript Project Browser Multi Selection Example provided under Local Scripts by Sparx System is not working. Is there problem with that script or GetTreeSelectedElements() method in Repository not working properly?  Did any body faced this issues? Any suggestions?

Thanks,
pH
<a href="http://webuml.org"><img src="http://webuml.org/images/webuml-badge.png" alt="Set UML Free!" style="border-width:0"></a>

mrf

  • EA User
  • **
  • Posts: 311
  • Karma: +0/-0
    • View Profile
Re: Project Browser Multi Selection Example
« Reply #1 on: August 19, 2010, 11:35:18 am »
When you say "not working", what symptoms are you witnessing?

The function was intended to be used from Project Browser scripts which are accessed through the project browser context menu. Invoking the context menu does not cause the project browser to lose its multiselection, whereas clicking outside of the project browser will.

So if you invoke the script from the scripting window it will only report one item selected (as clicking outside of the Project Browser causes the multiselection to be lost), whereas if you invoke the script from the Project Browser context menu multiple items will be reported.

Whether this is a bug or not, I'm can't say for certain presently, I'd have to investigate what the general behaviour is on the platform and what consequences retaining the multiple selection would have downstream.

For more information on Project Browser scripts, please see http://www.sparxsystems.com/enterprise_architect_user_guide/automation_and_scripts/script_group_properties.html
« Last Edit: August 19, 2010, 11:37:37 am by mfraser »
Best Regards,

Michael

[email protected]
"It is more complicated than you think." - RFC 1925, Section 2.8

pH

  • EA User
  • **
  • Posts: 72
  • Karma: +0/-0
    • View Profile
Re: Project Browser Multi Selection Example
« Reply #2 on: August 23, 2010, 07:18:33 pm »
Thanks for your reply.  
Even when I changed to run the script from Project Browser it still behaves the same. It takes that element where the last mouse click is for executing the script.

But why should the same script behave differently when invoked from 2 different places?? Users are independent to do that and as a script writer how can I control that ? If script writer cannot control it then should they not behave the same?

I tried with 8.0.862 as well.

-pH
<a href="http://webuml.org"><img src="http://webuml.org/images/webuml-badge.png" alt="Set UML Free!" style="border-width:0"></a>

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Project Browser Multi Selection Example
« Reply #3 on: August 23, 2010, 07:30:40 pm »
pH,

If you put your script in an addin EA passes you the location where the option is chosen, as a parameter.
That way you can either disable the function if called from outside the projectbrowser, or give some kind of warning...

Geert

pH

  • EA User
  • **
  • Posts: 72
  • Karma: +0/-0
    • View Profile
Re: Project Browser Multi Selection Example
« Reply #4 on: August 23, 2010, 07:47:52 pm »
Geert,
Do you mean EA can tell whether it is invoked from Scripting window or Project Browser?

-pH
<a href="http://webuml.org"><img src="http://webuml.org/images/webuml-badge.png" alt="Set UML Free!" style="border-width:0"></a>

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Project Browser Multi Selection Example
« Reply #5 on: August 23, 2010, 07:56:25 pm »
I'm not sure, but what I meant is that you can also execute your script as part of an addin.

In the addin you can specify a menu option that can be used to launch your behavior.

The operation that is called by EA to launch the addin behavior (and to show/enable the menu options) also passes a parameter that indicates whether the menu option was chosen from the main menu, from the project browser tree, or the main diagram window.

Geert

mrf

  • EA User
  • **
  • Posts: 311
  • Karma: +0/-0
    • View Profile
Re: Project Browser Multi Selection Example
« Reply #6 on: August 24, 2010, 08:48:11 am »
Quote
But why should the same script behave differently when invoked from 2 different places?? Users are independent to do that and as a script writer how can I control that ? If script writer cannot control it then should they not behave the same?

I totally agree that it should act the same, but it's not actually the script api that's at fault here, it's how the Project Browser behaves when it loses focus (eg you click away from it). So please submit a formal bug request and we'll see what we can do.
Best Regards,

Michael

[email protected]
"It is more complicated than you think." - RFC 1925, Section 2.8

pH

  • EA User
  • **
  • Posts: 72
  • Karma: +0/-0
    • View Profile
Re: Project Browser Multi Selection Example
« Reply #7 on: August 24, 2010, 04:48:53 pm »
I have already raised the request last week itself and still awaiting the response. This is behavior is also seen with the script being executed from the project browser with multiple selected (not clicking away from the project browser)

-pH
<a href="http://webuml.org"><img src="http://webuml.org/images/webuml-badge.png" alt="Set UML Free!" style="border-width:0"></a>

mrf

  • EA User
  • **
  • Posts: 311
  • Karma: +0/-0
    • View Profile
Re: Project Browser Multi Selection Example
« Reply #8 on: August 25, 2010, 09:09:00 am »
No problems, I'll chase it up on our side.
Best Regards,

Michael

[email protected]
"It is more complicated than you think." - RFC 1925, Section 2.8

mrf

  • EA User
  • **
  • Posts: 311
  • Karma: +0/-0
    • View Profile
Re: Project Browser Multi Selection Example
« Reply #9 on: August 25, 2010, 11:54:53 am »
pH,

Just sent you a more detailed response through the support channels explaining this fully.

As a workaround, if you remove the line:
Code: [Select]
Repository.EnsureOutputVisible( "Script" );Focus is no longer stolen from the Project Browser and your script should work as intended.
Best Regards,

Michael

[email protected]
"It is more complicated than you think." - RFC 1925, Section 2.8

pH

  • EA User
  • **
  • Posts: 72
  • Karma: +0/-0
    • View Profile
Re: Project Browser Multi Selection Example
« Reply #10 on: August 25, 2010, 08:29:31 pm »
 It works. Thanks.
<a href="http://webuml.org"><img src="http://webuml.org/images/webuml-badge.png" alt="Set UML Free!" style="border-width:0"></a>