Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Update decorators through service method(Update decorators through service method)
Update decorators through service method [message #1811332] Sat, 31 August 2019 10:18 Go to next message
Krishna Murthy Mirajkar is currently offline Krishna Murthy MirajkarFriend
Messages: 38
Registered: July 2009
Member
I am able to show the decorators on the node use a service method that returns an image when the diagram opens. This service method is written to give different images based on a criteria.

My question is how to make the diagram to reload the decorator when the respective semantic model's attribute has changed that in turn has need to update the decorator. If the service method is invoked again it will now return a different image.

The problem is the service is not looked up again. I had put a break point which comes during start-up but not later.

So far I have tried the following which have NOT worked for me -
1. Refresh the parent
StructuredSelection strSelection = (StructuredSelection) selection;
Object firstElement = strSelection.getFirstElement();
if (firstElement instanceof DNodeEditPart) {
DNodeEditPart dNodeImpl = (DNodeEditPart) firstElement;
dNodeImpl.getParent().refresh();
}
2. Refresh the representation
StructuredSelection strSelection = (StructuredSelection) selection;
Object firstElement = strSelection.getFirstElement();
if (firstElement instanceof DNodeEditPart) {
DNodeEditPart dNodeImpl = (DNodeEditPart) firstElement;
TransactionalEditingDomain domain = TransactionUtil.getEditingDomain(dNodeImpl.getEditingDomain());
EditPart parent = dNodeImpl.getParent();
if (parent instanceof IDDiagramEditPart) {
IDDiagramEditPart dPart = (IDDiagramEditPart) parent;
RefreshRepresentationsCommand command = new RefreshRepresentationsCommand(
domain, new NullProgressMonitor(), dPart.resolveDDiagram().get());
domain.getCommandStack().execute(command);
}
}
Item 2 was due to https://www.eclipse.org/forums/index.php/t/657840/

[Updated on: Sat, 31 August 2019 10:18]

Report message to a moderator

Re: Update decorators through service method [message #1811343 is a reply to message #1811332] Sat, 31 August 2019 16:24 Go to previous messageGo to next message
Krishna Murthy Mirajkar is currently offline Krishna Murthy MirajkarFriend
Messages: 38
Registered: July 2009
Member
To add to explain the scenario, I have custom UI properties section. User modifies a model attribute from the custom UI.
I see that when Semantic Tab properties is edited, the Service method is called immediately. But, when I modify from my custom UI, the service method to look up image is not invoked.
What is it that I am missing where my model updates do not trigger the SiriusGenericDecorator.refresh()
Re: Update decorators through service method [message #1814170 is a reply to message #1811343] Thu, 05 September 2019 08:41 Go to previous message
Laurent Fasani is currently offline Laurent FasaniFriend
Messages: 182
Registered: October 2014
Senior Member
Hello

If the code called when you make a change from the property section does not modify the resource of the Sirius ResourceSet then nothing will be triggered by sirius. It will be up to your custom code to force a refresh.

In addtion, I did not understand if your 2. Refresh the representation point did work or no at the end. IMO it should refresh properly

Regards
Laurent


Laurent Fasani - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Previous Topic:Customizing markers location with EMF Validation
Next Topic:Facing issue in using extension org.eclipse.ui.editors
Goto Forum:
  


Current Time: Thu Apr 25 05:14:24 GMT 2024

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

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

Back to the top