Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Specifying Location of child Element
Specifying Location of child Element [message #227333] Fri, 24 April 2009 10:37 Go to next message
Frantisek Kocun is currently offline Frantisek KocunFriend
Messages: 16
Registered: July 2009
Junior Member
Hello I would like to configure location of a child element the same way
as it is done in Logic Example. My children have an id. To parent
XXXEditPart I insatalled a CanonicalEditPolicy similar with overridden
methods getSemanticChildrenList() and getCreateViewCommand(ViewDescriptor
descriptor). But method getCreateViewCommand(ViewDescriptor descriptor) is
never called insted of that is called getCreateViewCommand(CreateRequest
request) and the children have default position. I create children in
XXXCreateCommand. Maybe I missed something. Should I use
ConfigureElementCommand instead? What I have missed.

Thanks for help!

Fero
Re: Specifying Location of child Element [message #227383 is a reply to message #227333] Fri, 24 April 2009 13:40 Go to previous messageGo to next message
Frantisek Kocun is currently offline Frantisek KocunFriend
Messages: 16
Registered: July 2009
Junior Member
I tried ConfigureElementCommand but there is a problem. I use code from
logic example and elementType.getEditCommand(createRequest) always returns
null:

private Object createElement(EObject container, IElementType type,
EReference containmentFeature, IProgressMonitor progressMonitor)
throws ExecutionException {

CreateElementRequest createRequest = new
CreateElementRequest(getEditingDomain(), container, type,
containmentFeature);

IElementType elementType =
ElementTypeRegistry.getInstance().getElementType(createReque st.getEditHelperContext());

if (elementType != null) {
ICommand createCommand = elementType.getEditCommand(createRequest);

if (createCommand != null && createCommand.canExecute()) {

createCommand.execute(progressMonitor, null);
CommandResult commandResult = createCommand.getCommandResult();

if (isOK(commandResult)) {
Object result = commandResult.getReturnValue();

return result;
}

}
}
return null;
}
};

return c;
}
Re: Specifying Location of child Element [message #227423 is a reply to message #227333] Sat, 25 April 2009 15:32 Go to previous message
Frantisek Kocun is currently offline Frantisek KocunFriend
Messages: 16
Registered: July 2009
Junior Member
I got it working with a small trick (I overrided the method
getCreateViewCommand(CreateRequest request)):

@Override
protected Command getCreateViewCommand(CreateRequest request) {
if (request instanceof CreateViewRequest) {
CompositeCommand cc = new
CompositeCommand(DiagramUIMessages.AddCommand_Label);
Iterator descriptors = ((CreateViewRequest)
request).getViewDescriptors().iterator();
while (descriptors.hasNext()) {
ViewDescriptor descriptor = (ViewDescriptor) descriptors.next();
ICommand createCommand = getCreateViewCommand(descriptor);
cc.compose(createCommand);
}
return new ICommandProxy(cc.reduce());
}
return super.getCreateViewCommand(request);
}
Previous Topic:Layout Service - Custom Edge Layouy
Next Topic:GMF , is it what i need ?
Goto Forum:
  


Current Time: Wed Apr 24 21:12:32 GMT 2024

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

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

Back to the top