Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Lost access to variables in Popup Menu definitions on upgrade to 7.0.7
Lost access to variables in Popup Menu definitions on upgrade to 7.0.7 [message #1860068] Sat, 15 July 2023 02:23 Go to next message
Louis Detweiler is currently offline Louis DetweilerFriend
Messages: 100
Registered: August 2017
Senior Member
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 #1860170 is a reply to message #1860068] Thu, 20 July 2023 15:22 Go to previous messageGo to next message
Pierre-Charles David is currently offline Pierre-Charles DavidFriend
Messages: 705
Registered: July 2009
Senior Member
Hi.
Not sure which previous version you switched from, but 7.0.7 by itself (compared to 7.0.6) does not include any change that looks like it could cause this.
The only thing I can think of is that Sirius 7.0 included changes in the plug-ins which define the metamodels. See the release notes: https://eclipse.dev/sirius/doc/7.0.x/Release_Notes.html#DeveloperVisibleChanges6
Depending on how your product is built/configured, maybe some of the required plug-ins are not present?


Pierre-Charles David - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Lost access to variables in Popup Menu definitions on upgrade to 7.0.7 [message #1860230 is a reply to message #1860170] Mon, 24 July 2023 14:57 Go to previous messageGo to next message
Jonathan Menzies is currently offline Jonathan MenziesFriend
Messages: 60
Registered: May 2020
Location: California
Member
Hi Pierre-Charles,

Louis's coworker here, so after some more digging it actually looks like we lose access to all variables in the preconditions (for right click menu items) except self and views, when we turn off the canvas popups for the palette tools. Initially we thought it was the upgrade from 7.0.6 to 7.0.7, but I went over it and it still works fine in an older build of our tool that uses 7.0.7.

Should we have access to elementView, container etc on preconditions when right clicking nodes in a diagram with the canvas popups turned off? Or is it possible that the canvas popups were giving us access to them incorrectly?

Cheers
Jonathan
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 Go to previous messageGo to next message
Pierre-Charles David is currently offline Pierre-Charles DavidFriend
Messages: 705
Registered: July 2009
Senior Member
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
Re: Lost access to variables in Popup Menu definitions on upgrade to 7.0.7 [message #1860366 is a reply to message #1860364] Tue, 01 August 2023 08:51 Go to previous messageGo to next message
Pierre-Charles David is currently offline Pierre-Charles DavidFriend
Messages: 705
Registered: July 2009
Senior Member
https://github.com/eclipse-sirius/sirius-desktop/issues/21 for the issue.

Pierre-Charles David - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Lost access to variables in Popup Menu definitions on upgrade to 7.0.7 [message #1860419 is a reply to message #1860366] Thu, 03 August 2023 19:52 Go to previous message
Jonathan Menzies is currently offline Jonathan MenziesFriend
Messages: 60
Registered: May 2020
Location: California
Member
Great! I'll make sure we swap out uses of elementView with views in our preconditions. Thanks for the help :)
Previous Topic:Copy a Model with His representations in Obeo Designer Comunity
Next Topic:Get the label/value of an item selected from a Sirius List
Goto Forum:
  


Current Time: Sun Oct 13 08:44:57 GMT 2024

Powered by FUDForum. Page generated in 0.04073 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top