automatic node generation [message #487790] |
Thu, 24 September 2009 08:43  |
Eclipse User |
|
|
|
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 05:47  |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.07064 seconds