Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » Programmatically trigger layout of a diagram?(How do i programmatically trigger layout of a diagram?)
Programmatically trigger layout of a diagram? [message #1426196] Thu, 18 September 2014 11:36 Go to next message
Patrik Nandorf is currently offline Patrik NandorfFriend
Messages: 169
Registered: January 2013
Location: Sweden
Senior Member
Hi,

How do I programmatically trigger layout of a diagram similar to Diagram -> Arrange -> All?

Regards
Patrik
Re: Programmatically trigger layout of a diagram? [message #1450359 is a reply to message #1426196] Wed, 22 October 2014 11:09 Go to previous messageGo to next message
Fadi J is currently offline Fadi JFriend
Messages: 11
Registered: June 2013
Junior Member
Try this where the parameter is the DiagramEditPart. It works for me

protected void arrangeRecursively(EditPart editpart) {
//ArrangeRequest request = new ArrangeRequest(ActionIds.ACTION_ARRANGE_ALL, LayoutType.DEFAULT);
ArrangeRequest request = new ArrangeRequest(RequestConstants.REQ_ARRANGE_DEFERRED);
List<EditPart> listToArrange = new ArrayList<EditPart>();
listToArrange.addAll(editpart.getChildren());

if(!listToArrange.isEmpty()) {
for(Object element : editpart.getChildren()) {
if(element instanceof EditPart) {
arrangeRecursively((EditPart)element);
}
}

request.setViewAdaptersToArrange(listToArrange);

Command command = editpart.getCommand(request);
command.execute();
}
}
Re: Programmatically trigger layout of a diagram? [message #1461474 is a reply to message #1450359] Tue, 04 November 2014 15:52 Go to previous message
Patrik Nandorf is currently offline Patrik NandorfFriend
Messages: 169
Registered: January 2013
Location: Sweden
Senior Member
Thanks Fadi,

Regards
Patrik

Previous Topic:Need help
Next Topic:Papyrus and CDO
Goto Forum:
  


Current Time: Sat Jul 11 09:28:22 GMT 2020

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

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

Back to the top