Update decorators through service method [message #1811332] |
Sat, 31 August 2019 10:18 |
Krishna Murthy Mirajkar 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 #1814170 is a reply to message #1811343] |
Thu, 05 September 2019 08:41 |
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.02812 seconds