Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » automatic node generation
automatic node generation [message #487790] Thu, 24 September 2009 12:43 Go to next message
Yuzhang Han is currently offline Yuzhang HanFriend
Messages: 19
Registered: September 2009
Junior Member
Hey guys,
could anybody tell me how to realize the following?

given that NodeA contains NodeB and NodeC, when NodeA is created, NodeB and NodeC are AUTOMATICALLY generated inside of NodeA. A XY-layout of NodeA is used so that NodeB and C can be movable and resizeable.

The question is, how do I set the default size and position of NodeB and NodeC when NodeA is created? I would want NodeB and C to be created on customized positions and size.

Thank you!
Re: automatic node generation [message #488004 is a reply to message #487790] Fri, 25 September 2009 09:47 Go to previous message
No real name is currently offline No real nameFriend
Messages: 31
Registered: September 2009
Member
Hi,
Quote:

given that NodeA contains NodeB and NodeC, when NodeA is created, NodeB and NodeC are AUTOMATICALLY generated inside of NodeA.



You could provide an advice binding (AbstractEditHelperAdvice) for the necessary elements. In your case you should override one of the following methods:
		@Override
		protected ICommand getBeforeConfigureCommand(ConfigureRequest request) {
			// returned command is executed directly after original configure command, i.e.
			// for the given request a composed command "yourCmd, configureCmd" is executed
		}

		@Override
		protected ICommand getAfterConfigureCommand(ConfigureRequest request) {
			// returned command is executed directly after original configure command
			// for the given request a composed command "configureCmd, yourCmd" is executed
		}


I suggest you take the after command and implement it the following way:
1. If NodeA is configured => provide a command that creates NodeB
2. If NodeB is configured => provide a command that creates NodeC


Please note that you need to bind this advice for the regarding elements. Information about this topic can be found
in "Developer's Guide to the Extensible Type Registry" located in the GMF section of your Eclipse help. Especially see subsection "Examples > Code Examples > Binding Advice to an Existing Element Type".

Quote:

The question is, how do I set the default size and position of NodeB and NodeC when NodeA is created? I would want NodeB and C to be created on customized positions and size.



Inside the advice simply acquire the View by means of ViewUtil.getViewContainer(EObject obj) and go on from there.


Best regards,

sas
Previous Topic:Problem with setVisible method
Next Topic:Remove link programmatically
Goto Forum:
  


Current Time: Fri Apr 26 09:04:42 GMT 2024

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

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

Back to the top