Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » Statemachine autosize/resize problem (not just programmatically)
Statemachine autosize/resize problem (not just programmatically) [message #1629856] Sun, 22 February 2015 23:26 Go to next message
András Dobreff is currently offline András DobreffFriend
Messages: 9
Registered: September 2014
Junior Member
Hi!

I'm working on creating StateMachines programmatically, and now I'm facing a problem.
If I have more than one region as I want to resize (bigger), the Statemachine gets bigger, but the regions stay small.
I thought that I'm making something wrong, but found out that right click->format->autosize behaves the same way.

Programmatically I tried 2 ways
1st:
	public void resizeStateMachine(DiagramEditPart diagep) {
                GraphicalEditPart stateMachineEP = (GraphicalEditPart) diagep.getChildren().get(0);
		Dimension dim = new Dimension(400, 300);
		Rectangle constraint = new Rectangle(new Point(0,0), dim);
		
		ChangeBoundsRequest request = new ChangeBoundsRequest(RequestConstants.REQ_RESIZE);
		request.setEditParts(stateMachineEP);
		request.setConstrainedResize(true);
		request.setSizeDelta(dim);
		
		EditPolicy Epoli = diagep.getEditPolicy(EditPolicy.LAYOUT_ROLE);
		Command com = ((CustomPackageXYLayoutEditPolicy) Epoli).createChangeConstraintCommand(request, stateMachineEP, new Rectangle());
		
		com.execute();
}


2nd:
public static void resizeGraphicalEditPart(GraphicalEditPart graphEP, int new_width, int new_height){
                Dimension figuredim = graphEP.getFigure().getSize();
		ChangeBoundsRequest resize_req = new ChangeBoundsRequest(RequestConstants.REQ_RESIZE);
		resize_req.setSizeDelta(new Dimension(new_width-figuredim.width(), new_height-figuredim.height()));
		resize_req.setEditParts(graphEP);
		
		Command cmd = graphEP.getCommand(resize_req);
		if(cmd != null){
			cmd.execute();
		}
}


I'm fearing that it's a bug, but if not, please help.

Thanks,
András Dobreff
Re: Statemachine autosize/resize problem (not just programmatically) [message #1630526 is a reply to message #1629856] Mon, 23 February 2015 08:32 Go to previous message
Camille Letavernier is currently offline Camille LetavernierFriend
Messages: 952
Registered: February 2011
Senior Member
Hi András,

I've had a similar issue when generating State Machines. I can confirm there's an issue in the way Regions are managed in Papyrus (Even with one single Region, although things become much worse with several regions in a StateMachine)

I'll report a bug for that

Regards,
Camille


Camille Letavernier
Previous Topic:Examples / Samples files
Next Topic:How to get an "required" only Port on a component
Goto Forum:
  


Current Time: Fri Apr 19 16:00:52 GMT 2024

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

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

Back to the top