|
|
|
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 08:09 |
|
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.
Pierre-Charles David - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04073 seconds