Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » To change editparts position programmatically
To change editparts position programmatically [message #197100] Tue, 15 July 2008 13:22 Go to next message
BG is currently offline BGFriend
Messages: 45
Registered: July 2009
Member
Hello all,
Can know what is the best way to reposition editparts programmatically.i.e

I have compartment "A" which has children "A1" "B1" in turn compartment
"A1" has children "A1_1" and "A1_2".I would like to move the
editpart(A1_1)progamatically and make it as child for A ,such that A as
now "A1,B1 and A1_1" as children

A
| --- A1 ----A1_1
| |
| |
| |-----A1_2
|
| --- B1

This change should reflect in the domain model and i would also like
retain the layout

I tried using MoveElementsCommand
//snippet
MoveRequest moveRequest = new
MoveRequest(selectedElement.getEditingDomain(), createdModelElement,
listOfContainedElements);
MoveElementsCommand moveCommand = new MoveElementsCommand(moveRequest);

IOperationHistory history =
OperationHistoryFactory.getOperationHistory();
try {
history.execute(moveCommand, new NullProgressMonitor(), null);
} catch (ExecutionException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

This changes the model as expected but the existing layout gets altered

I also tried
Command getReparentCommand(ChangeBoundsRequest request,EditPart editPart)

but that also did't work as expected.
Re: To change editparts position programmatically - solved [message #197253 is a reply to message #197100] Wed, 16 July 2008 09:36 Go to previous message
BG is currently offline BGFriend
Messages: 45
Registered: July 2009
Member
did the follow changes:


ChangeBoundsRequest req = new
ChangeBoundsRequest(RequestConstants.REQ_ADD);

//editparts to add req.setEditParts(editParts);

//parent editpart to which it has to be added

Command command = parenteditPart.getCommand(req); command.execute();

It also retains the layout.
Previous Topic:Gmfmap figure components
Next Topic:diagram log
Goto Forum:
  


Current Time: Mon May 25 06:07:49 GMT 2020

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

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

Back to the top