Home » Eclipse Projects » Sirius » Diagram tools create node location
| | |
Re: Diagram tools create node location [message #1848679 is a reply to message #1848672] |
Mon, 13 December 2021 18:35   |
|
Hi Erik,
Do you have a custom layout or custom code that trigger the arrange? By default, Sirius should create the element on the location where you clicked on the diagram. That could explain why you see this change in location.
We have started to discuss among the team on how we could improve the Sirius tool process regarding triggering or not an arrange (all) at the end but I do not know if and when that will be done unfortunately.
Best regards,
Steve
Steve Monnier - Obeo Canada
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
|
|
| |
Re: Diagram tools create node location [message #1848713 is a reply to message #1848685] |
Tue, 14 December 2021 19:12   |
|
Hi Erik,
Oh right, I replied yesterday without reading again the previous posts and I forgot about the context, sorry. Indeed that explains the "blinking effect" that you have. Now that I think of it, I have an idea for a workaround that might be stupid (unless it works, then its genius), in your creation tool, before the "create instance" task (or equivalent you may have), have a set task (or java servce) that changes the DDiagram.setSynchronized to false. If a diagram is not syncrhonized, it will not display new semantic element, unless a view element is created for it. Normaly we would use a task "create view" for that, but we would end up with the same bliking effect. Instead, in your code that trigger the arrange request, just before that call, you set back DDiagram.setSynchronized to true. Hopefully that will sync the diagram and immediately trigger your custom ELK layout. If the new node is created to late, you may have to create it manually though. You can look at org.eclipse.sirius.diagram.business.internal.helper.task.operations.CreateViewTask for an example.
I do not guaranty that it will work, but it should be quick to give it a try. Either way, I am interested in your feedback on this :).
Best regards,
Steve
Steve Monnier - Obeo Canada
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
|
|
| |
Re: Diagram tools create node location [message #1848811 is a reply to message #1848790] |
Fri, 17 December 2021 17:15   |
|
Hi Erik,
Can you run it in debug mode and place a breakpoint in GMFCommandWrapper.rollback? In the middle of the stack you see that the execute method calls the rollback (that is why you have a setSynchronized at false, it is reverting your change). You probably have an exception that cause this, you may find the reason there. Did you had anything more than the setSynchronized(false) to your creation tool?
Best regards,
Steve
Steve Monnier - Obeo Canada
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
|
|
|
Re: Diagram tools create node location [message #1848955 is a reply to message #1848811] |
Mon, 27 December 2021 03:30   |
Erik Danielsson Messages: 14 Registered: September 2021 |
Junior Member |
|
|
Hi again, sorry for the delay.
I think maybe something is wrong with using a set operation, or maybe I just misunderstood? The service is being called correctly, which sets synchronized to false on the diagram. But then the rollback happens because it is trying to find an eStructualFeature of the target of the diagram with whatever name I put in the set operation in the .odesign. But the target of the diagram is just a node from our model, which doesn't have any features with whatever name I give, so the rollback happens. I also tried it as a change context instead of a set operation, which throws:
java.lang.IllegalStateException: Cannot modify resource set without a write transaction
I attached an image of the relevant parts in the odesign.
Thanks, and happy holidays!
Regards,
Erik
Attachment: odesign.jpg
(Size: 213.80KB, Downloaded 49 times)
|
|
|
Re: Diagram tools create node location [message #1848970 is a reply to message #1848955] |
Mon, 27 December 2021 15:16   |
|
Hi Erik,
No problem. Indeed, you can change the synchronization, only on a DDiagram element (see org.eclipse.sirius.diagram.DDiagram.isSynchronized()) so in you service disableSync from your DDiagramElement you will need to call getParentDiagram.
From a ChangeContext Sirius only expect that you return a semantic element, you should call services that modifies the model from a "Set" model operation so it will be executed in a RecordingCommand (EMF Transaction).
Happy holidays to you too,
Steve
Steve Monnier - Obeo Canada
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
|
|
| | |
Goto Forum:
Current Time: Wed Jun 07 01:30:54 GMT 2023
Powered by FUDForum. Page generated in 0.02639 seconds
|