|
|
|
|
|
|
|
Re: Undo/Redo using ChangeCommand [message #415034 is a reply to message #415031] |
Wed, 28 November 2007 14:24 |
Ed Merks Messages: 33218 Registered: July 2009 |
Senior Member |
|
|
BG,
I just have a bad feeling I'm missing something important that's not
been stated. I certainly imagine that if changes are being recorded for
obj1 and obj3 that apply those changes will undo any changes made to
them. A running (failing) test case I can use to reproduce the problem
is likely to be better than dozens of note exchanges. To directly
answer your question, I imagine at some point you are duplicating obj1
(not sure what that means, it might just mean creating an object of the
same type as obj1, or it might mean more). I would imagine that this
duplication process, if it involves changes that affect obj1 or any
other object would itself be done as a specialized change command. But
I'd need to ask many more questions to understand exactly the complete
structure of what you are doing....
BG wrote:
>
> Hello Mr Ed Marks
>
> Regarding first question abt [1] .I didn't get this point sorry ?
>
> Well, I noticed it's single valued so when obj3 refers to dupObj1,
> obj1 is being modified, right? So are changes for it being recorded?
> I.e., are you passing obj3 and obj1 to the change command?
>
> "Yes we are passing the obj1 and obj3 seperately for recording"
>
> Perhaps that's all that's missing, so I won't worry about the other
> issues until this part is clear.
> You might also try passing in the whole resource that contains all
> these things... ?
> "Can i known how to pass this as a resource since these are from
> different resoucres (different object type they are non-containment
> reference) ?"
>
>
> Regarding 2 it will have reference to obj3 from obj1...
>
> and during duplication also it obj3 holds reference to dupObj1 i.e
>
> |----obj1 obj3|
> |----dupObj1
>
> The dupObj1 is created and reference is added using our own command
> which similar to add command.
>
> Can i known how to pass the created dupObj1 to recorder while recording ?
>
> Regards
> BG
>
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Re: Undo/Redo using ChangeCommand [message #415045 is a reply to message #415034] |
Wed, 28 November 2007 16:04 |
byrebg Mising name Messages: 48 Registered: July 2009 |
Member |
|
|
Hello Mr Ed marks,
Thanks for your relpy.
Regarding duplication of the obj1 to dupObj1 is just creating a copy of
obji itself and adding then obj3 is then reference to dupObj so that obj3
will have reference to the duplicates obj1 created.
My only problem during undo is the the reference added to obj3 while
duplicating not getting removed i.e even after undo (where dupObj1)
removed from tree obj3 is still holding reference to that duplicated
object.
For me i need immediate solution for this ?Or can i refer any of the
undo/redo testcase which handles this type of problems ?
Thanks
BG
Ed Merks wrote:
> BG,
> I just have a bad feeling I'm missing something important that's not
> been stated. I certainly imagine that if changes are being recorded for
> obj1 and obj3 that apply those changes will undo any changes made to
> them. A running (failing) test case I can use to reproduce the problem
> is likely to be better than dozens of note exchanges. To directly
> answer your question, I imagine at some point you are duplicating obj1
> (not sure what that means, it might just mean creating an object of the
> same type as obj1, or it might mean more). I would imagine that this
> duplication process, if it involves changes that affect obj1 or any
> other object would itself be done as a specialized change command. But
> I'd need to ask many more questions to understand exactly the complete
> structure of what you are doing....
> BG wrote:
>>
>> Hello Mr Ed Marks
>>
>> Regarding first question abt [1] .I didn't get this point sorry ?
>>
>> Well, I noticed it's single valued so when obj3 refers to dupObj1,
>> obj1 is being modified, right? So are changes for it being recorded?
>> I.e., are you passing obj3 and obj1 to the change command?
>>
>> "Yes we are passing the obj1 and obj3 seperately for recording"
>>
>> Perhaps that's all that's missing, so I won't worry about the other
>> issues until this part is clear.
>> You might also try passing in the whole resource that contains all
>> these things... ?
>> "Can i known how to pass this as a resource since these are from
>> different resoucres (different object type they are non-containment
>> reference) ?"
>>
>>
>> Regarding 2 it will have reference to obj3 from obj1...
>>
>> and during duplication also it obj3 holds reference to dupObj1 i.e
>>
>> |----obj1 obj3|
>> |----dupObj1
>>
>> The dupObj1 is created and reference is added using our own command
>> which similar to add command.
>>
>> Can i known how to pass the created dupObj1 to recorder while recording ?
>>
>> Regards
>> BG
>>
>>
Hello Mr Ed
|
|
|
Re: Undo/Redo using ChangeCommand [message #415050 is a reply to message #415045] |
Wed, 28 November 2007 16:45 |
Ed Merks Messages: 33218 Registered: July 2009 |
Senior Member |
|
|
BG,
Comments below.
BG wrote:
> Hello Mr Ed marks,
> Thanks for your relpy.
> Regarding duplication of the obj1 to dupObj1 is just creating a copy
> of obji itself and adding then obj3 is then reference to dupObj so
> that obj3 will have reference to the duplicates obj1 created.
If necessary, you could implement the undo right in this command that's
doing the duplication. Is this activity happening as part of the
doExecution of the change command? If so, they you do in fact has
access to the dupObj1 and you could add the changeRecorder to the
eAdapters() of that object before you start to modify it further.
>
> My only problem during undo is the the reference added to obj3 while
> duplicating not getting removed i.e even after undo (where dupObj1)
> removed from tree obj3 is still holding reference to that duplicated
> object.
I understand the problem now, but what I've not seen is a single line of
code for how you are doing it. Nor do I have a test case I could look
at to duplicate your results.
>
> For me i need immediate solution for this ?Or can i refer any of the
> undo/redo testcase which handles this type of problems ?
You could look at org.eclipse.emf.test.core.change.ChangeRecordTest.
It's part of the automated tests available with every build on the
download page.
>
> Thanks BG
>
>
>
> Ed Merks wrote:
>
>> BG,
>
>> I just have a bad feeling I'm missing something important that's not
>> been stated. I certainly imagine that if changes are being recorded
>> for obj1 and obj3 that apply those changes will undo any changes made
>> to them. A running (failing) test case I can use to reproduce the
>> problem is likely to be better than dozens of note exchanges. To
>> directly answer your question, I imagine at some point you are
>> duplicating obj1 (not sure what that means, it might just mean
>> creating an object of the same type as obj1, or it might mean more).
>> I would imagine that this duplication process, if it involves changes
>> that affect obj1 or any other object would itself be done as a
>> specialized change command. But I'd need to ask many more questions
>> to understand exactly the complete structure of what you are doing....
>
>> BG wrote:
>>>
>>> Hello Mr Ed Marks
>>>
>>> Regarding first question abt [1] .I didn't get this point sorry ?
>>>
>>> Well, I noticed it's single valued so when obj3 refers to dupObj1,
>>> obj1 is being modified, right? So are changes for it being
>>> recorded? I.e., are you passing obj3 and obj1 to the change command?
>>>
>>> "Yes we are passing the obj1 and obj3 seperately for recording"
>>>
>>> Perhaps that's all that's missing, so I won't worry about the other
>>> issues until this part is clear. You might also try passing in the
>>> whole resource that contains all these things... ?
>>> "Can i known how to pass this as a resource since these are from
>>> different resoucres (different object type they are non-containment
>>> reference) ?"
>>>
>>>
>>> Regarding 2 it will have reference to obj3 from obj1...
>>>
>>> and during duplication also it obj3 holds reference to dupObj1 i.e
>>>
>>> |----obj1 obj3|
>>> |----dupObj1
>>>
>>> The dupObj1 is created and reference is added using our own command
>>> which similar to add command.
>>>
>>> Can i known how to pass the created dupObj1 to recorder while
>>> recording ?
>>>
>>> Regards
>>> BG
>>>
>>>
> Hello Mr Ed
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
|
|
|
|
Re: Undo/Redo using ChangeCommand [message #415121 is a reply to message #415114] |
Fri, 30 November 2007 12:26 |
Ed Merks Messages: 33218 Registered: July 2009 |
Senior Member |
|
|
BG,
I see. I wonder how that got out of whack? Maybe at one point, this
side of the bidirectional was changeable. I suppose our rule for
consistent opposites should specify that isChangeable must be the same
for both ends. Feel free to open a bugzilla request for that. It would
have saved us both some time to have had a constraint for that...
BG wrote:
> Thanks Mr Ed Marks,
>
> My problem got solved in bit some other way. I regenerated the emf
> code for my model.Then excecuted the undo/redo operation of the obj1
> .It is working fine.
>
> The only difference in the newly generated and old code was this i
> didn't get how this code got missed during code generation.
>
> method eSet(EStructuralFeature eFeature, Object newValue)
> case RulePackage.RULE__SYNC:
> getSync().clear();
> getSync().addAll((Collection)newValue);
>
> method
> eUnset(EStructuralFeature eFeature) {
>
> case RulePackage.RULE__SYNC:
> getSyncNode().clear();
> return;
>
>
> Regards
> BG
>
>
>
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.05395 seconds