Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Refreshing diagram nodes based on preference change
Refreshing diagram nodes based on preference change [message #1854641] Wed, 31 August 2022 20:13 Go to next message
Jonathan Menzies is currently offline Jonathan MenziesFriend
Messages: 60
Registered: May 2020
Location: California
Member
Hey there,

We currently have a number of semantic diagrams, in these diagrams we have our own custom node figures and edit parts.

For each of these we have made our own preferences that let the user decide if they want to show decorators and also what the number format for certain fields on the nodes should be.

What we want to be able to do is when the user applies the preferences the diagrams get refreshed and the decorators get updated and the number fields get re formatted. The former works fine, however trying to get the number fields to refresh is proving tricky.

What we attempted to do was calling the DialectManager.INSTANCE.refresh for the diagrams that we want to update after the preferences, this triggers fine, however because the nodes are using custom figures and nothing has changed in the model, there are never any notifications sent to trigger a visual refresh.

Are we doing something incorrectly here ? I was considering adding listeners on each of the custom figures for the preference store but I would rather do that as a last resort.

Cheers
Jonathan
Re: Refreshing diagram nodes based on preference change [message #1854706 is a reply to message #1854641] Fri, 02 September 2022 22:04 Go to previous messageGo to next message
Steve Monnier is currently offline Steve MonnierFriend
Messages: 572
Registered: May 2011
Senior Member
Hi Jonathan,

There is a second refresh method with a boolean parameter to force a full refresh of diagram elements: refresh(DRepresentation, boolean, IProgressMonitor). I think that should solve your issue.

Usually these kinds of graphical settings are on a diagram level rather on a global level, but I guess here is would depend on how regularly the users would change this preference. I am just mentioning this in case you did not consider having the decorator and the number format change (as a property customization) in a different layer. That would allow to choose it on each diagram without any preference.

Best regards,
Steve


Steve Monnier - Obeo Canada
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Refreshing diagram nodes based on preference change [message #1854783 is a reply to message #1854706] Fri, 09 September 2022 22:38 Go to previous messageGo to next message
Jonathan Menzies is currently offline Jonathan MenziesFriend
Messages: 60
Registered: May 2020
Location: California
Member
Hey Steve,

Thanks for the response, I tried the refresh method with true to force a full refresh and that unfortunately didn't work.

The preferences we are changing are global to our tool.

When I trigger the refresh I notice that nodes defined entirely in the odesign refresh fine, however nodes that use a custom style do not. I'm wondering if maybe we're missing something in our custom style code ? Do they have to be hooked up to certain listeners ?

Cheers
Jonathan
Re: Refreshing diagram nodes based on preference change [message #1854834 is a reply to message #1854783] Wed, 14 September 2022 00:32 Go to previous messageGo to next message
Steve Monnier is currently offline Steve MonnierFriend
Messages: 572
Registered: May 2011
Senior Member
Hi Jonathan,

I do not think you should need to add listener here. Did you provide your custom edit part and figures using the extension point org.eclipse.sirius.diagram.styleConfigurationProvider like on this guide: https://www.eclipse.org/sirius/doc/developer/extensions-provide_custom_style.html ? Did the edit parts you provided extend the ones from Sirius or are done from scratch?

Best regards,
Steve


Steve Monnier - Obeo Canada
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Refreshing diagram nodes based on preference change [message #1854945 is a reply to message #1854834] Mon, 19 September 2022 23:53 Go to previous message
Jonathan Menzies is currently offline Jonathan MenziesFriend
Messages: 60
Registered: May 2020
Location: California
Member
Hi Steve,

So I went back through the code, we have a style configuration that extends SimpleStyleConfiguration using the "org.eclipse.sirius.diagram.styleConfigurationProvider" extension point. We have an edit part that extends AbstractNotSelectableShapeNodeEditPart, a policy provider that implements IEditPolicyProvider. And then our figures are based on the draw2d Shape class and hooked into the relevant EditPart. As far as I can see all of them are hooked up fine but when I refresh using the method it hits none of the methods on any of them.


Edit: Is there a debug path or anything I can check to see if it's just not hitting the right things on our end ? For example when I run the refresh, what should be getting hit on the edit parts ?

Cheers
Jonathan

[Updated on: Mon, 19 September 2022 23:56]

Report message to a moderator

Previous Topic:Sirius Webinar: CaMCOA Studio, the Rolls-Royce's Workbench to Deploy Engine Control Software
Next Topic:How to set height and width
Goto Forum:
  


Current Time: Wed May 22 15:26:49 GMT 2024

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

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

Back to the top