|
Re: Trigger 'Arrange All' [message #1834460 is a reply to message #1834378] |
Tue, 10 November 2020 16:51 |
|
Hello,
You can perform an arrange all by sending an arrange request by using diagramEditPart.performRequest(arrangeRequest). See org.eclipse.sirius.diagram.ui.tools.internal.layout.LayoutUtil.arrange(DiagramEditPart) for instance.
To perform this action after layer activation, I suggest you to register a ResourceSetListenerImpl as a post commit listener on the Sirius session editing domain (org.eclipse.sirius.business.api.session.Session.getTransactionalEditingDomain()) . You can filter notifications concerning the layer activation.
Best regards,
Florian
|
|
|
Re: Trigger 'Arrange All' [message #1836659 is a reply to message #1834460] |
Mon, 11 January 2021 13:13 |
Razvan Prisca Messages: 3 Registered: January 2021 |
Junior Member |
|
|
Hi Florian,
I have a question related with your suggestion to filter notifications concerning the layer activation. I was able to create a custom NotificationFilter, something like:
@Override
public NotificationFilter getFilter() {
NotificationFilter filter = new NotificationFilter.Custom() {
@Override
public boolean matches(Notification notification) {
Object oldValue = notification.getOldValue();
Object newValue = notification.getNewValue();
if(oldValue instanceof AdditionalLayerSpec || newValue instanceof AdditionalLayerSpec) {
return true;
}
return false;
}
};
return filter;
}
The problem is that, when I return the filter and I am going to trigger arrange all, I am getting the current elements from the editor, not the elements after the layer activation. Is there a way to get the notification after the layer changed the diagram? So, not to trigger the arrange all with the current diagram elements, but, with the elements after the layer activation?
Kind Regards,
Razvan
|
|
|
|
Powered by
FUDForum. Page generated in 0.03440 seconds