Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Automatically create node
Automatically create node [message #656251] Thu, 24 February 2011 17:11
Ralph Gerbig is currently offline Ralph GerbigFriend
Messages: 702
Registered: November 2009
Senior Member
Hi,

I am adding a node (nodeA) via the toolbox. I want to have a second node (nodeB) added to the diagram. nodeB is a reference of nodeB, so a edge needs to be drawn between the two nodes.

I extended nodeACreateCommand's doExecuteWithResult method with the following code:

NodeA newElement = xxxFactory.eINSTANCE.createNodeA();

Container owner = (Container) getElementToEdit();
owner.getChildren().add(newElement);

//Start of my added code
NodeB nodeB = xxxFactory.eINSTANCE.createNodeB();
nodeB.setName("Node B");
				
owner.getChildren().add(nodeB);
		
newElement.setReferenceToNodeB(nodeB);
//End of my added code

doConfigure(newElement, monitor, info);

((CreateElementRequest) getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);


NodeA and NodeB show up on the diagram but the edge between NodeA and NodeB does not show up. It shows up after closing and openening the diagram. What can I do to get the edge showing immediatly after adding the two nodes?

Thanks,

Ralph
Previous Topic:Drop down menu or autocompletion for labels
Next Topic:Paste into compartment
Goto Forum:
  


Current Time: Sat Nov 02 15:03:55 GMT 2024

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

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

Back to the top