Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: meeert on April 21, 2023, 04:43:35 pm
-
Hi, the titles says it already.
I made the standard Example of the JavascriptAddin. However, the following behavior makes EA freeze.
EA_MenuClick
Session.Prompt("You clicked " + ItemName, 1);
Not the intended behavior I assume?
I'm using version 16.1.1625 - 64 bit
-
The Javascript addins are running their code synchronously with EA, just like add-ins written in other languages.
If you show a message box in any language, the entire UI of the application is blocked, waiting for the call to return.
So yes, based on what you've described that is entirely expected.
-
Hi,
I'm having the same issue when calling Session.Prompt from a model-based addin.
Whilst I understand the addin is waiting for the user to click on a button e.g. OK, Yes, No... EA freezes for a few minutes preventing the user from doing anything.
Is there a workaround (code to add) to prevent this behaviour ?
-
Hi
Yes me too!
I developed a Model based Add-in which uses Session.Prompt in addition to Session.Output
Both "freeze" with the "blue circle of death" ... eventually EA will respond to the user click, say OK in the Session.Output.
I have found, that when "freeze" happens, clicking the EA title bar, springs EA back into life and the user interact with the dialog. Not ideal.
As this was for a client, I reverted to write the addin as a conventional C# dll
Phil
-
Hi Phil,
Thanks for confirming the behaviour. Until this can be fixed, there could be a workaround involving a custom Javascript function to replace the Session.Prompt.
Update: I confirm that using a simple Javascript function fixed the issue.
//style:
// 0 -> OK button
// 1 -> OK/Cancel buttons
// 3 -> Yes/No/Cancel buttons
// 4 -> Yes/No buttons
// Returns a value matching the clicked button:
// 1 -> OK
// 2 -> Cancel
// 6 -> Yes
// 7 -> No
style += 4096;
var WSH = new COMObject("WScript.Shell");
return WSH.Popup(prompt, 0, title, style);
I published an article about a Model Based Addin example: https://www.umlchannel.com/en/enterprise-architect/item/359-enterprise-architect-model-based-addin (https://www.umlchannel.com/en/enterprise-architect/item/359-enterprise-architect-model-based-addin)
-
I know this topic is dormant but thought I'd add.
We have only found this issue to be noticeable since transitioning from EA15.2 to EA16.1.
I will implement Guillaume's suggestion but this is a shame for the EA API, as I was looking forward to my prompts appearing on the right screen.
-
A while ago, I had a similar issue with EA Freeze in a different use case where there was a pop-up involved.
Turned out that the pop-up window was shown somewhere out of the visual screen boundary.
The issue was solved by using something like ctrl-M I believe which enables a Windows user to move a window around using the arrow keys. With this, the pop-up screen could be brought back into the visual part of the monitor again.
Problem solved...