I am trying to rearrange (auto-layout) a UML2 diagram programmatically.
However, I am unable to do so based on a Diagram
instance.
My code so far looks like:
Diagram diagram = /*...*/;
EditPart editPart = new DiagramEditPart(diagram);
List<EditPart> editParts = CollectionUtil.createNewSequence();
editParts.add(editPart);
ArrangeRequest request = new ArrangeRequest("");
request.setPartsToArrange(editParts);
editPart.getCommand(request).execute();
At the moment it has absolutely no effect. I guess that I shouldn't manually create the DiagramEditPart and rather get it from somewhere else - but I don't know where to start looking.
Using
OffscreenEditPartFactory.createDiagramEditPart
to create theEditPart
seems to work: