Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » Auto size request Programatically
Auto size request Programatically [message #1450043] Wed, 22 October 2014 03:31 Go to next message
Fadi J is currently offline Fadi JFriend
Messages: 11
Registered: June 2013
Junior Member
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 11:16]

Report message to a moderator

Re: Auto size request Programatically [message #1450785 is a reply to message #1450043] Wed, 22 October 2014 23:10 Go to previous message
Fadi J is currently offline Fadi JFriend
Messages: 11
Registered: June 2013
Junior Member
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: Sat Jul 04 19:41:57 GMT 2020

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

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

Back to the top