Lost access to variables in Popup Menu definitions on upgrade to 7.0.7 [message #1860068] |
Fri, 14 July 2023 22:23  |
Eclipse User |
|
|
|
Hello,
We recently upgraded to Sirius version 7.0.7 and just realized that some of our defined popup menus/operation actions no longer work. The problem stems from our precondition expressions. We used to reference the variable elementView there, and it worked prior to upgrading to 7.0.7. Now we get an error when right clicking: Couldn't find the 'elementView' variable data=[null]
I do notice that elementView is not listed as an available variable in the help icon for the precondition. However, I tried switching the variable to container, which is listed as an available variable, and I get the same error: Couldn't find the 'container' variable data=[null]
Is this a bug or was access to variables in precondition expressions for Popup menus/Operation actions removed?
Thanks,
Louis
|
|
|
|
|
Re: Lost access to variables in Popup Menu definitions on upgrade to 7.0.7 [message #1860364 is a reply to message #1860230] |
Tue, 01 August 2023 04:09   |
Eclipse User |
|
|
|
So, after analysis, there is indeed a bug, but it's subtle and not related to Sirius 7.0.x (it's probably been there for a long time).
It's actually expected that the elementView variable is not available for these pre-conditions.
The bug is that in some specific circumstances the variable is exposed, but that requires a specific scenario and is because of an incomplete cleanup.
If:
1. you have defined a generic tool in your odesign (which declared the elementView variable)
2. AND have checked the "Enable Popup Bar" flag
3. AND have hovered the mouse cursor on a diagram element long enough for the popup bar to appear
4. AND then right-click on an element (not necessarily the same) to invoke one of your PopupMenu operations
Then the elementView variable will have been stored in the context at step 3 to evaluate the pre-condition of the generic tool, and (that is the bug) NOT cleaned up afterwards.
This makes it "leak" and stay available for later operations, for example in the preconditions for your PopupMenu operations evaluated at step 4.
The thing is, the value of elementView will point to the graphical element on which the popup bar has been displayed at step 3.
If you move your cursor to a different element and right-click fast enough (so that a new popup bar is not displayed), the value will match the wrong graphical element.
So to summarize, you should not rely on elementView for your preconditions. In the cases where it's available in the evaluation context it's because of a bug, and the value exposed can not be relied on.
You should normally have the same information in the "views" variable. It may be a little more complex to use as it exposes all the selected graphical elements, so you need to extract the value of interest from that list (I don't remember if the "main" selected element is the first or last of the list; I think it's the last).
We'll open an issue for that.
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.07654 seconds