Skip to main content



      Home
Home » Modeling » Papyrus » Auto size request Programatically
Auto size request Programatically [message #1450043] Tue, 21 October 2014 23:31 Go to next message
Eclipse UserFriend
Hi,
in Papyrus Internal Block Diagram with a right click you can choose
Format->Autosize
does anyone have an idea how to call this request grammatically.

I tried :

ChangeBoundsRequest request = new ChangeBoundsRequest(RequestConstants.REQ_AUTOSIZE);
Command command = editpart.getCommand(request);
command.execute();

but it is not working.

[Updated on: Wed, 22 October 2014 07:16] by Moderator

Re: Auto size request Programatically [message #1450785 is a reply to message #1450043] Wed, 22 October 2014 19:10 Go to previous message
Eclipse UserFriend
I got it.
Thanks Any way
import org.eclipse.papyrus.uml.diagram.menu.actions.SizeAction

protected void resize(EditPart editpart) {
List<IGraphicalEditPart> l = new ArrayList<IGraphicalEditPart>();
l.add((IGraphicalEditPart) editpart);
SizeAction action = new SizeAction(SizeAction.PARAMETER_AUTOSIZE, l);
Command cmd = action.getCommand();

List<EditPart> listToResize = new ArrayList<EditPart>();
listToResize.addAll(editpart.getChildren());

if(!listToResize.isEmpty()) {
for(Object element : editpart.getChildren()) {
if(element instanceof IGraphicalEditPart) {
resize((EditPart)element);
}
}
}

if (cmd != null && cmd.canExecute()){
cmd.execute();
}
}
Previous Topic:Install certain extra features seperately
Next Topic:Papyrus C++ code generation
Goto Forum:
  


Current Time: Sun Jul 06 23:47:35 EDT 2025

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

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

Back to the top