Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] and the EMF commands.
[CDO] and the EMF commands. [message #696962] Fri, 15 July 2011 08:09 Go to next message
Christophe Bouhier is currently offline Christophe BouhierFriend
Messages: 937
Registered: July 2009
Senior Member
Hi,

Since I use CDO to get objects, through a resource, I notice that the
EMF Delete command I use, can not execute. (canExecute() is false).
This seems only to happen, if the CDO object is retrieved through a CDO
resource, and has eContainer = null. This kind of makes sense, if the
container can't be used to delete from. I wonder, if there is another
implementation of EMF.edit commands for CDO objects, which are not
contained, bu simply referenced by a CDO resource URI?

thanks. Christophe
Re: [CDO] and the EMF commands. [message #697002 is a reply to message #696962] Fri, 15 July 2011 09:09 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6690
Registered: July 2009
Senior Member
Am 15.07.2011 10:09, schrieb Christophe Bouhier:
> Hi,
>
> Since I use CDO to get objects, through a resource, I notice that the EMF Delete command I use, can not execute. (canExecute() is false).
> This seems only to happen, if the CDO object is retrieved through a CDO resource, and has eContainer = null. This kind of makes sense, if the container can't be used to delete from. I wonder, if there is another implementation of EMF.edit commands for CDO objects, which are not contained, bu simply referenced by a CDO resource URI?
CDOObjects are always contained somewhere if they belong to a repository (the root resource being the only exception to this rule). Maybe you can post an executable example code (ideally use our test model1)?

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper


Re: [CDO] and the EMF commands. [message #697107 is a reply to message #697002] Fri, 15 July 2011 14:37 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33217
Registered: July 2009
Senior Member
This doesn't sound specific to CDO. DeleteCommand is not designed, by
default, to delete objects from their resource. More often than not,
this would result in an empty resource, which often isn't valid. Nor is
there any support for creating a new root object in resource, so
deleting root objects would be kind of a one-way trip to emptiness. I
wonder if you need to support deleting the resources themselves?



On 15/07/2011 2:09 AM, Eike Stepper wrote:
> Am 15.07.2011 10:09, schrieb Christophe Bouhier:
>> Hi,
>>
>> Since I use CDO to get objects, through a resource, I notice that the
>> EMF Delete command I use, can not execute. (canExecute() is false).
>> This seems only to happen, if the CDO object is retrieved through a
>> CDO resource, and has eContainer = null. This kind of makes sense, if
>> the container can't be used to delete from. I wonder, if there is
>> another implementation of EMF.edit commands for CDO objects, which
>> are not contained, bu simply referenced by a CDO resource URI?
> CDOObjects are always contained somewhere if they belong to a
> repository (the root resource being the only exception to this rule).
> Maybe you can post an executable example code (ideally use our test
> model1)?
>
> Cheers
> /Eike
>
> ----
> http://www.esc-net.de
> http://thegordian.blogspot.com
> http://twitter.com/eikestepper
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: [CDO] and the EMF commands. [message #697146 is a reply to message #697107] Fri, 15 July 2011 16:06 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6690
Registered: July 2009
Senior Member
Am 15.07.2011 16:37, schrieb Ed Merks:
> This doesn't sound specific to CDO. DeleteCommand is not designed, by default, to delete objects from their resource.
Ah, I didn't even know that. I do remember some scalability issues with DeleteCommand, though. Does it rely on the default usage cross referencer?

> More often than not, this would result in an empty resource, which often isn't valid. Nor is there any support for creating a new root object in resource, so deleting root objects would be kind of a one-way trip to emptiness.
The generic CDO editor supports 0..n root objects.

> I wonder if you need to support deleting the resources themselves?
In CDO that's possible, of course.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper


>
>
>
> On 15/07/2011 2:09 AM, Eike Stepper wrote:
>> Am 15.07.2011 10:09, schrieb Christophe Bouhier:
>>> Hi,
>>>
>>> Since I use CDO to get objects, through a resource, I notice that the EMF Delete command I use, can not execute. (canExecute() is false).
>>> This seems only to happen, if the CDO object is retrieved through a CDO resource, and has eContainer = null. This kind of makes sense, if the container can't be used to delete from. I wonder, if there is another implementation of EMF.edit commands for CDO objects, which are not contained, bu simply referenced by a CDO resource URI?
>> CDOObjects are always contained somewhere if they belong to a repository (the root resource being the only exception to this rule). Maybe you can post an executable example code (ideally use our test model1)?
>>
>> Cheers
>> /Eike
>>
>> ----
>> http://www.esc-net.de
>> http://thegordian.blogspot.com
>> http://twitter.com/eikestepper
>>
>>


Re: [CDO] and the EMF commands. [message #697147 is a reply to message #697146] Fri, 15 July 2011 16:24 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33217
Registered: July 2009
Senior Member
Eike,

Comments below.

On 15/07/2011 9:06 AM, Eike Stepper wrote:
> Am 15.07.2011 16:37, schrieb Ed Merks:
>> This doesn't sound specific to CDO. DeleteCommand is not designed,
>> by default, to delete objects from their resource.
> Ah, I didn't even know that. I do remember some scalability issues
> with DeleteCommand, though. Does it rely on the default usage cross
> referencer?
Yes, a DeleteCommand needs to discover all references to the object and
it's children being deleted so that not only is the object removed from
its container, but all references to the object and it's children are
eliminated.
>
>> More often than not, this would result in an empty resource, which
>> often isn't valid. Nor is there any support for creating a new root
>> object in resource, so deleting root objects would be kind of a
>> one-way trip to emptiness.
> The generic CDO editor supports 0..n root objects.
An XMI resource supports that as well.
>
>> I wonder if you need to support deleting the resources themselves?
> In CDO that's possible, of course.
The issue is that deleting resources is more similar to doing a save
because the effect can be seen outside the editor...
>
> Cheers
> /Eike
>
> ----
> http://www.esc-net.de
> http://thegordian.blogspot.com
> http://twitter.com/eikestepper
>
>
>>
>>
>>
>> On 15/07/2011 2:09 AM, Eike Stepper wrote:
>>> Am 15.07.2011 10:09, schrieb Christophe Bouhier:
>>>> Hi,
>>>>
>>>> Since I use CDO to get objects, through a resource, I notice that
>>>> the EMF Delete command I use, can not execute. (canExecute() is
>>>> false).
>>>> This seems only to happen, if the CDO object is retrieved through a
>>>> CDO resource, and has eContainer = null. This kind of makes sense,
>>>> if the container can't be used to delete from. I wonder, if there
>>>> is another implementation of EMF.edit commands for CDO objects,
>>>> which are not contained, bu simply referenced by a CDO resource URI?
>>> CDOObjects are always contained somewhere if they belong to a
>>> repository (the root resource being the only exception to this
>>> rule). Maybe you can post an executable example code (ideally use
>>> our test model1)?
>>>
>>> Cheers
>>> /Eike
>>>
>>> ----
>>> http://www.esc-net.de
>>> http://thegordian.blogspot.com
>>> http://twitter.com/eikestepper
>>>
>>>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: [CDO] and the EMF commands. [message #697163 is a reply to message #697147] Fri, 15 July 2011 16:28 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6690
Registered: July 2009
Senior Member
Am 15.07.2011 18:24, schrieb Ed Merks:
> Eike,
>
> Comments below.
>
> On 15/07/2011 9:06 AM, Eike Stepper wrote:
>> Am 15.07.2011 16:37, schrieb Ed Merks:
>>> This doesn't sound specific to CDO. DeleteCommand is not designed, by default, to delete objects from their resource.
>> Ah, I didn't even know that. I do remember some scalability issues with DeleteCommand, though. Does it rely on the default usage cross referencer?
> Yes, a DeleteCommand needs to discover all references to the object and it's children being deleted so that not only is the object removed from its container, but all references to the object and it's children are eliminated.
That's what I suspected. Is there a way to influence the choice of the cross referencer implementation on model level, e.g., a resource set adapter?

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper



>>
>>> More often than not, this would result in an empty resource, which often isn't valid. Nor is there any support for creating a new root object in resource, so deleting root objects would be kind of a one-way trip to emptiness.
>> The generic CDO editor supports 0..n root objects.
> An XMI resource supports that as well.
>>
>>> I wonder if you need to support deleting the resources themselves?
>> In CDO that's possible, of course.
> The issue is that deleting resources is more similar to doing a save because the effect can be seen outside the editor...
>>
>> Cheers
>> /Eike
>>
>> ----
>> http://www.esc-net.de
>> http://thegordian.blogspot.com
>> http://twitter.com/eikestepper
>>
>>
>>>
>>>
>>>
>>> On 15/07/2011 2:09 AM, Eike Stepper wrote:
>>>> Am 15.07.2011 10:09, schrieb Christophe Bouhier:
>>>>> Hi,
>>>>>
>>>>> Since I use CDO to get objects, through a resource, I notice that the EMF Delete command I use, can not execute. (canExecute() is false).
>>>>> This seems only to happen, if the CDO object is retrieved through a CDO resource, and has eContainer = null. This kind of makes sense, if the container can't be used to delete from. I wonder, if there is another implementation of EMF.edit commands for CDO objects, which are not contained, bu simply referenced by a CDO resource URI?
>>>> CDOObjects are always contained somewhere if they belong to a repository (the root resource being the only exception to this rule). Maybe you can post an executable example code (ideally use our test model1)?
>>>>
>>>> Cheers
>>>> /Eike
>>>>
>>>> ----
>>>> http://www.esc-net.de
>>>> http://thegordian.blogspot.com
>>>> http://twitter.com/eikestepper
>>>>
>>>>


Re: [CDO] and the EMF commands. [message #697173 is a reply to message #697163] Fri, 15 July 2011 17:42 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33217
Registered: July 2009
Senior Member
Eike,

It's possible to specialize DeleteCommand.findReferences.


On 15/07/2011 9:28 AM, Eike Stepper wrote:
> Am 15.07.2011 18:24, schrieb Ed Merks:
>> Eike,
>>
>> Comments below.
>>
>> On 15/07/2011 9:06 AM, Eike Stepper wrote:
>>> Am 15.07.2011 16:37, schrieb Ed Merks:
>>>> This doesn't sound specific to CDO. DeleteCommand is not designed,
>>>> by default, to delete objects from their resource.
>>> Ah, I didn't even know that. I do remember some scalability issues
>>> with DeleteCommand, though. Does it rely on the default usage cross
>>> referencer?
>> Yes, a DeleteCommand needs to discover all references to the object
>> and it's children being deleted so that not only is the object
>> removed from its container, but all references to the object and it's
>> children are eliminated.
> That's what I suspected. Is there a way to influence the choice of the
> cross referencer implementation on model level, e.g., a resource set
> adapter?
>
> Cheers
> /Eike
>
> ----
> http://www.esc-net.de
> http://thegordian.blogspot.com
> http://twitter.com/eikestepper
>
>
>
>>>
>>>> More often than not, this would result in an empty resource, which
>>>> often isn't valid. Nor is there any support for creating a new
>>>> root object in resource, so deleting root objects would be kind of
>>>> a one-way trip to emptiness.
>>> The generic CDO editor supports 0..n root objects.
>> An XMI resource supports that as well.
>>>
>>>> I wonder if you need to support deleting the resources themselves?
>>> In CDO that's possible, of course.
>> The issue is that deleting resources is more similar to doing a save
>> because the effect can be seen outside the editor...
>>>
>>> Cheers
>>> /Eike
>>>
>>> ----
>>> http://www.esc-net.de
>>> http://thegordian.blogspot.com
>>> http://twitter.com/eikestepper
>>>
>>>
>>>>
>>>>
>>>>
>>>> On 15/07/2011 2:09 AM, Eike Stepper wrote:
>>>>> Am 15.07.2011 10:09, schrieb Christophe Bouhier:
>>>>>> Hi,
>>>>>>
>>>>>> Since I use CDO to get objects, through a resource, I notice that
>>>>>> the EMF Delete command I use, can not execute. (canExecute() is
>>>>>> false).
>>>>>> This seems only to happen, if the CDO object is retrieved through
>>>>>> a CDO resource, and has eContainer = null. This kind of makes
>>>>>> sense, if the container can't be used to delete from. I wonder,
>>>>>> if there is another implementation of EMF.edit commands for CDO
>>>>>> objects, which are not contained, bu simply referenced by a CDO
>>>>>> resource URI?
>>>>> CDOObjects are always contained somewhere if they belong to a
>>>>> repository (the root resource being the only exception to this
>>>>> rule). Maybe you can post an executable example code (ideally use
>>>>> our test model1)?
>>>>>
>>>>> Cheers
>>>>> /Eike
>>>>>
>>>>> ----
>>>>> http://www.esc-net.de
>>>>> http://thegordian.blogspot.com
>>>>> http://twitter.com/eikestepper
>>>>>
>>>>>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: [CDO] and the EMF commands. [message #697174 is a reply to message #697173] Fri, 15 July 2011 17:43 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6690
Registered: July 2009
Senior Member
Am 15.07.2011 19:42, schrieb Ed Merks:
> Eike,
>
> It's possible to specialize DeleteCommand.findReferences.
I see. But that's certainly not on the model level, it's on the command framework / edit level.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper


>
>
> On 15/07/2011 9:28 AM, Eike Stepper wrote:
>> Am 15.07.2011 18:24, schrieb Ed Merks:
>>> Eike,
>>>
>>> Comments below.
>>>
>>> On 15/07/2011 9:06 AM, Eike Stepper wrote:
>>>> Am 15.07.2011 16:37, schrieb Ed Merks:
>>>>> This doesn't sound specific to CDO. DeleteCommand is not designed, by default, to delete objects from their resource.
>>>> Ah, I didn't even know that. I do remember some scalability issues with DeleteCommand, though. Does it rely on the default usage cross referencer?
>>> Yes, a DeleteCommand needs to discover all references to the object and it's children being deleted so that not only is the object removed from its container, but all references to the object and it's children are eliminated.
>> That's what I suspected. Is there a way to influence the choice of the cross referencer implementation on model level, e.g., a resource set adapter?
>>
>> Cheers
>> /Eike
>>
>> ----
>> http://www.esc-net.de
>> http://thegordian.blogspot.com
>> http://twitter.com/eikestepper
>>
>>
>>
>>>>
>>>>> More often than not, this would result in an empty resource, which often isn't valid. Nor is there any support for creating a new root object in resource, so deleting root objects would be kind of a one-way trip to emptiness.
>>>> The generic CDO editor supports 0..n root objects.
>>> An XMI resource supports that as well.
>>>>
>>>>> I wonder if you need to support deleting the resources themselves?
>>>> In CDO that's possible, of course.
>>> The issue is that deleting resources is more similar to doing a save because the effect can be seen outside the editor...
>>>>
>>>> Cheers
>>>> /Eike
>>>>
>>>> ----
>>>> http://www.esc-net.de
>>>> http://thegordian.blogspot.com
>>>> http://twitter.com/eikestepper
>>>>
>>>>
>>>>>
>>>>>
>>>>>
>>>>> On 15/07/2011 2:09 AM, Eike Stepper wrote:
>>>>>> Am 15.07.2011 10:09, schrieb Christophe Bouhier:
>>>>>>> Hi,
>>>>>>>
>>>>>>> Since I use CDO to get objects, through a resource, I notice that the EMF Delete command I use, can not execute. (canExecute() is false).
>>>>>>> This seems only to happen, if the CDO object is retrieved through a CDO resource, and has eContainer = null. This kind of makes sense, if the container can't be used to delete from. I wonder, if there is another implementation of EMF.edit commands for CDO objects, which are not contained, bu simply referenced by a CDO resource URI?
>>>>>> CDOObjects are always contained somewhere if they belong to a repository (the root resource being the only exception to this rule). Maybe you can post an executable example code (ideally use our test model1)?
>>>>>>
>>>>>> Cheers
>>>>>> /Eike
>>>>>>
>>>>>> ----
>>>>>> http://www.esc-net.de
>>>>>> http://thegordian.blogspot.com
>>>>>> http://twitter.com/eikestepper
>>>>>>
>>>>>>


Re: [CDO] and the EMF commands. [message #697637 is a reply to message #697107] Sun, 17 July 2011 14:51 Go to previous messageGo to next message
Christophe Bouhier is currently offline Christophe BouhierFriend
Messages: 937
Registered: July 2009
Senior Member
On 15-07-11 16:37, Ed Merks wrote:
> This doesn't sound specific to CDO. DeleteCommand is not designed, by
> default, to delete objects from their resource. More often than not,
> this would result in an empty resource, which often isn't valid. Nor is
> there any support for creating a new root object in resource, so
> deleting root objects would be kind of a one-way trip to emptiness. I
> wonder if you need to support deleting the resources themselves?
>
Hi Ed,
No, I don't need to delete the resource, just one of the objects in it.
Perhaps I need to clarify that we create CDO resources, using the EClass
name of an object. (So each Object has it's own resource path
cdo://repo/[EClass.name]. Containment is less important this way, as I
can always find objects. (We don't use a lot of tree viewers).

I need to add and delete from this resource. Adding is no problem, as I
can do resource.getContents like this:

c = new AddCommand(editingService.getEditingDomain(),
resource.getContents(), object);

but deleting which goes through the DeleteAction is the issue.


>
>
> On 15/07/2011 2:09 AM, Eike Stepper wrote:
>> Am 15.07.2011 10:09, schrieb Christophe Bouhier:
>>> Hi,
>>>
>>> Since I use CDO to get objects, through a resource, I notice that the
>>> EMF Delete command I use, can not execute. (canExecute() is false).
>>> This seems only to happen, if the CDO object is retrieved through a
>>> CDO resource, and has eContainer = null. This kind of makes sense, if
>>> the container can't be used to delete from. I wonder, if there is
>>> another implementation of EMF.edit commands for CDO objects, which
>>> are not contained, bu simply referenced by a CDO resource URI?
>> CDOObjects are always contained somewhere if they belong to a
>> repository (the root resource being the only exception to this rule).
>> Maybe you can post an executable example code (ideally use our test
>> model1)?
>>
>> Cheers
>> /Eike
>>
>> ----
>> http://www.esc-net.de
>> http://thegordian.blogspot.com
>> http://twitter.com/eikestepper
>>
>>
Re: [CDO] and the EMF commands. [message #697657 is a reply to message #697637] Sun, 17 July 2011 16:14 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6690
Registered: July 2009
Senior Member
Am 17.07.2011 16:51, schrieb Christophe Bouhier:
> On 15-07-11 16:37, Ed Merks wrote:
>> This doesn't sound specific to CDO. DeleteCommand is not designed, by
>> default, to delete objects from their resource. More often than not,
>> this would result in an empty resource, which often isn't valid. Nor is
>> there any support for creating a new root object in resource, so
>> deleting root objects would be kind of a one-way trip to emptiness. I
>> wonder if you need to support deleting the resources themselves?
>>
> Hi Ed,
> No, I don't need to delete the resource, just one of the objects in it.
> Perhaps I need to clarify that we create CDO resources, using the EClass name of an object. (So each Object has it's own resource path cdo://repo/[EClass.name]. Containment is less important this way, as I can always find objects. (We don't use a lot of tree viewers).
Just out of curiosity, is there only ever one object in such a "class resource"?

>
> I need to add and delete from this resource. Adding is no problem, as I can do resource.getContents like this:
>
> c = new AddCommand(editingService.getEditingDomain(),
> resource.getContents(), object);
>
> but deleting which goes through the DeleteAction is the issue.
I've just tested deletion of objects, including resource root objects, with the generic CDO editor (see CDOServer+CDOExplorer at http://www.eclipse.org/cdo/downloads/#R20110608_1407 ). Both work without any problems. Can you provide us with something that is directly executable and reproduces your problem?

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper


>
>
>>
>>
>> On 15/07/2011 2:09 AM, Eike Stepper wrote:
>>> Am 15.07.2011 10:09, schrieb Christophe Bouhier:
>>>> Hi,
>>>>
>>>> Since I use CDO to get objects, through a resource, I notice that the
>>>> EMF Delete command I use, can not execute. (canExecute() is false).
>>>> This seems only to happen, if the CDO object is retrieved through a
>>>> CDO resource, and has eContainer = null. This kind of makes sense, if
>>>> the container can't be used to delete from. I wonder, if there is
>>>> another implementation of EMF.edit commands for CDO objects, which
>>>> are not contained, bu simply referenced by a CDO resource URI?
>>> CDOObjects are always contained somewhere if they belong to a
>>> repository (the root resource being the only exception to this rule).
>>> Maybe you can post an executable example code (ideally use our test
>>> model1)?
>>>
>>> Cheers
>>> /Eike
>>>
>>> ----
>>> http://www.esc-net.de
>>> http://thegordian.blogspot.com
>>> http://twitter.com/eikestepper
>>>
>>>
>


Re: [CDO] and the EMF commands. [message #697675 is a reply to message #697657] Sun, 17 July 2011 17:21 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33217
Registered: July 2009
Senior Member
Comments below.

On 17/07/2011 9:14 AM, Eike Stepper wrote:
> Am 17.07.2011 16:51, schrieb Christophe Bouhier:
>> On 15-07-11 16:37, Ed Merks wrote:
>>> This doesn't sound specific to CDO. DeleteCommand is not designed, by
>>> default, to delete objects from their resource. More often than not,
>>> this would result in an empty resource, which often isn't valid. Nor is
>>> there any support for creating a new root object in resource, so
>>> deleting root objects would be kind of a one-way trip to emptiness. I
>>> wonder if you need to support deleting the resources themselves?
>>>
>> Hi Ed,
>> No, I don't need to delete the resource, just one of the objects in it.
>> Perhaps I need to clarify that we create CDO resources, using the
>> EClass name of an object. (So each Object has it's own resource path
>> cdo://repo/[EClass.name]. Containment is less important this way, as
>> I can always find objects. (We don't use a lot of tree viewers).
> Just out of curiosity, is there only ever one object in such a "class
> resource"?
I get the sense that all objects of a given class end up there (so he
can easily find all objects of a given class).
>
>>
>> I need to add and delete from this resource. Adding is no problem,
>> as I can do resource.getContents like this:
>>
>> c = new AddCommand(editingService.getEditingDomain(),
>> resource.getContents(), object);
>>
>> but deleting which goes through the DeleteAction is the issue.
You can specialize the item provider for ResourceItemProvider to support
createRemoveCommand; you might also specialize it to support child
creation as well as add...
> I've just tested deletion of objects, including resource root objects,
> with the generic CDO editor (see CDOServer+CDOExplorer at
> http://www.eclipse.org/cdo/downloads/#R20110608_1407 ).
Maybe it works because CDO resources are EObjects? ResourceItemProvider
doesn't support it directly though...
> Both work without any problems. Can you provide us with something that
> is directly executable and reproduces your problem?
>
> Cheers
> /Eike
>
> ----
> http://www.esc-net.de
> http://thegordian.blogspot.com
> http://twitter.com/eikestepper
>
>
>>
>>
>>>
>>>
>>> On 15/07/2011 2:09 AM, Eike Stepper wrote:
>>>> Am 15.07.2011 10:09, schrieb Christophe Bouhier:
>>>>> Hi,
>>>>>
>>>>> Since I use CDO to get objects, through a resource, I notice that the
>>>>> EMF Delete command I use, can not execute. (canExecute() is false).
>>>>> This seems only to happen, if the CDO object is retrieved through a
>>>>> CDO resource, and has eContainer = null. This kind of makes sense, if
>>>>> the container can't be used to delete from. I wonder, if there is
>>>>> another implementation of EMF.edit commands for CDO objects, which
>>>>> are not contained, bu simply referenced by a CDO resource URI?
>>>> CDOObjects are always contained somewhere if they belong to a
>>>> repository (the root resource being the only exception to this rule).
>>>> Maybe you can post an executable example code (ideally use our test
>>>> model1)?
>>>>
>>>> Cheers
>>>> /Eike
>>>>
>>>> ----
>>>> http://www.esc-net.de
>>>> http://thegordian.blogspot.com
>>>> http://twitter.com/eikestepper
>>>>
>>>>
>>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: [CDO] and the EMF commands. [message #697706 is a reply to message #697675] Sun, 17 July 2011 19:30 Go to previous messageGo to next message
Christophe Bouhier is currently offline Christophe BouhierFriend
Messages: 937
Registered: July 2009
Senior Member
On 17-07-11 19:21, Ed Merks wrote:
> Comments below.
>
> On 17/07/2011 9:14 AM, Eike Stepper wrote:
>> Am 17.07.2011 16:51, schrieb Christophe Bouhier:
>>> On 15-07-11 16:37, Ed Merks wrote:
>>>> This doesn't sound specific to CDO. DeleteCommand is not designed, by
>>>> default, to delete objects from their resource. More often than not,
>>>> this would result in an empty resource, which often isn't valid. Nor is
>>>> there any support for creating a new root object in resource, so
>>>> deleting root objects would be kind of a one-way trip to emptiness. I
>>>> wonder if you need to support deleting the resources themselves?
>>>>
>>> Hi Ed,
>>> No, I don't need to delete the resource, just one of the objects in it.
>>> Perhaps I need to clarify that we create CDO resources, using the
>>> EClass name of an object. (So each Object has it's own resource path
>>> cdo://repo/[EClass.name]. Containment is less important this way, as
>>> I can always find objects. (We don't use a lot of tree viewers).
>> Just out of curiosity, is there only ever one object in such a "class
>> resource"?
> I get the sense that all objects of a given class end up there (so he
> can easily find all objects of a given class).
Exactly. All objects of a given class end up in such a resource.

>>
>>>
>>> I need to add and delete from this resource. Adding is no problem, as
>>> I can do resource.getContents like this:
>>>
>>> c = new AddCommand(editingService.getEditingDomain(),
>>> resource.getContents(), object);
>>>
>>> but deleting which goes through the DeleteAction is the issue.
> You can specialize the item provider for ResourceItemProvider to support
> createRemoveCommand; you might also specialize it to support child
> creation as well as add...
Ok, I will try this.

>> I've just tested deletion of objects, including resource root objects,
>> with the generic CDO editor (see CDOServer+CDOExplorer at
>> http://www.eclipse.org/cdo/downloads/#R20110608_1407 ).
> Maybe it works because CDO resources are EObjects? ResourceItemProvider
> doesn't support it directly though...
>> Both work without any problems. Can you provide us with something that
>> is directly executable and reproduces your problem?
Eike, I have to admit I am not too familiar with the CDO Editor, but I
will for sure try to isolate the issue, and make it reproducable.

>> Cheers
>> /Eike
>>
>> ----
>> http://www.esc-net.de
>> http://thegordian.blogspot.com
>> http://twitter.com/eikestepper
>>
>>
>>>
>>>
>>>>
>>>>
>>>> On 15/07/2011 2:09 AM, Eike Stepper wrote:
>>>>> Am 15.07.2011 10:09, schrieb Christophe Bouhier:
>>>>>> Hi,
>>>>>>
>>>>>> Since I use CDO to get objects, through a resource, I notice that the
>>>>>> EMF Delete command I use, can not execute. (canExecute() is false).
>>>>>> This seems only to happen, if the CDO object is retrieved through a
>>>>>> CDO resource, and has eContainer = null. This kind of makes sense, if
>>>>>> the container can't be used to delete from. I wonder, if there is
>>>>>> another implementation of EMF.edit commands for CDO objects, which
>>>>>> are not contained, bu simply referenced by a CDO resource URI?
>>>>> CDOObjects are always contained somewhere if they belong to a
>>>>> repository (the root resource being the only exception to this rule).
>>>>> Maybe you can post an executable example code (ideally use our test
>>>>> model1)?
>>>>>
>>>>> Cheers
>>>>> /Eike
>>>>>
>>>>> ----
>>>>> http://www.esc-net.de
>>>>> http://thegordian.blogspot.com
>>>>> http://twitter.com/eikestepper
>>>>>
>>>>>
>>>
Re: [CDO] and the EMF commands. [message #698054 is a reply to message #697163] Mon, 18 July 2011 17:00 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by:

Would you accept contributions on that, Ed? We have some extensible
CrossReferencing mechanism implemented here... Basically, a
CrossReferencer is pulled out of a registry. The criteria used is the
object type (EObject, CDOObject, <add your flavor here> ....).
So if we are crossferencing over CDOObject, another CrossReferencer
comes into play...

Eike Stepper escribió:
> Am 15.07.2011 18:24, schrieb Ed Merks:
>> Eike,
>>
>> Comments below.
>>
>> On 15/07/2011 9:06 AM, Eike Stepper wrote:
>>> Am 15.07.2011 16:37, schrieb Ed Merks:
>>>> This doesn't sound specific to CDO. DeleteCommand is not designed,
>>>> by default, to delete objects from their resource.
>>> Ah, I didn't even know that. I do remember some scalability issues
>>> with DeleteCommand, though. Does it rely on the default usage cross
>>> referencer?
>> Yes, a DeleteCommand needs to discover all references to the object
>> and it's children being deleted so that not only is the object removed
>> from its container, but all references to the object and it's children
>> are eliminated.
> That's what I suspected. Is there a way to influence the choice of the
> cross referencer implementation on model level, e.g., a resource set
> adapter?
>
> Cheers
> /Eike
>
> ----
> http://www.esc-net.de
> http://thegordian.blogspot.com
> http://twitter.com/eikestepper
>
>
>
>>>
>>>> More often than not, this would result in an empty resource, which
>>>> often isn't valid. Nor is there any support for creating a new root
>>>> object in resource, so deleting root objects would be kind of a
>>>> one-way trip to emptiness.
>>> The generic CDO editor supports 0..n root objects.
>> An XMI resource supports that as well.
>>>
>>>> I wonder if you need to support deleting the resources themselves?
>>> In CDO that's possible, of course.
>> The issue is that deleting resources is more similar to doing a save
>> because the effect can be seen outside the editor...
>>>
>>> Cheers
>>> /Eike
>>>
>>> ----
>>> http://www.esc-net.de
>>> http://thegordian.blogspot.com
>>> http://twitter.com/eikestepper
>>>
>>>
>>>>
>>>>
>>>>
>>>> On 15/07/2011 2:09 AM, Eike Stepper wrote:
>>>>> Am 15.07.2011 10:09, schrieb Christophe Bouhier:
>>>>>> Hi,
>>>>>>
>>>>>> Since I use CDO to get objects, through a resource, I notice that
>>>>>> the EMF Delete command I use, can not execute. (canExecute() is
>>>>>> false).
>>>>>> This seems only to happen, if the CDO object is retrieved through
>>>>>> a CDO resource, and has eContainer = null. This kind of makes
>>>>>> sense, if the container can't be used to delete from. I wonder, if
>>>>>> there is another implementation of EMF.edit commands for CDO
>>>>>> objects, which are not contained, bu simply referenced by a CDO
>>>>>> resource URI?
>>>>> CDOObjects are always contained somewhere if they belong to a
>>>>> repository (the root resource being the only exception to this
>>>>> rule). Maybe you can post an executable example code (ideally use
>>>>> our test model1)?
>>>>>
>>>>> Cheers
>>>>> /Eike
>>>>>
>>>>> ----
>>>>> http://www.esc-net.de
>>>>> http://thegordian.blogspot.com
>>>>> http://twitter.com/eikestepper
>>>>>
>>>>>
Re: [CDO] and the EMF commands. [message #698055 is a reply to message #698054] Mon, 18 July 2011 17:26 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33217
Registered: July 2009
Senior Member
Víctor,

Hopefully it's something simple that doesn't introduce a dozen new
interfaces...


On 18/07/2011 10:00 AM, Víctor Roldán Betancort wrote:
> Would you accept contributions on that, Ed? We have some extensible
> CrossReferencing mechanism implemented here... Basically, a
> CrossReferencer is pulled out of a registry. The criteria used is the
> object type (EObject, CDOObject, <add your flavor here> ....).
> So if we are crossferencing over CDOObject, another CrossReferencer
> comes into play...
>
> Eike Stepper escribió:
>> Am 15.07.2011 18:24, schrieb Ed Merks:
>>> Eike,
>>>
>>> Comments below.
>>>
>>> On 15/07/2011 9:06 AM, Eike Stepper wrote:
>>>> Am 15.07.2011 16:37, schrieb Ed Merks:
>>>>> This doesn't sound specific to CDO. DeleteCommand is not designed,
>>>>> by default, to delete objects from their resource.
>>>> Ah, I didn't even know that. I do remember some scalability issues
>>>> with DeleteCommand, though. Does it rely on the default usage cross
>>>> referencer?
>>> Yes, a DeleteCommand needs to discover all references to the object
>>> and it's children being deleted so that not only is the object removed
>>> from its container, but all references to the object and it's children
>>> are eliminated.
>> That's what I suspected. Is there a way to influence the choice of the
>> cross referencer implementation on model level, e.g., a resource set
>> adapter?
>>
>> Cheers
>> /Eike
>>
>> ----
>> http://www.esc-net.de
>> http://thegordian.blogspot.com
>> http://twitter.com/eikestepper
>>
>>
>>
>>>>
>>>>> More often than not, this would result in an empty resource, which
>>>>> often isn't valid. Nor is there any support for creating a new root
>>>>> object in resource, so deleting root objects would be kind of a
>>>>> one-way trip to emptiness.
>>>> The generic CDO editor supports 0..n root objects.
>>> An XMI resource supports that as well.
>>>>
>>>>> I wonder if you need to support deleting the resources themselves?
>>>> In CDO that's possible, of course.
>>> The issue is that deleting resources is more similar to doing a save
>>> because the effect can be seen outside the editor...
>>>>
>>>> Cheers
>>>> /Eike
>>>>
>>>> ----
>>>> http://www.esc-net.de
>>>> http://thegordian.blogspot.com
>>>> http://twitter.com/eikestepper
>>>>
>>>>
>>>>>
>>>>>
>>>>>
>>>>> On 15/07/2011 2:09 AM, Eike Stepper wrote:
>>>>>> Am 15.07.2011 10:09, schrieb Christophe Bouhier:
>>>>>>> Hi,
>>>>>>>
>>>>>>> Since I use CDO to get objects, through a resource, I notice that
>>>>>>> the EMF Delete command I use, can not execute. (canExecute() is
>>>>>>> false).
>>>>>>> This seems only to happen, if the CDO object is retrieved through
>>>>>>> a CDO resource, and has eContainer = null. This kind of makes
>>>>>>> sense, if the container can't be used to delete from. I wonder, if
>>>>>>> there is another implementation of EMF.edit commands for CDO
>>>>>>> objects, which are not contained, bu simply referenced by a CDO
>>>>>>> resource URI?
>>>>>> CDOObjects are always contained somewhere if they belong to a
>>>>>> repository (the root resource being the only exception to this
>>>>>> rule). Maybe you can post an executable example code (ideally use
>>>>>> our test model1)?
>>>>>>
>>>>>> Cheers
>>>>>> /Eike
>>>>>>
>>>>>> ----
>>>>>> http://www.esc-net.de
>>>>>> http://thegordian.blogspot.com
>>>>>> http://twitter.com/eikestepper
>>>>>>
>>>>>>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: [CDO] and the EMF commands. [message #698056 is a reply to message #697163] Mon, 18 July 2011 17:00 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by:

Would you accept contributions on that, Ed? We have some extensible
CrossReferencing mechanism implemented here... Basically, a
CrossReferencer is pulled out of a registry. The criteria used is the
object type (EObject, CDOObject, <add your flavor here> ....).
So if we are crossferencing over CDOObject, another CrossReferencer
comes into play...

Eike Stepper escribió:
> Am 15.07.2011 18:24, schrieb Ed Merks:
>> Eike,
>>
>> Comments below.
>>
>> On 15/07/2011 9:06 AM, Eike Stepper wrote:
>>> Am 15.07.2011 16:37, schrieb Ed Merks:
>>>> This doesn't sound specific to CDO. DeleteCommand is not designed,
>>>> by default, to delete objects from their resource.
>>> Ah, I didn't even know that. I do remember some scalability issues
>>> with DeleteCommand, though. Does it rely on the default usage cross
>>> referencer?
>> Yes, a DeleteCommand needs to discover all references to the object
>> and it's children being deleted so that not only is the object removed
>> from its container, but all references to the object and it's children
>> are eliminated.
> That's what I suspected. Is there a way to influence the choice of the
> cross referencer implementation on model level, e.g., a resource set
> adapter?
>
> Cheers
> /Eike
>
> ----
> http://www.esc-net.de
> http://thegordian.blogspot.com
> http://twitter.com/eikestepper
>
>
>
>>>
>>>> More often than not, this would result in an empty resource, which
>>>> often isn't valid. Nor is there any support for creating a new root
>>>> object in resource, so deleting root objects would be kind of a
>>>> one-way trip to emptiness.
>>> The generic CDO editor supports 0..n root objects.
>> An XMI resource supports that as well.
>>>
>>>> I wonder if you need to support deleting the resources themselves?
>>> In CDO that's possible, of course.
>> The issue is that deleting resources is more similar to doing a save
>> because the effect can be seen outside the editor...
>>>
>>> Cheers
>>> /Eike
>>>
>>> ----
>>> http://www.esc-net.de
>>> http://thegordian.blogspot.com
>>> http://twitter.com/eikestepper
>>>
>>>
>>>>
>>>>
>>>>
>>>> On 15/07/2011 2:09 AM, Eike Stepper wrote:
>>>>> Am 15.07.2011 10:09, schrieb Christophe Bouhier:
>>>>>> Hi,
>>>>>>
>>>>>> Since I use CDO to get objects, through a resource, I notice that
>>>>>> the EMF Delete command I use, can not execute. (canExecute() is
>>>>>> false).
>>>>>> This seems only to happen, if the CDO object is retrieved through
>>>>>> a CDO resource, and has eContainer = null. This kind of makes
>>>>>> sense, if the container can't be used to delete from. I wonder, if
>>>>>> there is another implementation of EMF.edit commands for CDO
>>>>>> objects, which are not contained, bu simply referenced by a CDO
>>>>>> resource URI?
>>>>> CDOObjects are always contained somewhere if they belong to a
>>>>> repository (the root resource being the only exception to this
>>>>> rule). Maybe you can post an executable example code (ideally use
>>>>> our test model1)?
>>>>>
>>>>> Cheers
>>>>> /Eike
>>>>>
>>>>> ----
>>>>> http://www.esc-net.de
>>>>> http://thegordian.blogspot.com
>>>>> http://twitter.com/eikestepper
>>>>>
>>>>>
Re: [CDO] and the EMF commands. [message #698057 is a reply to message #698054] Mon, 18 July 2011 17:26 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33217
Registered: July 2009
Senior Member
Víctor,

Hopefully it's something simple that doesn't introduce a dozen new
interfaces...


On 18/07/2011 10:00 AM, Víctor Roldán Betancort wrote:
> Would you accept contributions on that, Ed? We have some extensible
> CrossReferencing mechanism implemented here... Basically, a
> CrossReferencer is pulled out of a registry. The criteria used is the
> object type (EObject, CDOObject, <add your flavor here> ....).
> So if we are crossferencing over CDOObject, another CrossReferencer
> comes into play...
>
> Eike Stepper escribió:
>> Am 15.07.2011 18:24, schrieb Ed Merks:
>>> Eike,
>>>
>>> Comments below.
>>>
>>> On 15/07/2011 9:06 AM, Eike Stepper wrote:
>>>> Am 15.07.2011 16:37, schrieb Ed Merks:
>>>>> This doesn't sound specific to CDO. DeleteCommand is not designed,
>>>>> by default, to delete objects from their resource.
>>>> Ah, I didn't even know that. I do remember some scalability issues
>>>> with DeleteCommand, though. Does it rely on the default usage cross
>>>> referencer?
>>> Yes, a DeleteCommand needs to discover all references to the object
>>> and it's children being deleted so that not only is the object removed
>>> from its container, but all references to the object and it's children
>>> are eliminated.
>> That's what I suspected. Is there a way to influence the choice of the
>> cross referencer implementation on model level, e.g., a resource set
>> adapter?
>>
>> Cheers
>> /Eike
>>
>> ----
>> http://www.esc-net.de
>> http://thegordian.blogspot.com
>> http://twitter.com/eikestepper
>>
>>
>>
>>>>
>>>>> More often than not, this would result in an empty resource, which
>>>>> often isn't valid. Nor is there any support for creating a new root
>>>>> object in resource, so deleting root objects would be kind of a
>>>>> one-way trip to emptiness.
>>>> The generic CDO editor supports 0..n root objects.
>>> An XMI resource supports that as well.
>>>>
>>>>> I wonder if you need to support deleting the resources themselves?
>>>> In CDO that's possible, of course.
>>> The issue is that deleting resources is more similar to doing a save
>>> because the effect can be seen outside the editor...
>>>>
>>>> Cheers
>>>> /Eike
>>>>
>>>> ----
>>>> http://www.esc-net.de
>>>> http://thegordian.blogspot.com
>>>> http://twitter.com/eikestepper
>>>>
>>>>
>>>>>
>>>>>
>>>>>
>>>>> On 15/07/2011 2:09 AM, Eike Stepper wrote:
>>>>>> Am 15.07.2011 10:09, schrieb Christophe Bouhier:
>>>>>>> Hi,
>>>>>>>
>>>>>>> Since I use CDO to get objects, through a resource, I notice that
>>>>>>> the EMF Delete command I use, can not execute. (canExecute() is
>>>>>>> false).
>>>>>>> This seems only to happen, if the CDO object is retrieved through
>>>>>>> a CDO resource, and has eContainer = null. This kind of makes
>>>>>>> sense, if the container can't be used to delete from. I wonder, if
>>>>>>> there is another implementation of EMF.edit commands for CDO
>>>>>>> objects, which are not contained, bu simply referenced by a CDO
>>>>>>> resource URI?
>>>>>> CDOObjects are always contained somewhere if they belong to a
>>>>>> repository (the root resource being the only exception to this
>>>>>> rule). Maybe you can post an executable example code (ideally use
>>>>>> our test model1)?
>>>>>>
>>>>>> Cheers
>>>>>> /Eike
>>>>>>
>>>>>> ----
>>>>>> http://www.esc-net.de
>>>>>> http://thegordian.blogspot.com
>>>>>> http://twitter.com/eikestepper
>>>>>>
>>>>>>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: [CDO] and the EMF commands. [message #698435 is a reply to message #698055] Tue, 19 July 2011 13:14 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by:

I can send you the code, you take a look and give some feedback, is that ok?

Ed Merks escribió:
> Víctor,
>
> Hopefully it's something simple that doesn't introduce a dozen new
> interfaces...
>
>
> On 18/07/2011 10:00 AM, Víctor Roldán Betancort wrote:
>> Would you accept contributions on that, Ed? We have some extensible
>> CrossReferencing mechanism implemented here... Basically, a
>> CrossReferencer is pulled out of a registry. The criteria used is the
>> object type (EObject, CDOObject, <add your flavor here> ....).
>> So if we are crossferencing over CDOObject, another CrossReferencer
>> comes into play...
>>
>> Eike Stepper escribió:
>>> Am 15.07.2011 18:24, schrieb Ed Merks:
>>>> Eike,
>>>>
>>>> Comments below.
>>>>
>>>> On 15/07/2011 9:06 AM, Eike Stepper wrote:
>>>>> Am 15.07.2011 16:37, schrieb Ed Merks:
>>>>>> This doesn't sound specific to CDO. DeleteCommand is not designed,
>>>>>> by default, to delete objects from their resource.
>>>>> Ah, I didn't even know that. I do remember some scalability issues
>>>>> with DeleteCommand, though. Does it rely on the default usage cross
>>>>> referencer?
>>>> Yes, a DeleteCommand needs to discover all references to the object
>>>> and it's children being deleted so that not only is the object removed
>>>> from its container, but all references to the object and it's children
>>>> are eliminated.
>>> That's what I suspected. Is there a way to influence the choice of the
>>> cross referencer implementation on model level, e.g., a resource set
>>> adapter?
>>>
>>> Cheers
>>> /Eike
>>>
>>> ----
>>> http://www.esc-net.de
>>> http://thegordian.blogspot.com
>>> http://twitter.com/eikestepper
>>>
>>>
>>>
>>>>>
>>>>>> More often than not, this would result in an empty resource, which
>>>>>> often isn't valid. Nor is there any support for creating a new root
>>>>>> object in resource, so deleting root objects would be kind of a
>>>>>> one-way trip to emptiness.
>>>>> The generic CDO editor supports 0..n root objects.
>>>> An XMI resource supports that as well.
>>>>>
>>>>>> I wonder if you need to support deleting the resources themselves?
>>>>> In CDO that's possible, of course.
>>>> The issue is that deleting resources is more similar to doing a save
>>>> because the effect can be seen outside the editor...
>>>>>
>>>>> Cheers
>>>>> /Eike
>>>>>
>>>>> ----
>>>>> http://www.esc-net.de
>>>>> http://thegordian.blogspot.com
>>>>> http://twitter.com/eikestepper
>>>>>
>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> On 15/07/2011 2:09 AM, Eike Stepper wrote:
>>>>>>> Am 15.07.2011 10:09, schrieb Christophe Bouhier:
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> Since I use CDO to get objects, through a resource, I notice that
>>>>>>>> the EMF Delete command I use, can not execute. (canExecute() is
>>>>>>>> false).
>>>>>>>> This seems only to happen, if the CDO object is retrieved through
>>>>>>>> a CDO resource, and has eContainer = null. This kind of makes
>>>>>>>> sense, if the container can't be used to delete from. I wonder, if
>>>>>>>> there is another implementation of EMF.edit commands for CDO
>>>>>>>> objects, which are not contained, bu simply referenced by a CDO
>>>>>>>> resource URI?
>>>>>>> CDOObjects are always contained somewhere if they belong to a
>>>>>>> repository (the root resource being the only exception to this
>>>>>>> rule). Maybe you can post an executable example code (ideally use
>>>>>>> our test model1)?
>>>>>>>
>>>>>>> Cheers
>>>>>>> /Eike
>>>>>>>
>>>>>>> ----
>>>>>>> http://www.esc-net.de
>>>>>>> http://thegordian.blogspot.com
>>>>>>> http://twitter.com/eikestepper
>>>>>>>
>>>>>>>
>>
Re: [CDO] and the EMF commands. [message #698515 is a reply to message #698435] Tue, 19 July 2011 15:14 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33217
Registered: July 2009
Senior Member
Víctor,

Sure. Let's open a bugzilla for it so there's an IP trail...


On 19/07/2011 6:14 AM, Víctor Roldán Betancort wrote:
> I can send you the code, you take a look and give some feedback, is
> that ok?
>
> Ed Merks escribió:
>> Víctor,
>>
>> Hopefully it's something simple that doesn't introduce a dozen new
>> interfaces...
>>
>>
>> On 18/07/2011 10:00 AM, Víctor Roldán Betancort wrote:
>>> Would you accept contributions on that, Ed? We have some extensible
>>> CrossReferencing mechanism implemented here... Basically, a
>>> CrossReferencer is pulled out of a registry. The criteria used is the
>>> object type (EObject, CDOObject, <add your flavor here> ....).
>>> So if we are crossferencing over CDOObject, another CrossReferencer
>>> comes into play...
>>>
>>> Eike Stepper escribió:
>>>> Am 15.07.2011 18:24, schrieb Ed Merks:
>>>>> Eike,
>>>>>
>>>>> Comments below.
>>>>>
>>>>> On 15/07/2011 9:06 AM, Eike Stepper wrote:
>>>>>> Am 15.07.2011 16:37, schrieb Ed Merks:
>>>>>>> This doesn't sound specific to CDO. DeleteCommand is not designed,
>>>>>>> by default, to delete objects from their resource.
>>>>>> Ah, I didn't even know that. I do remember some scalability issues
>>>>>> with DeleteCommand, though. Does it rely on the default usage cross
>>>>>> referencer?
>>>>> Yes, a DeleteCommand needs to discover all references to the object
>>>>> and it's children being deleted so that not only is the object
>>>>> removed
>>>>> from its container, but all references to the object and it's
>>>>> children
>>>>> are eliminated.
>>>> That's what I suspected. Is there a way to influence the choice of the
>>>> cross referencer implementation on model level, e.g., a resource set
>>>> adapter?
>>>>
>>>> Cheers
>>>> /Eike
>>>>
>>>> ----
>>>> http://www.esc-net.de
>>>> http://thegordian.blogspot.com
>>>> http://twitter.com/eikestepper
>>>>
>>>>
>>>>
>>>>>>
>>>>>>> More often than not, this would result in an empty resource, which
>>>>>>> often isn't valid. Nor is there any support for creating a new root
>>>>>>> object in resource, so deleting root objects would be kind of a
>>>>>>> one-way trip to emptiness.
>>>>>> The generic CDO editor supports 0..n root objects.
>>>>> An XMI resource supports that as well.
>>>>>>
>>>>>>> I wonder if you need to support deleting the resources themselves?
>>>>>> In CDO that's possible, of course.
>>>>> The issue is that deleting resources is more similar to doing a save
>>>>> because the effect can be seen outside the editor...
>>>>>>
>>>>>> Cheers
>>>>>> /Eike
>>>>>>
>>>>>> ----
>>>>>> http://www.esc-net.de
>>>>>> http://thegordian.blogspot.com
>>>>>> http://twitter.com/eikestepper
>>>>>>
>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On 15/07/2011 2:09 AM, Eike Stepper wrote:
>>>>>>>> Am 15.07.2011 10:09, schrieb Christophe Bouhier:
>>>>>>>>> Hi,
>>>>>>>>>
>>>>>>>>> Since I use CDO to get objects, through a resource, I notice that
>>>>>>>>> the EMF Delete command I use, can not execute. (canExecute() is
>>>>>>>>> false).
>>>>>>>>> This seems only to happen, if the CDO object is retrieved through
>>>>>>>>> a CDO resource, and has eContainer = null. This kind of makes
>>>>>>>>> sense, if the container can't be used to delete from. I
>>>>>>>>> wonder, if
>>>>>>>>> there is another implementation of EMF.edit commands for CDO
>>>>>>>>> objects, which are not contained, bu simply referenced by a CDO
>>>>>>>>> resource URI?
>>>>>>>> CDOObjects are always contained somewhere if they belong to a
>>>>>>>> repository (the root resource being the only exception to this
>>>>>>>> rule). Maybe you can post an executable example code (ideally use
>>>>>>>> our test model1)?
>>>>>>>>
>>>>>>>> Cheers
>>>>>>>> /Eike
>>>>>>>>
>>>>>>>> ----
>>>>>>>> http://www.esc-net.de
>>>>>>>> http://thegordian.blogspot.com
>>>>>>>> http://twitter.com/eikestepper
>>>>>>>>
>>>>>>>>
>>>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: [CDO] and the EMF commands. [message #698920 is a reply to message #697675] Wed, 20 July 2011 13:25 Go to previous messageGo to next message
Christophe Bouhier is currently offline Christophe BouhierFriend
Messages: 937
Registered: July 2009
Senior Member
Hi Ed, Eike,

For the customization, I tried to follow your advise, I have followed
the code and summarized this below. I discovered, that my composed
adapterfactory missed some xxxItemProviderAdapterFactories. Most
importantly the ResourceItemProviderAdapterFactories. I have added this
and I now have an executable DeleteAction. Sorry for inconvenience.

> You can specialize the item provider for ResourceItemProvider to upport
> createRemoveCommand; you might also specialize it to support child
> creation as well as add...


****** begin of trail, for those interrested on how the RemoveCommand is
created.

The AdapterFactoryEditingDomain -> createCommand, already returns a new
DeleteCommand(..), pre-empting the code which would adapt to a
ResourceItemProvider.

First, a DeleteCommand is created.


else if (commandClass == DeleteCommand.class)
{
return new DeleteCommand(this, commandParameter.getCollection());
}

Of course this could be a RemoveCommand, if the DeleteAction would have
the option "removeAllReferences"=false.

Later on, when canExecute() is called, I do end up in createCommand
again, for the RemoveCommand. The "Owner" is null, so the comment in the
code describes:

// For RemoveCommand, we will find the owner by calling
EditingDomain.getParent() on the object(s) being removed.

Then, this delegates to the ItemProviderAdapter to get the parent,
next, we have a parent which is the CDOResource as eContainer=null. Next
the createCommand(...) in AFEditingDomain is called again, with a
CDOResource owner.

This owner (CDOResource) can not be adapted to an ItemProvider, so the
default ItemProviderAdapter is used, to create the command, which
finally calls this:

else
{
result = factorRemoveCommand(domain, commandParameter);
}

this uses the CDOResource as an owner to get children featurs through
this call:

private Collection<? extends EStructuralFeature>
getAnyChildrenFeatures(Object object)
{
Collection<? extends EStructuralFeature> result =
getChildrenFeatures(object);
return result.isEmpty() ? getChildrenReferences(object) : result;
}

This results, in 0 children features, which leads to an
UnexecutableCommand.INSTANCE;



******* end of trail.
Re: [CDO] and the EMF commands. [message #698923 is a reply to message #698515] Wed, 20 July 2011 13:34 Go to previous message
Eclipse UserFriend
Originally posted by:

Done!

Bug 352577 - Provide custom CrossReferencer delegation
https://bugs.eclipse.org/bugs/show_bug.cgi?id=352577

Comments / thoughts / ideas are welcome :)

Ed Merks escribió:
> Víctor,
>
> Sure. Let's open a bugzilla for it so there's an IP trail...
>
>
> On 19/07/2011 6:14 AM, Víctor Roldán Betancort wrote:
>> I can send you the code, you take a look and give some feedback, is
>> that ok?
>>
>> Ed Merks escribió:
>>> Víctor,
>>>
>>> Hopefully it's something simple that doesn't introduce a dozen new
>>> interfaces...
>>>
>>>
>>> On 18/07/2011 10:00 AM, Víctor Roldán Betancort wrote:
>>>> Would you accept contributions on that, Ed? We have some extensible
>>>> CrossReferencing mechanism implemented here... Basically, a
>>>> CrossReferencer is pulled out of a registry. The criteria used is the
>>>> object type (EObject, CDOObject, <add your flavor here> ....).
>>>> So if we are crossferencing over CDOObject, another CrossReferencer
>>>> comes into play...
>>>>
>>>> Eike Stepper escribió:
>>>>> Am 15.07.2011 18:24, schrieb Ed Merks:
>>>>>> Eike,
>>>>>>
>>>>>> Comments below.
>>>>>>
>>>>>> On 15/07/2011 9:06 AM, Eike Stepper wrote:
>>>>>>> Am 15.07.2011 16:37, schrieb Ed Merks:
>>>>>>>> This doesn't sound specific to CDO. DeleteCommand is not designed,
>>>>>>>> by default, to delete objects from their resource.
>>>>>>> Ah, I didn't even know that. I do remember some scalability issues
>>>>>>> with DeleteCommand, though. Does it rely on the default usage cross
>>>>>>> referencer?
>>>>>> Yes, a DeleteCommand needs to discover all references to the object
>>>>>> and it's children being deleted so that not only is the object
>>>>>> removed
>>>>>> from its container, but all references to the object and it's
>>>>>> children
>>>>>> are eliminated.
>>>>> That's what I suspected. Is there a way to influence the choice of the
>>>>> cross referencer implementation on model level, e.g., a resource set
>>>>> adapter?
>>>>>
>>>>> Cheers
>>>>> /Eike
>>>>>
>>>>> ----
>>>>> http://www.esc-net.de
>>>>> http://thegordian.blogspot.com
>>>>> http://twitter.com/eikestepper
>>>>>
>>>>>
>>>>>
>>>>>>>
>>>>>>>> More often than not, this would result in an empty resource, which
>>>>>>>> often isn't valid. Nor is there any support for creating a new root
>>>>>>>> object in resource, so deleting root objects would be kind of a
>>>>>>>> one-way trip to emptiness.
>>>>>>> The generic CDO editor supports 0..n root objects.
>>>>>> An XMI resource supports that as well.
>>>>>>>
>>>>>>>> I wonder if you need to support deleting the resources themselves?
>>>>>>> In CDO that's possible, of course.
>>>>>> The issue is that deleting resources is more similar to doing a save
>>>>>> because the effect can be seen outside the editor...
>>>>>>>
>>>>>>> Cheers
>>>>>>> /Eike
>>>>>>>
>>>>>>> ----
>>>>>>> http://www.esc-net.de
>>>>>>> http://thegordian.blogspot.com
>>>>>>> http://twitter.com/eikestepper
>>>>>>>
>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> On 15/07/2011 2:09 AM, Eike Stepper wrote:
>>>>>>>>> Am 15.07.2011 10:09, schrieb Christophe Bouhier:
>>>>>>>>>> Hi,
>>>>>>>>>>
>>>>>>>>>> Since I use CDO to get objects, through a resource, I notice that
>>>>>>>>>> the EMF Delete command I use, can not execute. (canExecute() is
>>>>>>>>>> false).
>>>>>>>>>> This seems only to happen, if the CDO object is retrieved through
>>>>>>>>>> a CDO resource, and has eContainer = null. This kind of makes
>>>>>>>>>> sense, if the container can't be used to delete from. I
>>>>>>>>>> wonder, if
>>>>>>>>>> there is another implementation of EMF.edit commands for CDO
>>>>>>>>>> objects, which are not contained, bu simply referenced by a CDO
>>>>>>>>>> resource URI?
>>>>>>>>> CDOObjects are always contained somewhere if they belong to a
>>>>>>>>> repository (the root resource being the only exception to this
>>>>>>>>> rule). Maybe you can post an executable example code (ideally use
>>>>>>>>> our test model1)?
>>>>>>>>>
>>>>>>>>> Cheers
>>>>>>>>> /Eike
>>>>>>>>>
>>>>>>>>> ----
>>>>>>>>> http://www.esc-net.de
>>>>>>>>> http://thegordian.blogspot.com
>>>>>>>>> http://twitter.com/eikestepper
>>>>>>>>>
>>>>>>>>>
>>>>
>>
Previous Topic:How to add get a GUID attribute when reading a XMI file
Next Topic:Using GenModel Redirection Pattern to change a single filename
Goto Forum:
  


Current Time: Tue Sep 24 10:39:40 GMT 2024

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

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

Back to the top