Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Help with CreateChildCommand
Help with CreateChildCommand [message #922784] Tue, 25 September 2012 06:30 Go to next message
John M. is currently offline John M.
Messages: 198
Registered: July 2010
Senior Member
Hello,

I have an own action for create a children with a dialog and it works when I use the AddCommand, but I want to use the CreateChildCommand.
But it seems, that I make a mistake or something like that.
I have tried to analyze it with the debugger, but I don't get it.

The following code works:
AddCommand.create(editingDomain, ((StructuredSelection) selection).getFirstElement(), descriptor, l);

l is a collection which contains the created object.

This doesn't work:
CreateChildCommand.create(editingDomain, ((StructuredSelection) selection).getFirstElement(), descriptor, l);


Both commands are executable, but the second one only marks the editor as dirty.
I have tried to create a new descriptor with an instance of CommandParameter using nearly all parameters from the given one expect the value.

Where is my mistake?

Thanks for any advices.
Re: Help with CreateChildCommand [message #922887 is a reply to message #922784] Tue, 25 September 2012 08:30 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 26014
Registered: July 2009
Senior Member
John,

Comments below.

On 25/09/2012 12:30 PM, John M. wrote:
> Hello,
>
> I have an own action for create a children with a dialog and it works
> when I use the AddCommand, but I want to use the CreateChildCommand.
> But it seems, that I make a mistake or something like that.
> I have tried to analyze it with the debugger, but I don't get it.
>
> The following code works:
> AddCommand.create(editingDomain, ((StructuredSelection)
> selection).getFirstElement(), descriptor, l);
> l is a collection which contains the created object.
What is descriptor?
>
> This doesn't work:
> CreateChildCommand.create(editingDomain, ((StructuredSelection)
> selection).getFirstElement(), descriptor, l);
I can't imagine that both should work the same. If the first works, the
arguments can't possibly be right for this one.
>
> Both commands are executable, but the second one only marks the editor
> as dirty.
> I have tried to create a new descriptor with an instance of
> CommandParameter using nearly all parameters from the given one expect
> the value.
>
> Where is my mistake?
I can't guess from snippets like this.
>
> Thanks for any advices.
Re: Help with CreateChildCommand [message #925017 is a reply to message #922887] Thu, 27 September 2012 06:08 Go to previous message
John M. is currently offline John M.
Messages: 198
Registered: July 2010
Senior Member
I just extended CreateChildAction and use the given descriptor from the constructor.
But there was a little mistake from my side.

You can simply edit the CommandParameter or better you have to create a new one and put the adjusted element as value.
My mistake was that I give the value as collection.
Previous Topic:Expired certificate with org.eclipse.emf.ecore 2.7.0
Next Topic:EMF Editor on memory model
Goto Forum:
  


Current Time: Mon Sep 01 10:02:35 EDT 2014

Powered by FUDForum. Page generated in 0.04456 seconds