Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » ChangeDesciption issue
ChangeDesciption issue [message #418703] Thu, 24 April 2008 16:01 Go to next message
Alan is currently offline AlanFriend
Messages: 44
Registered: July 2009
Member
Hello all,

I have an interesting problem I was hoping someone could help me with.
I am working on a toolsuite with various different domains.
The domains are seperate but can share data and for this we use a shared
data model.
In this model we have a collection of objects which can be connected
together.
So each domain that wishes to share data has that data implement the
ISharedObject interface and adds it to the shared model.
We have an editor to connect data together and a Connection object is
created to linked two ISharedObjects together.

Ok so far.

I am having a problem with undoing changes.
Scenario is as follows:

I add objectA which contains two pieces of shared info so two ISharedObjects
are added to shared model
I add objectB in another domain which adds itself as an ISharedObject.
I connect objects A and B together.
And save all editors.
Now I delete objectA. The command for this removes the data (ISharedObject x
2 for objectA) from shared data model.
It also removes the connection between them.
If I undo this it works fine as both ISharedObjects are added back as is the
Connection.

However if before I undo the delete I also go to the other domain and delete
objectB I have a problem,
I would not expect the Connection to be recreated as the two ends are not
there.
But the whole things falls over and fails.
(All editors have seperate undo stacks via a WorkspaceOperationHistory
divided up using contexts)

Even if I set it up so that the Connection removal is undoable I get a
problem.
It looks to me that the ChangeDescription has a problem as the data set has
changed since I ran the delete command. (just a guess)

The error at the bottom happens in BasicEList add method as a
BasicIndexOutOfBoundsException gets thrown


So anyone have any idea whats going on ?
Am I right in saying that the data set changing since the change was
recorded is the issue even if the data that has changed if not important to
the undo per se ?
Anyone else have experience of such a shared model.

Any help greatly appreciated as I'm stuck

thanks,

public void add(int index, E object)

{

if (index > size)

throw new BasicIndexOutOfBoundsException(index, size);


if (isUnique() && contains(object))

{

throw new IllegalArgumentException("The 'no duplicates' constraint is
violated");

}


addUnique(index, object);

}







org.eclipse.emf.common.util.BasicEList$BasicIndexOutOfBounds Exception:
index=3, size=0

at org.eclipse.emf.common.util.BasicEList.addAll(BasicEList.jav a:765)

at
org.eclipse.emf.ecore.change.impl.ListChangeImpl.applyAndRev erse(ListChangeImpl.java:524)

at
org.eclipse.emf.ecore.change.impl.ChangeDescriptionImpl.preA pply(ChangeDescriptionImpl.java:474)

at
org.eclipse.emf.ecore.change.impl.ChangeDescriptionImpl.appl yAndReverse(ChangeDescriptionImpl.java:321)

at
org.eclipse.emf.transaction.util.CompositeChangeDescription. applyAndReverse(CompositeChangeDescription.java:105)

at
org.eclipse.emf.workspace.AbstractEMFOperation.doUndo(Abstra ctEMFOperation.java:525)

at
org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTr ansactionalCommand.doUndo(AbstractTransactionalCommand.java: 259)
Re: ChangeDesciption issue [message #418708 is a reply to message #418703] Thu, 24 April 2008 17:04 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
Registered: July 2009
Senior Member
Alan,

Comments below.

Alan wrote:
> Hello all,
>
> I have an interesting problem I was hoping someone could help me with.
> I am working on a toolsuite with various different domains.
> The domains are seperate but can share data and for this we use a shared
> data model.
>
I wonder if there is a single editing domain then. It's tricky to
maintain a consistent undo stack otherwise...
> In this model we have a collection of objects which can be connected
> together.
> So each domain that wishes to share data has that data implement the
> ISharedObject interface and adds it to the shared model.
> We have an editor to connect data together and a Connection object is
> created to linked two ISharedObjects together.
>
Sounds a little worrisome...
> Ok so far.
>
> I am having a problem with undoing changes.
>
That's what I'd be concerned about.
> Scenario is as follows:
>
> I add objectA which contains two pieces of shared info so two ISharedObjects
> are added to shared model
> I add objectB in another domain which adds itself as an ISharedObject.
> I connect objects A and B together.
> And save all editors.
> Now I delete objectA. The command for this removes the data (ISharedObject x
> 2 for objectA) from shared data model.
> It also removes the connection between them.
> If I undo this it works fine as both ISharedObjects are added back as is the
> Connection.
>
This is all making me think you need a shared domain...
> However if before I undo the delete I also go to the other domain and delete
> objectB I have a problem,
> I would not expect the Connection to be recreated as the two ends are not
> there.
> But the whole things falls over and fails.
> (All editors have seperate undo stacks via a WorkspaceOperationHistory
> divided up using contexts)
>
The transaction stuff is intended to support this kind of thing, but
using a shared domain...
> Even if I set it up so that the Connection removal is undoable I get a
> problem.
> It looks to me that the ChangeDescription has a problem as the data set has
> changed since I ran the delete command. (just a guess)
>
Yes, it expects objects to be in exactly the state that the it left it it...
> The error at the bottom happens in BasicEList add method as a
> BasicIndexOutOfBoundsException gets thrown
>
>
> So anyone have any idea whats going on ?
> Am I right in saying that the data set changing since the change was
> recorded is the issue even if the data that has changed if not important to
> the undo per se ?
> Anyone else have experience of such a shared model.
>
This question was asked yesterday and also last week. It will get good
to read through the recent newsgroup history.
> Any help greatly appreciated as I'm stuck
>
> thanks,
>
> public void add(int index, E object)
>
> {
>
> if (index > size)
>
> throw new BasicIndexOutOfBoundsException(index, size);
>
>
> if (isUnique() && contains(object))
>
> {
>
> throw new IllegalArgumentException("The 'no duplicates' constraint is
> violated");
>
> }
>
>
> addUnique(index, object);
>
> }
>
>
>
>
>
>
>
> org.eclipse.emf.common.util.BasicEList$BasicIndexOutOfBounds Exception:
> index=3, size=0
>
> at org.eclipse.emf.common.util.BasicEList.addAll(BasicEList.jav a:765)
>
> at
> org.eclipse.emf.ecore.change.impl.ListChangeImpl.applyAndRev erse(ListChangeImpl.java:524)
>
> at
> org.eclipse.emf.ecore.change.impl.ChangeDescriptionImpl.preA pply(ChangeDescriptionImpl.java:474)
>
> at
> org.eclipse.emf.ecore.change.impl.ChangeDescriptionImpl.appl yAndReverse(ChangeDescriptionImpl.java:321)
>
> at
> org.eclipse.emf.transaction.util.CompositeChangeDescription. applyAndReverse(CompositeChangeDescription.java:105)
>
> at
> org.eclipse.emf.workspace.AbstractEMFOperation.doUndo(Abstra ctEMFOperation.java:525)
>
> at
> org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTr ansactionalCommand.doUndo(AbstractTransactionalCommand.java: 259)
>
>
>
>
>
>
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: ChangeDesciption issue [message #418710 is a reply to message #418708] Thu, 24 April 2008 17:34 Go to previous messageGo to next message
Alan is currently offline AlanFriend
Messages: 44
Registered: July 2009
Member
Hi Ed,

Thanks for the reply.
My replies below


> I wonder if there is a single editing domain then. It's tricky to
> maintain a consistent undo stack otherwise...

We do use a single editing domain (a DiagramEditingDomainFactory as
mentioned elsewhere as we found it necessary for the crossreferenceadapter)

But what we want to do is to only undo commands relevant to a given editor.
For this we use contexts.
Therefore when I go to undo the delete in the case of my editor I am
actually taking command second from top of stack as the command at the top
is the one which removed objectB in another editor.
Perhaps I am missing something here ?


> Yes, it expects objects to be in exactly the state that the it left it
> it...

This is where I get confused. As we have a shared model that can be changed
from multiple editors how do can we ever be sure it will be in same state
without having a global undo context ?

> This question was asked yesterday and also last week. It will get good to
> read through the recent newsgroup history.

Yes I had a look but I'm still confused as to how to get this to work.
Maybe I am not doing anything different from anyone else but I thought it
best to outline my scenario as it seems to me that I may be.

thanks again

Alan.



"Ed Merks" <merks@ca.ibm.com> wrote in message
news:fuqek2$pkf$1@build.eclipse.org...
> Alan,
>
> Comments below.
>
> Alan wrote:
>> Hello all,
>>
>> I have an interesting problem I was hoping someone could help me with.
>> I am working on a toolsuite with various different domains.
>> The domains are seperate but can share data and for this we use a shared
>> data model.
>>
> I wonder if there is a single editing domain then. It's tricky to
> maintain a consistent undo stack otherwise...
>> In this model we have a collection of objects which can be connected
>> together.
>> So each domain that wishes to share data has that data implement the
>> ISharedObject interface and adds it to the shared model.
>> We have an editor to connect data together and a Connection object is
>> created to linked two ISharedObjects together.
>>
> Sounds a little worrisome...
>> Ok so far.
>>
>> I am having a problem with undoing changes.
>>
> That's what I'd be concerned about.
>> Scenario is as follows:
>>
>> I add objectA which contains two pieces of shared info so two
>> ISharedObjects are added to shared model
>> I add objectB in another domain which adds itself as an ISharedObject.
>> I connect objects A and B together.
>> And save all editors.
>> Now I delete objectA. The command for this removes the data
>> (ISharedObject x 2 for objectA) from shared data model.
>> It also removes the connection between them.
>> If I undo this it works fine as both ISharedObjects are added back as is
>> the Connection.
>>
> This is all making me think you need a shared domain...
>> However if before I undo the delete I also go to the other domain and
>> delete objectB I have a problem,
>> I would not expect the Connection to be recreated as the two ends are not
>> there.
>> But the whole things falls over and fails.
>> (All editors have seperate undo stacks via a WorkspaceOperationHistory
>> divided up using contexts)
>>
> The transaction stuff is intended to support this kind of thing, but using
> a shared domain...
>> Even if I set it up so that the Connection removal is undoable I get a
>> problem.
>> It looks to me that the ChangeDescription has a problem as the data set
>> has changed since I ran the delete command. (just a guess)
>>
> Yes, it expects objects to be in exactly the state that the it left it
> it...
>> The error at the bottom happens in BasicEList add method as a
>> BasicIndexOutOfBoundsException gets thrown
>>
>>
>> So anyone have any idea whats going on ?
>> Am I right in saying that the data set changing since the change was
>> recorded is the issue even if the data that has changed if not important
>> to the undo per se ?
>> Anyone else have experience of such a shared model.
>>
> This question was asked yesterday and also last week. It will get good to
> read through the recent newsgroup history.
>> Any help greatly appreciated as I'm stuck
>>
>> thanks,
>>
>> public void add(int index, E object)
>>
>> {
>>
>> if (index > size)
>>
>> throw new BasicIndexOutOfBoundsException(index, size);
>>
>>
>> if (isUnique() && contains(object))
>>
>> {
>>
>> throw new IllegalArgumentException("The 'no duplicates' constraint is
>> violated");
>>
>> }
>>
>>
>> addUnique(index, object);
>>
>> }
>>
>>
>>
>>
>>
>>
>>
>> org.eclipse.emf.common.util.BasicEList$BasicIndexOutOfBounds Exception:
>> index=3, size=0
>>
>> at org.eclipse.emf.common.util.BasicEList.addAll(BasicEList.jav a:765)
>>
>> at
>> org.eclipse.emf.ecore.change.impl.ListChangeImpl.applyAndRev erse(ListChangeImpl.java:524)
>>
>> at
>> org.eclipse.emf.ecore.change.impl.ChangeDescriptionImpl.preA pply(ChangeDescriptionImpl.java:474)
>>
>> at
>> org.eclipse.emf.ecore.change.impl.ChangeDescriptionImpl.appl yAndReverse(ChangeDescriptionImpl.java:321)
>>
>> at
>> org.eclipse.emf.transaction.util.CompositeChangeDescription. applyAndReverse(CompositeChangeDescription.java:105)
>>
>> at
>> org.eclipse.emf.workspace.AbstractEMFOperation.doUndo(Abstra ctEMFOperation.java:525)
>>
>> at
>> org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTr ansactionalCommand.doUndo(AbstractTransactionalCommand.java: 259)
>>
>>
>>
>>
>>
>>
>>
>>
Re: ChangeDesciption issue [message #418711 is a reply to message #418710] Thu, 24 April 2008 18:19 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------010309060202020102070403
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Alan,

Comments below.


Alan wrote:
> Hi Ed,
>
> Thanks for the reply.
> My replies below
>
>
>
>> I wonder if there is a single editing domain then. It's tricky to
>> maintain a consistent undo stack otherwise...
>>
>
> We do use a single editing domain (a DiagramEditingDomainFactory as
> mentioned elsewhere as we found it necessary for the crossreferenceadapter)
>
> But what we want to do is to only undo commands relevant to a given editor.
> For this we use contexts.
> Therefore when I go to undo the delete in the case of my editor I am
> actually taking command second from top of stack as the command at the top
> is the one which removed objectB in another editor.
> Perhaps I am missing something here ?
>
I thought the transaction stuff supported this, but when it comes to
bidirectional references, it can be pretty tricky ensuring you know
who's actually affected.
>
>> Yes, it expects objects to be in exactly the state that the it left it
>> it...
>>
>
> This is where I get confused. As we have a shared model that can be changed
> from multiple editors how do can we ever be sure it will be in same state
> without having a global undo context ?
>
Well, yes, it's a hard problem.
>
>> This question was asked yesterday and also last week. It will get good to
>> read through the recent newsgroup history.
>>
>
> Yes I had a look but I'm still confused as to how to get this to work.
> Maybe I am not doing anything different from anyone else but I thought it
> best to outline my scenario as it seems to me that I may be.
>
Maybe. Christian will no doubt read your post at some point and will
likely comment. From what I understand, this type of thing is
supported, so maybe something isn't hooked up quite right...
> thanks again
>
> Alan.
>
>
>
> "Ed Merks" <merks@ca.ibm.com> wrote in message
> news:fuqek2$pkf$1@build.eclipse.org...
>
>> Alan,
>>
>> Comments below.
>>
>> Alan wrote:
>>
>>> Hello all,
>>>
>>> I have an interesting problem I was hoping someone could help me with.
>>> I am working on a toolsuite with various different domains.
>>> The domains are seperate but can share data and for this we use a shared
>>> data model.
>>>
>>>
>> I wonder if there is a single editing domain then. It's tricky to
>> maintain a consistent undo stack otherwise...
>>
>>> In this model we have a collection of objects which can be connected
>>> together.
>>> So each domain that wishes to share data has that data implement the
>>> ISharedObject interface and adds it to the shared model.
>>> We have an editor to connect data together and a Connection object is
>>> created to linked two ISharedObjects together.
>>>
>>>
>> Sounds a little worrisome...
>>
>>> Ok so far.
>>>
>>> I am having a problem with undoing changes.
>>>
>>>
>> That's what I'd be concerned about.
>>
>>> Scenario is as follows:
>>>
>>> I add objectA which contains two pieces of shared info so two
>>> ISharedObjects are added to shared model
>>> I add objectB in another domain which adds itself as an ISharedObject.
>>> I connect objects A and B together.
>>> And save all editors.
>>> Now I delete objectA. The command for this removes the data
>>> (ISharedObject x 2 for objectA) from shared data model.
>>> It also removes the connection between them.
>>> If I undo this it works fine as both ISharedObjects are added back as is
>>> the Connection.
>>>
>>>
>> This is all making me think you need a shared domain...
>>
>>> However if before I undo the delete I also go to the other domain and
>>> delete objectB I have a problem,
>>> I would not expect the Connection to be recreated as the two ends are not
>>> there.
>>> But the whole things falls over and fails.
>>> (All editors have seperate undo stacks via a WorkspaceOperationHistory
>>> divided up using contexts)
>>>
>>>
>> The transaction stuff is intended to support this kind of thing, but using
>> a shared domain...
>>
>>> Even if I set it up so that the Connection removal is undoable I get a
>>> problem.
>>> It looks to me that the ChangeDescription has a problem as the data set
>>> has changed since I ran the delete command. (just a guess)
>>>
>>>
>> Yes, it expects objects to be in exactly the state that the it left it
>> it...
>>
>>> The error at the bottom happens in BasicEList add method as a
>>> BasicIndexOutOfBoundsException gets thrown
>>>
>>>
>>> So anyone have any idea whats going on ?
>>> Am I right in saying that the data set changing since the change was
>>> recorded is the issue even if the data that has changed if not important
>>> to the undo per se ?
>>> Anyone else have experience of such a shared model.
>>>
>>>
>> This question was asked yesterday and also last week. It will get good to
>> read through the recent newsgroup history.
>>
>>> Any help greatly appreciated as I'm stuck
>>>
>>> thanks,
>>>
>>> public void add(int index, E object)
>>>
>>> {
>>>
>>> if (index > size)
>>>
>>> throw new BasicIndexOutOfBoundsException(index, size);
>>>
>>>
>>> if (isUnique() && contains(object))
>>>
>>> {
>>>
>>> throw new IllegalArgumentException("The 'no duplicates' constraint is
>>> violated");
>>>
>>> }
>>>
>>>
>>> addUnique(index, object);
>>>
>>> }
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> org.eclipse.emf.common.util.BasicEList$BasicIndexOutOfBounds Exception:
>>> index=3, size=0
>>>
>>> at org.eclipse.emf.common.util.BasicEList.addAll(BasicEList.jav a:765)
>>>
>>> at
>>> org.eclipse.emf.ecore.change.impl.ListChangeImpl.applyAndRev erse(ListChangeImpl.java:524)
>>>
>>> at
>>> org.eclipse.emf.ecore.change.impl.ChangeDescriptionImpl.preA pply(ChangeDescriptionImpl.java:474)
>>>
>>> at
>>> org.eclipse.emf.ecore.change.impl.ChangeDescriptionImpl.appl yAndReverse(ChangeDescriptionImpl.java:321)
>>>
>>> at
>>> org.eclipse.emf.transaction.util.CompositeChangeDescription. applyAndReverse(CompositeChangeDescription.java:105)
>>>
>>> at
>>> org.eclipse.emf.workspace.AbstractEMFOperation.doUndo(Abstra ctEMFOperation.java:525)
>>>
>>> at
>>> org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTr ansactionalCommand.doUndo(AbstractTransactionalCommand.java: 259)
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>
>
>


--------------010309060202020102070403
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<div class="moz-text-html" lang="x-western"> Alan,<br>
<br>
Comments below.<br>
<br>
<br>
Alan wrote:
<blockquote cite="mid:fuqgau$mi6$1@build.eclipse.org" type="cite">
<pre wrap="">Hi Ed,

Thanks for the reply.
My replies below


</pre>
<blockquote type="cite">
<pre wrap="">I wonder if there is a single editing domain then. It's tricky to
maintain a consistent undo stack otherwise...
</pre>
</blockquote>
<pre wrap=""><!---->
We do use a single editing domain (a DiagramEditingDomainFactory as
mentioned elsewhere as we found it necessary for the crossreferenceadapter)

But what we want to do is to only undo commands relevant to a given editor.
For this we use contexts.
Therefore when I go to undo the delete in the case of my editor I am
actually taking command second from top of stack as the command at the top
is the one which removed objectB in another editor.
Perhaps I am missing something here ?
</pre>
</blockquote>
I thought the transaction stuff supported this, but when it comes to
bidirectional references, it can be pretty tricky ensuring you know
who's actually affected.<br>
<blockquote cite="mid:fuqgau$mi6$1@build.eclipse.org" type="cite">
<pre wrap=""> </pre>
<blockquote type="cite">
<pre wrap="">Yes, it expects objects to be in exactly the state that the it left it
it...
</pre>
</blockquote>
<pre wrap=""><!---->
This is where I get confused. As we have a shared model that can be changed
from multiple editors how do can we ever be sure it will be in same state
without having a global undo context ?
</pre>
</blockquote>
Well, yes, it's a hard problem.&nbsp; <br>
<blockquote cite="mid:fuqgau$mi6$1@build.eclipse.org" type="cite">
<pre wrap=""> </pre>
<blockquote type="cite">
<pre wrap="">This question was asked yesterday and also last week. It will get good to
read through the recent newsgroup history.
</pre>
</blockquote>
<pre wrap=""><!---->
Yes I had a look but I'm still confused as to how to get this to work.
Maybe I am not doing anything different from anyone else but I thought it
best to outline my scenario as it seems to me that I may be.
</pre>
</blockquote>
Maybe.&nbsp; Christian will no doubt read your post at some point and will
likely comment.&nbsp; From what I understand, this type of thing is
supported, so maybe something isn't hooked up quite right...<br>
<blockquote cite="mid:fuqgau$mi6$1@build.eclipse.org" type="cite">
<pre wrap="">thanks again

Alan.



"Ed Merks" <a class="moz-txt-link-rfc2396E"
href="mailto:merks@ca.ibm.com">&lt;merks@ca.ibm.com&gt;</a> wrote in message
<a class="moz-txt-link-freetext"
href="news:fuqek2$pkf$1@build.eclipse.org">news:fuqek2$pkf$1@build.eclipse.org</a>...
</pre>
<blockquote type="cite">
<pre wrap="">Alan,

Comments below.

Alan wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Hello all,

I have an interesting problem I was hoping someone could help me with.
I am working on a toolsuite with various different domains.
The domains are seperate but can share data and for this we use a shared
data model.

</pre>
</blockquote>
<pre wrap="">I wonder if there is a single editing domain then. It's tricky to
maintain a consistent undo stack otherwise...
</pre>
<blockquote type="cite">
<pre wrap="">In this model we have a collection of objects which can be connected
together.
So each domain that wishes to share data has that data implement the
ISharedObject interface and adds it to the shared model.
We have an editor to connect data together and a Connection object is
created to linked two ISharedObjects together.

</pre>
</blockquote>
<pre wrap="">Sounds a little worrisome...
</pre>
<blockquote type="cite">
<pre wrap="">Ok so far.

I am having a problem with undoing changes.

</pre>
</blockquote>
<pre wrap="">That's what I'd be concerned about.
</pre>
<blockquote type="cite">
<pre wrap="">Scenario is as follows:

I add objectA which contains two pieces of shared info so two
ISharedObjects are added to shared model
I add objectB in another domain which adds itself as an ISharedObject.
I connect objects A and B together.
And save all editors.
Now I delete objectA. The command for this removes the data
(ISharedObject x 2 for objectA) from shared data model.
It also removes the connection between them.
If I undo this it works fine as both ISharedObjects are added back as is
the Connection.

</pre>
</blockquote>
<pre wrap="">This is all making me think you need a shared domain...
</pre>
<blockquote type="cite">
<pre wrap="">However if before I undo the delete I also go to the other domain and
delete objectB I have a problem,
I would not expect the Connection to be recreated as the two ends are not
there.
But the whole things falls over and fails.
(All editors have seperate undo stacks via a WorkspaceOperationHistory
divided up using contexts)

</pre>
</blockquote>
<pre wrap="">The transaction stuff is intended to support this kind of thing, but using
a shared domain...
</pre>
<blockquote type="cite">
<pre wrap="">Even if I set it up so that the Connection removal is undoable I get a
problem.
It looks to me that the ChangeDescription has a problem as the data set
has changed since I ran the delete command. (just a guess)

</pre>
</blockquote>
<pre wrap="">Yes, it expects objects to be in exactly the state that the it left it
it...
</pre>
<blockquote type="cite">
<pre wrap="">The error at the bottom happens in BasicEList add method as a
BasicIndexOutOfBoundsException gets thrown


So anyone have any idea whats going on ?
Am I right in saying that the data set changing since the change was
recorded is the issue even if the data that has changed if not important
to the undo per se ?
Anyone else have experience of such a shared model.

</pre>
</blockquote>
<pre wrap="">This question was asked yesterday and also last week. It will get good to
read through the recent newsgroup history.
</pre>
<blockquote type="cite">
<pre wrap="">Any help greatly appreciated as I'm stuck

thanks,

public void add(int index, E object)

{

if (index &gt; size)

throw new BasicIndexOutOfBoundsException(index, size);


if (isUnique() &amp;&amp; contains(object))

{

throw new IllegalArgumentException("The 'no duplicates' constraint is
violated");

}


addUnique(index, object);

}







org.eclipse.emf.common.util.BasicEList$BasicIndexOutOfBounds Exception:
index=3, size=0

at org.eclipse.emf.common.util.BasicEList.addAll(BasicEList.jav a:765)

at
org.eclipse.emf.ecore.change.impl.ListChangeImpl.applyAndRev erse(ListChangeImpl.java:524)

at
org.eclipse.emf.ecore.change.impl.ChangeDescriptionImpl.preA pply(ChangeDescriptionImpl.java:474)

at
org.eclipse.emf.ecore.change.impl.ChangeDescriptionImpl.appl yAndReverse(ChangeDescriptionImpl.java:321)

at
org.eclipse.emf.transaction.util.CompositeChangeDescription. applyAndReverse(CompositeChangeDescription.java:105)

at
org.eclipse.emf.workspace.AbstractEMFOperation.doUndo(Abstra ctEMFOperation.java:525)

at
org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTr ansactionalCommand.doUndo(AbstractTransactionalCommand.java: 259)








</pre>
</blockquote>
</blockquote>
<pre wrap=""><!---->

</pre>
</blockquote>
<br>
</div>
</body>
</html>

--------------010309060202020102070403--


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: ChangeDesciption issue [message #418714 is a reply to message #418711] Thu, 24 April 2008 18:34 Go to previous messageGo to next message
Alan is currently offline AlanFriend
Messages: 44
Registered: July 2009
Member
This is a multi-part message in MIME format.

------=_NextPart_000_000C_01C8A642.2CF20510
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi Ed,

Yes it is quite possible I have hooked it up wrong and hopefully =
Christian can help.

One quick question....is there anything I can do with regards to the =
ChangeDescription itself ?
Could I possibly get into the undo of my commands and edit the change =
list so that it just tracks the changes related to the=20
editor I am working in or is this an area to stay well away from ?

thanks.
"Ed Merks" <merks@ca.ibm.com> wrote in message =
news:fuqj0p$38h$1@build.eclipse.org...
Alan,

Comments below.


Alan wrote:=20
Hi Ed,

Thanks for the reply.
My replies below


I wonder if there is a single editing domain then. It's tricky to=20
maintain a consistent undo stack otherwise...
=20
We do use a single editing domain (a DiagramEditingDomainFactory as=20
mentioned elsewhere as we found it necessary for the =
crossreferenceadapter)

But what we want to do is to only undo commands relevant to a given =
editor.
For this we use contexts.
Therefore when I go to undo the delete in the case of my editor I am=20
actually taking command second from top of stack as the command at the =
top
is the one which removed objectB in another editor.
Perhaps I am missing something here ?
I thought the transaction stuff supported this, but when it comes to =
bidirectional references, it can be pretty tricky ensuring you know =
who's actually affected.

Yes, it expects objects to be in exactly the state that the it left it =

it...
=20
This is where I get confused. As we have a shared model that can be =
changed=20
from multiple editors how do can we ever be sure it will be in same =
state
without having a global undo context ?
Well, yes, it's a hard problem. =20

This question was asked yesterday and also last week. It will get =
good to=20
read through the recent newsgroup history.
=20
Yes I had a look but I'm still confused as to how to get this to work.
Maybe I am not doing anything different from anyone else but I thought =
it=20
best to outline my scenario as it seems to me that I may be.
Maybe. Christian will no doubt read your post at some point and will =
likely comment. From what I understand, this type of thing is =
supported, so maybe something isn't hooked up quite right...

thanks again

Alan.



"Ed Merks" <merks@ca.ibm.com> wrote in message=20
news:fuqek2$pkf$1@build.eclipse.org...
Alan,

Comments below.

Alan wrote:
Hello all,

I have an interesting problem I was hoping someone could help me with.
I am working on a toolsuite with various different domains.
The domains are seperate but can share data and for this we use a shared =

data model.

I wonder if there is a single editing domain then. It's tricky to =

maintain a consistent undo stack otherwise...
In this model we have a collection of objects which can be connected =

together.
So each domain that wishes to share data has that data implement the=20
ISharedObject interface and adds it to the shared model.
We have an editor to connect data together and a Connection object is=20
created to linked two ISharedObjects together.

Sounds a little worrisome...
Ok so far.

I am having a problem with undoing changes.

That's what I'd be concerned about.
Scenario is as follows:

I add objectA which contains two pieces of shared info so two=20
ISharedObjects are added to shared model
I add objectB in another domain which adds itself as an ISharedObject.
I connect objects A and B together.
And save all editors.
Now I delete objectA. The command for this removes the data=20
(ISharedObject x 2 for objectA) from shared data model.
It also removes the connection between them.
If I undo this it works fine as both ISharedObjects are added back as is =

the Connection.

This is all making me think you need a shared domain...
However if before I undo the delete I also go to the other domain =
and=20
delete objectB I have a problem,
I would not expect the Connection to be recreated as the two ends are =
not=20
there.
But the whole things falls over and fails.
(All editors have seperate undo stacks via a WorkspaceOperationHistory=20
divided up using contexts)

The transaction stuff is intended to support this kind of thing, =
but using=20
a shared domain...
Even if I set it up so that the Connection removal is undoable I get =
a=20
problem.
It looks to me that the ChangeDescription has a problem as the data set=20
has changed since I ran the delete command. (just a guess)

Yes, it expects objects to be in exactly the state that the it =
left it=20
it...
The error at the bottom happens in BasicEList add method as a=20
BasicIndexOutOfBoundsException gets thrown


So anyone have any idea whats going on ?
Am I right in saying that the data set changing since the change was=20
recorded is the issue even if the data that has changed if not important =

to the undo per se ?
Anyone else have experience of such a shared model.

This question was asked yesterday and also last week. It will get =
good to=20
read through the recent newsgroup history.
Any help greatly appreciated as I'm stuck

thanks,

public void add(int index, E object)

{

if (index > size)

throw new BasicIndexOutOfBoundsException(index, size);


if (isUnique() && contains(object))

{

throw new IllegalArgumentException("The 'no duplicates' constraint is=20
violated");

}


addUnique(index, object);

}







org.eclipse.emf.common.util.BasicEList$BasicIndexOutOfBounds Exception:=20
index=3D3, size=3D0

at org.eclipse.emf.common.util.BasicEList.addAll(BasicEList.jav a:765)

at=20
org.eclipse.emf.ecore.change.impl.ListChangeImpl.applyAndRev erse(ListChan=
geImpl.java:524)

at=20
org.eclipse.emf.ecore.change.impl.ChangeDescriptionImpl.preA pply(ChangeDe=
scriptionImpl.java:474)

at=20
org.eclipse.emf.ecore.change.impl.ChangeDescriptionImpl.appl yAndReverse(C=
hangeDescriptionImpl.java:321)

at=20
org.eclipse.emf.transaction.util.CompositeChangeDescription. applyAndRever=
se(CompositeChangeDescription.java:105)

at=20
org.eclipse.emf.workspace.AbstractEMFOperation.doUndo(Abstra ctEMFOperatio=
n.java:525)

at=20
org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTr ansactionalCo=
mmand.doUndo(AbstractTransactionalCommand.java:259)








=20

=20

------=_NextPart_000_000C_01C8A642.2CF20510
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type =
content=3Dtext/html;charset=3DISO-8859-1>
<META content=3D"MSHTML 6.00.6000.16640" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY text=3D#000000 bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hi Ed,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Yes it is quite possible I have hooked =
it up wrong=20
and hopefully Christian can help.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>One quick question....is there anything =
I can do=20
with regards to the ChangeDescription itself ?<BR>Could I possibly get =
into the=20
undo of my commands and edit the change list so that it just tracks the =
changes=20
related to the </FONT></DIV>
<DIV><FONT face=3DArial size=3D2>editor I am working in or is this an =
area to stay=20
well away from ?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>thanks.</FONT></DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Ed Merks" &lt;<A =
href=3D"mailto:merks@ca.ibm.com">merks@ca.ibm.com</A>&gt;=20
wrote in message <A=20
=
href=3D"news:fuqj0p$38h$1@build.eclipse.org">news:fuqj0p$38h$1@build.ecli=
pse.org</A>...</DIV>
<DIV class=3Dmoz-text-html lang=3Dx-western>Alan,<BR><BR>Comments=20
below.<BR><BR><BR>Alan wrote:=20
<BLOCKQUOTE cite=3Dmid:fuqgau$mi6$1@build.eclipse.org =
type=3D"cite"><PRE wrap=3D"">Hi Ed,

Thanks for the reply.
My replies below


</PRE>
<BLOCKQUOTE type=3D"cite"><PRE wrap=3D"">I wonder if there is a =
single editing domain then. It's tricky to=20
maintain a consistent undo stack otherwise...
</PRE></BLOCKQUOTE><PRE wrap=3D""><!---->
We do use a single editing domain (a DiagramEditingDomainFactory as=20
mentioned elsewhere as we found it necessary for the =
crossreferenceadapter)

But what we want to do is to only undo commands relevant to a given =
editor.
For this we use contexts.
Therefore when I go to undo the delete in the case of my editor I am=20
actually taking command second from top of stack as the command at the =
top
is the one which removed objectB in another editor.
Perhaps I am missing something here ?
</PRE></BLOCKQUOTE>I thought the transaction stuff supported this, but =
when=20
it comes to bidirectional references, it can be pretty tricky ensuring =
you=20
know who's actually affected.<BR>
<BLOCKQUOTE cite=3Dmid:fuqgau$mi6$1@build.eclipse.org =
type=3D"cite"><PRE wrap=3D""> </PRE>
<BLOCKQUOTE type=3D"cite"><PRE wrap=3D"">Yes, it expects objects to =
be in exactly the state that the it left it=20
it...
</PRE></BLOCKQUOTE><PRE wrap=3D""><!---->
This is where I get confused. As we have a shared model that can be =
changed=20
from multiple editors how do can we ever be sure it will be in same =
state
without having a global undo context ?
</PRE></BLOCKQUOTE>Well, yes, it's a hard problem.&nbsp; <BR>
<BLOCKQUOTE cite=3Dmid:fuqgau$mi6$1@build.eclipse.org =
type=3D"cite"><PRE wrap=3D""> </PRE>
<BLOCKQUOTE type=3D"cite"><PRE wrap=3D"">This question was asked =
yesterday and also last week. It will get good to=20
read through the recent newsgroup history.
</PRE></BLOCKQUOTE><PRE wrap=3D""><!---->
Yes I had a look but I'm still confused as to how to get this to work.
Maybe I am not doing anything different from anyone else but I thought =
it=20
best to outline my scenario as it seems to me that I may be.
</PRE></BLOCKQUOTE>Maybe.&nbsp; Christian will no doubt read your post =
at=20
some point and will likely comment.&nbsp; From what I understand, this =
type of=20
thing is supported, so maybe something isn't hooked up quite =
right...<BR>
<BLOCKQUOTE cite=3Dmid:fuqgau$mi6$1@build.eclipse.org =
type=3D"cite"><PRE wrap=3D"">thanks again

Alan.



"Ed Merks" <A class=3Dmoz-txt-link-rfc2396E =
href=3D"mailto:merks@ca.ibm.com">&lt;merks@ca.ibm.com&gt;</A> wrote in =
message=20
<A class=3Dmoz-txt-link-freetext =
href=3D"news:fuqek2$pkf$1@build.eclipse.org">news:fuqek2$pkf$1@build.ecli=
pse.org</A>...
</PRE>
<BLOCKQUOTE type=3D"cite"><PRE wrap=3D"">Alan,

Comments below.

Alan wrote:
</PRE>
<BLOCKQUOTE type=3D"cite"><PRE wrap=3D"">Hello all,

I have an interesting problem I was hoping someone could help me with.
I am working on a toolsuite with various different domains.
The domains are seperate but can share data and for this we use a shared =

data model.

</PRE></BLOCKQUOTE><PRE wrap=3D"">I wonder if there is a single =
editing domain then. It's tricky to=20
maintain a consistent undo stack otherwise...
</PRE>
<BLOCKQUOTE type=3D"cite"><PRE wrap=3D"">In this model we have a =
collection of objects which can be connected=20
together.
So each domain that wishes to share data has that data implement the=20
ISharedObject interface and adds it to the shared model.
We have an editor to connect data together and a Connection object is=20
created to linked two ISharedObjects together.

</PRE></BLOCKQUOTE><PRE wrap=3D"">Sounds a little worrisome...
</PRE>
<BLOCKQUOTE type=3D"cite"><PRE wrap=3D"">Ok so far.

I am having a problem with undoing changes.

</PRE></BLOCKQUOTE><PRE wrap=3D"">That's what I'd be concerned =
about.
</PRE>
<BLOCKQUOTE type=3D"cite"><PRE wrap=3D"">Scenario is as follows:

I add objectA which contains two pieces of shared info so two=20
ISharedObjects are added to shared model
I add objectB in another domain which adds itself as an ISharedObject.
I connect objects A and B together.
And save all editors.
Now I delete objectA. The command for this removes the data=20
(ISharedObject x 2 for objectA) from shared data model.
It also removes the connection between them.
If I undo this it works fine as both ISharedObjects are added back as is =

the Connection.

</PRE></BLOCKQUOTE><PRE wrap=3D"">This is all making me think you =
need a shared domain...
</PRE>
<BLOCKQUOTE type=3D"cite"><PRE wrap=3D"">However if before I undo =
the delete I also go to the other domain and=20
delete objectB I have a problem,
I would not expect the Connection to be recreated as the two ends are =
not=20
there.
But the whole things falls over and fails.
(All editors have seperate undo stacks via a WorkspaceOperationHistory=20
divided up using contexts)

</PRE></BLOCKQUOTE><PRE wrap=3D"">The transaction stuff is =
intended to support this kind of thing, but using=20
a shared domain...
</PRE>
<BLOCKQUOTE type=3D"cite"><PRE wrap=3D"">Even if I set it up so =
that the Connection removal is undoable I get a=20
problem.
It looks to me that the ChangeDescription has a problem as the data set=20
has changed since I ran the delete command. (just a guess)

</PRE></BLOCKQUOTE><PRE wrap=3D"">Yes, it expects objects to be in =
exactly the state that the it left it=20
it...
</PRE>
<BLOCKQUOTE type=3D"cite"><PRE wrap=3D"">The error at the bottom =
happens in BasicEList add method as a=20
BasicIndexOutOfBoundsException gets thrown


So anyone have any idea whats going on ?
Am I right in saying that the data set changing since the change was=20
recorded is the issue even if the data that has changed if not important =

to the undo per se ?
Anyone else have experience of such a shared model.

</PRE></BLOCKQUOTE><PRE wrap=3D"">This question was asked =
yesterday and also last week. It will get good to=20
read through the recent newsgroup history.
</PRE>
<BLOCKQUOTE type=3D"cite"><PRE wrap=3D"">Any help greatly =
appreciated as I'm stuck

thanks,

public void add(int index, E object)

{

if (index &gt; size)

throw new BasicIndexOutOfBoundsException(index, size);


if (isUnique() &amp;&amp; contains(object))

{

throw new IllegalArgumentException("The 'no duplicates' constraint is=20
violated");

}


addUnique(index, object);

}







org.eclipse.emf.common.util.BasicEList$BasicIndexOutOfBounds Exception:=20
index=3D3, size=3D0

at org.eclipse.emf.common.util.BasicEList.addAll(BasicEList.jav a:765)

at=20
org.eclipse.emf.ecore.change.impl.ListChangeImpl.applyAndRev erse(ListChan=
geImpl.java:524)

at=20
org.eclipse.emf.ecore.change.impl.ChangeDescriptionImpl.preA pply(ChangeDe=
scriptionImpl.java:474)

at=20
org.eclipse.emf.ecore.change.impl.ChangeDescriptionImpl.appl yAndReverse(C=
hangeDescriptionImpl.java:321)

at=20
org.eclipse.emf.transaction.util.CompositeChangeDescription. applyAndRever=
se(CompositeChangeDescription.java:105)

at=20
org.eclipse.emf.workspace.AbstractEMFOperation.doUndo(Abstra ctEMFOperatio=
n.java:525)

at=20
org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTr ansactionalCo=
mmand.doUndo(AbstractTransactionalCommand.java:259)








</PRE></BLOCKQUOTE></BLOCKQUOTE><PRE wrap=3D""><!---->

</PRE></BLOCKQUOTE><BR></DIV></BLOCKQUOTE></BODY></HTML >

------=_NextPart_000_000C_01C8A642.2CF20510--
Re: ChangeDesciption issue [message #418715 is a reply to message #418711] Thu, 24 April 2008 18:39 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Ed, Alan,

Yes, the operation-history integration provided by the EMF Transaction
component is intended to support independent undo stacks for independent
changes to resource-set content. However, the key here is the independence
of these changes. ChangeDescriptions rely on being applied to exactly the
state of the objects that they recorded originally; any deviation from this
generally results in failure.

The operation-history-integrated editing domain implementation automatically
tags IUndoableOperations with ResourceContexts indicating the resources
affected by the operations. The ResourceUndoContext is the recommended
basis for undo histories. Not only does the computation of affected
resources include both the referencing and the reference resource when a
bidirectional cross-reference is changed, but also a unidirectional
cross-reference. This is pessimistic, but safe.

Rather than using an undo context for the editor in which a change was
performed, try basing the Undo action on the ResourceContext for the
resource that the editor is editing.

HTH,

Christian
Re: ChangeDesciption issue [message #418732 is a reply to message #418715] Fri, 25 April 2008 13:55 Go to previous messageGo to next message
Alan is currently offline AlanFriend
Messages: 44
Registered: July 2009
Member
Hi Christian,

I am not quite sure what you mean by "try basing the Undo action on the
ResourceContext"
I can get a handle on the ResourceContext for the IUndoableOperation that I
want to undo but
I don't what good this does me ?
I mean with it I can get a handle on the resource changed but can I roll
back just the changes to that resource?

Perhaps I am missing something ?


I will outline the scenario below in terms of resources....does EMF
definitely support what I am tring to do ?

thanks a lot,

Alan.



Resource 1 is attached to a GMFeditor1
Resource 2 is attached to a GMFeditor2
Resource 3 is the shared data resource and is updated by both of the editors
above.
Resource 3 has an editor (connection editor which is a table) which is used
to connect shared data.

I have objectA in GMFeditor1, so in resource1. it is also in resource 3 as
it is shared
I have objectB in GMFeditor2, so in resource2. it is also in resource 3 as
it is shared
I then created a connection between objects A and B in the connection editor
affecting resource3.
Save all

Delete objectA in GMFeditor1 (resource1). Also affected is resource 3 as
shared object removed
If I undo in GMFeditor1 at this point there is no issue

if I first go to GMFeditor2 and delete objectB and then go to GMFeditor1 and
undo I get the problem.
What I am trying to do is rollback the second last command on the stack
which is objectA delete.






"Christian W. Damus" <cdamus@ca.ibm.com> wrote in message
news:fuqk4b$i4m$1@build.eclipse.org...
> Hi, Ed, Alan,
>
> Yes, the operation-history integration provided by the EMF Transaction
> component is intended to support independent undo stacks for independent
> changes to resource-set content. However, the key here is the
> independence
> of these changes. ChangeDescriptions rely on being applied to exactly the
> state of the objects that they recorded originally; any deviation from
> this
> generally results in failure.
>
> The operation-history-integrated editing domain implementation
> automatically
> tags IUndoableOperations with ResourceContexts indicating the resources
> affected by the operations. The ResourceUndoContext is the recommended
> basis for undo histories. Not only does the computation of affected
> resources include both the referencing and the reference resource when a
> bidirectional cross-reference is changed, but also a unidirectional
> cross-reference. This is pessimistic, but safe.
>
> Rather than using an undo context for the editor in which a change was
> performed, try basing the Undo action on the ResourceContext for the
> resource that the editor is editing.
>
> HTH,
>
> Christian
Re: ChangeDesciption issue [message #418733 is a reply to message #418715] Fri, 25 April 2008 14:02 Go to previous messageGo to next message
Alan is currently offline AlanFriend
Messages: 44
Registered: July 2009
Member
Is it possible to edit changedescription objects ? (just a thought)



"Christian W. Damus" <cdamus@ca.ibm.com> wrote in message
news:fuqk4b$i4m$1@build.eclipse.org...
> Hi, Ed, Alan,
>
> Yes, the operation-history integration provided by the EMF Transaction
> component is intended to support independent undo stacks for independent
> changes to resource-set content. However, the key here is the
> independence
> of these changes. ChangeDescriptions rely on being applied to exactly the
> state of the objects that they recorded originally; any deviation from
> this
> generally results in failure.
>
> The operation-history-integrated editing domain implementation
> automatically
> tags IUndoableOperations with ResourceContexts indicating the resources
> affected by the operations. The ResourceUndoContext is the recommended
> basis for undo histories. Not only does the computation of affected
> resources include both the referencing and the reference resource when a
> bidirectional cross-reference is changed, but also a unidirectional
> cross-reference. This is pessimistic, but safe.
>
> Rather than using an undo context for the editor in which a change was
> performed, try basing the Undo action on the ResourceContext for the
> resource that the editor is editing.
>
> HTH,
>
> Christian
Re: ChangeDesciption issue [message #418734 is a reply to message #418733] Fri, 25 April 2008 14:08 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------060205020907000608050801
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Alan,

It's just another model, so yes; but the odds of doing it correctly are
pretty low.


Alan wrote:
> Is it possible to edit changedescription objects ? (just a thought)
>
>
>
> "Christian W. Damus" <cdamus@ca.ibm.com> wrote in message
> news:fuqk4b$i4m$1@build.eclipse.org...
>
>> Hi, Ed, Alan,
>>
>> Yes, the operation-history integration provided by the EMF Transaction
>> component is intended to support independent undo stacks for independent
>> changes to resource-set content. However, the key here is the
>> independence
>> of these changes. ChangeDescriptions rely on being applied to exactly the
>> state of the objects that they recorded originally; any deviation from
>> this
>> generally results in failure.
>>
>> The operation-history-integrated editing domain implementation
>> automatically
>> tags IUndoableOperations with ResourceContexts indicating the resources
>> affected by the operations. The ResourceUndoContext is the recommended
>> basis for undo histories. Not only does the computation of affected
>> resources include both the referencing and the reference resource when a
>> bidirectional cross-reference is changed, but also a unidirectional
>> cross-reference. This is pessimistic, but safe.
>>
>> Rather than using an undo context for the editor in which a change was
>> performed, try basing the Undo action on the ResourceContext for the
>> resource that the editor is editing.
>>
>> HTH,
>>
>> Christian
>>
>
>
>


--------------060205020907000608050801
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Alan,<br>
<br>
It's just another model, so yes; but the odds of doing it correctly are
pretty low.<br>
<br>
<br>
Alan wrote:
<blockquote cite="mid:fusoa0$c1b$1@build.eclipse.org" type="cite">
<pre wrap="">Is it possible to edit changedescription objects ? (just a thought)



"Christian W. Damus" <a class="moz-txt-link-rfc2396E" href="mailto:cdamus@ca.ibm.com">&lt;cdamus@ca.ibm.com&gt;</a> wrote in message
<a class="moz-txt-link-freetext" href="news:fuqk4b$i4m$1@build.eclipse.org">news:fuqk4b$i4m$1@build.eclipse.org</a>...
</pre>
<blockquote type="cite">
<pre wrap="">Hi, Ed, Alan,

Yes, the operation-history integration provided by the EMF Transaction
component is intended to support independent undo stacks for independent
changes to resource-set content. However, the key here is the
independence
of these changes. ChangeDescriptions rely on being applied to exactly the
state of the objects that they recorded originally; any deviation from
this
generally results in failure.

The operation-history-integrated editing domain implementation
automatically
tags IUndoableOperations with ResourceContexts indicating the resources
affected by the operations. The ResourceUndoContext is the recommended
basis for undo histories. Not only does the computation of affected
resources include both the referencing and the reference resource when a
bidirectional cross-reference is changed, but also a unidirectional
cross-reference. This is pessimistic, but safe.

Rather than using an undo context for the editor in which a change was
performed, try basing the Undo action on the ResourceContext for the
resource that the editor is editing.

HTH,

Christian
</pre>
</blockquote>
<pre wrap=""><!---->

</pre>
</blockquote>
<br>
</body>
</html>

--------------060205020907000608050801--


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: ChangeDesciption issue [message #418747 is a reply to message #418734] Sat, 26 April 2008 15:59 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: give.a.damus.gmail.com

Hi, Ed, Alan,

Note that TransactionChangeDescriptions actually use the
ChangeDescription as an API, not as a model. In general, transactions
have composite change descriptions that are not serializable as an EMF
model, and also encapulatenon-EMF changes as Commands and even
IUndoableOperations.

So, you cannot expect to edit a transaction's change description in
the usual way. The most that you can expect is a summary of the
recorded changes in EObject content but, because of some of the
mechanisms Imentioned above, even this may have gaps.

Cheers,

Christian

On Friday 04-25-2008 (10:08), Ed Merks wrote:
> This is a multi-part message in MIME format.
> --------------060205020907000608050801
> Content-Type: text/plain; charset=ISO-8859-1;
> format=flowedContent-Transfer-Encoding: 7bit

> Alan,

> It's just another model, so yes; but the odds of doing it correctly
> are pretty low.

> Alan wrote:
>> Is it possible to edit changedescription objects ? (just a thought)

-----8<-----


--

I'm trying a new usenet client for Mac, Nemo OS X.
You can download it at http://www.malcom-mac.com/nemo
Re: ChangeDesciption issue [message #418748 is a reply to message #418732] Sat, 26 April 2008 16:05 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: give.a.damus.gmail.com

Hi, Alan,

What I mean is, that your editor's Undo and Redo actions should
probably use the ResourceUndoContext corresponding to the editor's
resource to select their "undo stack" according to the operation API's
undo and redoaction implementations.

The result is, that each editor sees in its Undo/Redo menus the
operations pertaining to its own resource. If it includes an
operation that affected other resources, as well (such as your shared
resource3), then an operation will only be available for undo if it is
also the top of resource3's undo context stack. The resource undo
contexts should ensure (via Eclipse's operation history) that undo is
consistent with respect todependencies between your resources, or else
disabled.

I don't understand what you mean when you say that objectA that is in
resource1 is also in resource3. An object can only reside in one
resource. Perhaps, if you are trying to bend the EMF rules, here, then
that iscontributing to your problem?

HTH,

Christian


On Friday 04-25-2008 (09:55), Alan wrote:
> Hi Christian,

> I am not quite sure what you mean by "try basing the Undo action on
> the ResourceContext"
> I can get a handle on the ResourceContext for the IUndoableOperation
> that I want to undo but
> I don't what good this does me ?
> I mean with it I can get a handle on the resource changed but can I
> roll back just the changes to that resource?

> Perhaps I am missing something ?

> I will outline the scenario below in terms of resources....does EMF
> definitely support what I am tring to do ?

> thanks a lot,

> Alan.


> Resource 1 is attached to a GMFeditor1
> Resource 2 is attached to a GMFeditor2
> Resource 3 is the shared data resource and is updated by both of the
> editors above.
> Resource 3 has an editor (connection editor which is a table) which
> is used to connect shared data.

> I have objectA in GMFeditor1, so in resource1. it is also in
> resource 3 as it is shared
> I have objectB in GMFeditor2, so in resource2. it is also in
> resource 3 as it is shared
> I then created a connection between objects A and B in the
> connection editor affecting resource3.
> Save all

> Delete objectA in GMFeditor1 (resource1). Also affected is resource
> 3 as shared object removed
> If I undo in GMFeditor1 at this point there is no issue

> if I first go to GMFeditor2 and delete objectB and then go to
> GMFeditor1 and undo I get the problem.
> What I am trying to do is rollback the second last command on the
> stack which is objectA delete.





> "Christian W. Damus" <cdamus@ca.ibm.com> wrote in message
> news:fuqk4b$i4m$1@build.eclipse.org...
>> Hi, Ed, Alan,

>> Yes, the operation-history integration provided by the EMF
>> Transaction component is intended to support independent undo stacks
>> for independent changes to resource-set content. However, the key
>> here is the
>> independence
>> of these changes. ChangeDescriptions rely on being applied to
>> exactly the state of the objects that they recorded originally; any
>> deviation from this
>> generally results in failure.

>> The operation-history-integrated editing domain implementation
>> automatically
>> tags IUndoableOperations with ResourceContexts indicating the
>> resources affected by the operations. The ResourceUndoContext is
>> the recommended basis for undo histories. Not only does the
>> computation of affected resources include both the referencing and
>> the reference resource when a bidirectional cross-reference is
>> changed, but also a unidirectional cross-reference. This is
>> pessimistic, but safe.

>> Rather than using an undo context for the editor in which a change
>> was performed, try basing the Undo action on the ResourceContext for
>> the resource that the editor is editing.

>> HTH,

>> Christian




--

I'm trying a new usenet client for Mac, Nemo OS X.
You can download it at http://www.malcom-mac.com/nemo
Re: ChangeDesciption issue [message #418749 is a reply to message #418748] Sat, 26 April 2008 16:40 Go to previous messageGo to next message
Alan is currently offline AlanFriend
Messages: 44
Registered: July 2009
Member
Hi Christian,

It sounds like in effect that I have a semi-global undo stack related to
resource 3.
What I mean is that practically every editor can have an effect on resource
3 (as you'd expect being a shared model)
So if I do something that effects resource1 alone then no problem
But if I do something that affects resource1 and resource3 in editor 1 I can
only undo that action
as long as nothing else has had an affect on resource3 in the meantime.If I
am taking this up right then I'll have to check with our requirements guys
to see how this sits with them.


> I don't understand what you mean when you say that objectA that is in
> resource1 is also in resource3. An object can only reside in one
> resource. Perhaps, if you are trying to bend the EMF rules, here, then
> that iscontributing to your problem?

What I meant to say here is that resource3 has a reference to the object
that is contained in resource1.
This sounds ok I hope ?

thanks again for the input - helping me to think through issues a lot.


"Christian W. Damus" <give.a.damus@gmail.com> wrote in message
news:nemoSat042608120002@news.eclipse.org...
> Hi, Alan,
>
> What I mean is, that your editor's Undo and Redo actions should
> probably use the ResourceUndoContext corresponding to the editor's
> resource to select their "undo stack" according to the operation API's
> undo and redoaction implementations.
>
> The result is, that each editor sees in its Undo/Redo menus the
> operations pertaining to its own resource. If it includes an
> operation that affected other resources, as well (such as your shared
> resource3), then an operation will only be available for undo if it is
> also the top of resource3's undo context stack. The resource undo
> contexts should ensure (via Eclipse's operation history) that undo is
> consistent with respect todependencies between your resources, or else
> disabled.
>
> I don't understand what you mean when you say that objectA that is in
> resource1 is also in resource3. An object can only reside in one
> resource. Perhaps, if you are trying to bend the EMF rules, here, then
> that iscontributing to your problem?
>
> HTH,
>
> Christian
>
>
> On Friday 04-25-2008 (09:55), Alan wrote:
>> Hi Christian,
>
>> I am not quite sure what you mean by "try basing the Undo action on
>> the ResourceContext"
>> I can get a handle on the ResourceContext for the IUndoableOperation
>> that I want to undo but
>> I don't what good this does me ?
>> I mean with it I can get a handle on the resource changed but can I
>> roll back just the changes to that resource?
>
>> Perhaps I am missing something ?
>
>> I will outline the scenario below in terms of resources....does EMF
>> definitely support what I am tring to do ?
>
>> thanks a lot,
>
>> Alan.
>
>
>> Resource 1 is attached to a GMFeditor1
>> Resource 2 is attached to a GMFeditor2
>> Resource 3 is the shared data resource and is updated by both of the
>> editors above.
>> Resource 3 has an editor (connection editor which is a table) which
>> is used to connect shared data.
>
>> I have objectA in GMFeditor1, so in resource1. it is also in
>> resource 3 as it is shared
>> I have objectB in GMFeditor2, so in resource2. it is also in
>> resource 3 as it is shared
>> I then created a connection between objects A and B in the
>> connection editor affecting resource3.
>> Save all
>
>> Delete objectA in GMFeditor1 (resource1). Also affected is resource
>> 3 as shared object removed
>> If I undo in GMFeditor1 at this point there is no issue
>
>> if I first go to GMFeditor2 and delete objectB and then go to
>> GMFeditor1 and undo I get the problem.
>> What I am trying to do is rollback the second last command on the
>> stack which is objectA delete.
>
>
>
>
>
>> "Christian W. Damus" <cdamus@ca.ibm.com> wrote in message
>> news:fuqk4b$i4m$1@build.eclipse.org...
>>> Hi, Ed, Alan,
>
>>> Yes, the operation-history integration provided by the EMF
>>> Transaction component is intended to support independent undo stacks
>>> for independent changes to resource-set content. However, the key
>>> here is the
>>> independence
>>> of these changes. ChangeDescriptions rely on being applied to
>>> exactly the state of the objects that they recorded originally; any
>>> deviation from this
>>> generally results in failure.
>
>>> The operation-history-integrated editing domain implementation
>>> automatically
>>> tags IUndoableOperations with ResourceContexts indicating the
>>> resources affected by the operations. The ResourceUndoContext is
>>> the recommended basis for undo histories. Not only does the
>>> computation of affected resources include both the referencing and
>>> the reference resource when a bidirectional cross-reference is
>>> changed, but also a unidirectional cross-reference. This is
>>> pessimistic, but safe.
>
>>> Rather than using an undo context for the editor in which a change
>>> was performed, try basing the Undo action on the ResourceContext for
>>> the resource that the editor is editing.
>
>>> HTH,
>
>>> Christian
>
>
>
> --
> I'm trying a new usenet client for Mac, Nemo OS X.
> You can download it at http://www.malcom-mac.com/nemo
>
Re: ChangeDesciption issue [message #418750 is a reply to message #418747] Sat, 26 April 2008 16:42 Go to previous messageGo to next message
Alan is currently offline AlanFriend
Messages: 44
Registered: July 2009
Member
In short attempting to edit changedescriptions to get around my current
issues does not sound like a good idea.

Didn't think it was, but thought it was worth throwing it out there.


"Christian W. Damus" <give.a.damus@gmail.com> wrote in message
news:nemoSat042608115555@news.eclipse.org...
> Hi, Ed, Alan,
>
> Note that TransactionChangeDescriptions actually use the
> ChangeDescription as an API, not as a model. In general, transactions
> have composite change descriptions that are not serializable as an EMF
> model, and also encapulatenon-EMF changes as Commands and even
> IUndoableOperations.
>
> So, you cannot expect to edit a transaction's change description in
> the usual way. The most that you can expect is a summary of the
> recorded changes in EObject content but, because of some of the
> mechanisms Imentioned above, even this may have gaps.
>
> Cheers,
>
> Christian
>
> On Friday 04-25-2008 (10:08), Ed Merks wrote:
>> This is a multi-part message in MIME format.
>> --------------060205020907000608050801
>> Content-Type: text/plain; charset=ISO-8859-1;
>> format=flowedContent-Transfer-Encoding: 7bit
>
>> Alan,
>
>> It's just another model, so yes; but the odds of doing it correctly
>> are pretty low.
>
>> Alan wrote:
>>> Is it possible to edit changedescription objects ? (just a thought)
>
> -----8<-----
>
> --
> I'm trying a new usenet client for Mac, Nemo OS X.
> You can download it at http://www.malcom-mac.com/nemo
>
Re: ChangeDesciption issue [message #418751 is a reply to message #418749] Sun, 27 April 2008 13:39 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: give.a.damus.gmail.com

Hi, Alan,

See some more replies in-line, below.

Cheers,

Christian

On Saturday 04-26-2008 (12:40), Alan wrote:
> Hi Christian,

> It sounds like in effect that I have a semi-global undo stack
> related to resource 3.

I think this will, in fact, be where you end up. The
operation-history support provided by EMF Transaction component
implements undo contexts at the resource level. Perhaps this is too
coarse-grained for your application, as you have a single resource
that is involved in all or mostof your operations.

Implementing object-level context would, however, be much more
complex. It would have to account for interobject dependencies that
are explicit or implicit through references (possibly of multiple
steps or even in theinverse direction) or even more complex
computations, depending on the
model.
> What I mean is that practically every editor can have an effect on
> resource 3 (as you'd expect being a shared model)
> So if I do something that effects resource1 alone then no problem
> But if I do something that affects resource1 and resource3 in editor
> 1 I can only undo that action
> as long as nothing else has had an affect on resource3 in the
> meantime.If I am taking this up right then I'll have to check with
> our requirements guys to see how this sits with them.

I wonder whether it might not be possible, using the operation history
API, to prompt the user in a case such as this to ask whether they
would like to also undo such-and-such other operations that affected
resource3 in order to undo the one that they have chosen in the
resource1 editor.That would ensure consistency of the data and the
undo stack.
>> I don't understand what you mean when you say that objectA that is
>> in resource1 is also in resource3. An object can only reside in one
>> resource. Perhaps, if you are trying to bend the EMF rules, here,
>> then that iscontributing to your problem?

> What I meant to say here is that resource3 has a reference to the
> object that is contained in resource1.
> This sounds ok I hope ?

Oh, yes. That's perfectly normal. In fact, it's the primary use case
forthe ResourceUndoContext. :-)
> thanks again for the input - helping me to think through issues a
> lot.

No problem. If this exploration finds limitations in the EMF
Transaction API that unduly constrain applications like yours, then it
will help me,too! :-)

-----8<-----


--

I'm trying a new usenet client for Mac, Nemo OS X.
You can download it at http://www.malcom-mac.com/nemo
Re: ChangeDesciption issue [message #418755 is a reply to message #418751] Mon, 28 April 2008 14:30 Go to previous messageGo to next message
Alan is currently offline AlanFriend
Messages: 44
Registered: July 2009
Member
Hi Christian,

The global undo stack idea is currently being floated and we can see how
that flies with the powers that be.

But my stubborn streak is keeping me going at this so I've being playing
around
with adding my own ChangeFactory and even my own ChangeRecorder.
So now's your chance to jump in and shout STOP :-)

I thought the shouldRecord method of TransactionChangeRecorder looked
promising but didn't help even after return true for any object contained
with the shared resource.

You know of anyone who has put in there own ChangeRecorder/Factory ?

thanks again.

"Christian W. Damus" <give.a.damus@gmail.com> wrote in message
news:nemoSun042708092931@news.eclipse.org...
> Hi, Alan,
>
> See some more replies in-line, below.
>
> Cheers,
>
> Christian
>
> On Saturday 04-26-2008 (12:40), Alan wrote:
>> Hi Christian,
>
>> It sounds like in effect that I have a semi-global undo stack
>> related to resource 3.
>
> I think this will, in fact, be where you end up. The
> operation-history support provided by EMF Transaction component
> implements undo contexts at the resource level. Perhaps this is too
> coarse-grained for your application, as you have a single resource
> that is involved in all or mostof your operations.
>
> Implementing object-level context would, however, be much more
> complex. It would have to account for interobject dependencies that
> are explicit or implicit through references (possibly of multiple
> steps or even in theinverse direction) or even more complex
> computations, depending on the
> model.
>> What I mean is that practically every editor can have an effect on
>> resource 3 (as you'd expect being a shared model)
>> So if I do something that effects resource1 alone then no problem
>> But if I do something that affects resource1 and resource3 in editor
>> 1 I can only undo that action
>> as long as nothing else has had an affect on resource3 in the
>> meantime.If I am taking this up right then I'll have to check with
>> our requirements guys to see how this sits with them.
>
> I wonder whether it might not be possible, using the operation history
> API, to prompt the user in a case such as this to ask whether they
> would like to also undo such-and-such other operations that affected
> resource3 in order to undo the one that they have chosen in the
> resource1 editor.That would ensure consistency of the data and the
> undo stack.
>>> I don't understand what you mean when you say that objectA that is
>>> in resource1 is also in resource3. An object can only reside in one
>>> resource. Perhaps, if you are trying to bend the EMF rules, here,
>>> then that iscontributing to your problem?
>
>> What I meant to say here is that resource3 has a reference to the
>> object that is contained in resource1.
>> This sounds ok I hope ?
>
> Oh, yes. That's perfectly normal. In fact, it's the primary use case
> forthe ResourceUndoContext. :-)
>> thanks again for the input - helping me to think through issues a
>> lot.
>
> No problem. If this exploration finds limitations in the EMF
> Transaction API that unduly constrain applications like yours, then it
> will help me,too! :-)
>
> -----8<-----
>
> --
> I'm trying a new usenet client for Mac, Nemo OS X.
> You can download it at http://www.malcom-mac.com/nemo
>
Re: ChangeDesciption issue [message #418937 is a reply to message #418755] Sun, 04 May 2008 01:47 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: give.a.damus.gmail.com

Hi, Alan,

You asked for it: STOP!

:-)

Sorry, I've been on vacation (actually, I'm not sorry, but you know
...)

Any attempt to skip the recording of a subset of changes will probably
result in corruption of the ChangeDescriptions, as correctly undoing
them relies on all changes to all objects being recorded. You will
probably find that changes fail to apply themselves to objects that
are not in the state that the changes expect.

Cheers,

Christian


On Monday 04-28-2008 (10:30), Alan wrote:
> Hi Christian,

> The global undo stack idea is currently being floated and we can see
> how that flies with the powers that be.

> But my stubborn streak is keeping me going at this so I've being
> playing around
> with adding my own ChangeFactory and even my own ChangeRecorder.
> So now's your chance to jump in and shout STOP :-)

> I thought the shouldRecord method of TransactionChangeRecorder
> looked promising but didn't help even after return true for any
> object contained with the shared resource.

> You know of anyone who has put in there own ChangeRecorder/Factory ?

> thanks again.

-----8<-----


--

I'm trying a new usenet client for Mac, Nemo OS X.
You can download it at http://www.malcom-mac.com/nemo
Re: ChangeDesciption issue [message #418949 is a reply to message #418937] Mon, 05 May 2008 10:25 Go to previous messageGo to next message
Alan is currently offline AlanFriend
Messages: 44
Registered: July 2009
Member
Hi Christian,

Well I hope you enjoyed the holidays. Have a week off myself right now
so I intend to forget all about this stuff for a while.
But just before I do I thought I'd let you know how I got on.

So I provided my own ChangeRecorder which meant I could provide my own
version
of ListChangeImpl. In here I overrode the applyAndReverse method.
The only change I made here was to change the way the objects are being
added to the list

So it was
originalList.addAll(index, getValues());

and changed to

originalList.addAll(getValues());

Initial results look quite good. I am no longer getting the
BasicIndexOutOfBoundsException from the BasicEList which was being caused by
my indexes being messed up so the objects are being added back on an undo.

So I am not skipping the recording of anything in this case. WHat I am doing
is saying

"Add the stuff back and forget the index"

Does this have any merit or do I hear another "STOP" coming on ? :-)

thanks,

Alan.








"Christian W. Damus" <give.a.damus@gmail.com> wrote in message
news:nemoSat050308094509@news.eclipse.org...
> Hi, Alan,
>
> You asked for it: STOP!
>
> :-)
>
> Sorry, I've been on vacation (actually, I'm not sorry, but you know
> ..)
>
> Any attempt to skip the recording of a subset of changes will probably
> result in corruption of the ChangeDescriptions, as correctly undoing
> them relies on all changes to all objects being recorded. You will
> probably find that changes fail to apply themselves to objects that
> are not in the state that the changes expect.
>
> Cheers,
>
> Christian
>
>
> On Monday 04-28-2008 (10:30), Alan wrote:
>> Hi Christian,
>
>> The global undo stack idea is currently being floated and we can see
>> how that flies with the powers that be.
>
>> But my stubborn streak is keeping me going at this so I've being
>> playing around
>> with adding my own ChangeFactory and even my own ChangeRecorder.
>> So now's your chance to jump in and shout STOP :-)
>
>> I thought the shouldRecord method of TransactionChangeRecorder
>> looked promising but didn't help even after return true for any
>> object contained with the shared resource.
>
>> You know of anyone who has put in there own ChangeRecorder/Factory ?
>
>> thanks again.
>
> -----8<-----
>
> --
> I'm trying a new usenet client for Mac, Nemo OS X.
> You can download it at http://www.malcom-mac.com/nemo
>
Re: ChangeDesciption issue [message #418950 is a reply to message #418949] Mon, 05 May 2008 11:34 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------090802040708030605050503
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Alan,

If you don't add them back at the right index but simply at the end of
the list, it's not really and undo. And if the object isn't quite back
in the original state, someone might well think they've undone the
changes when in actual fact,if they save, they'll have made some
reordering changes. Masking symptoms just seems like a bad idea...


Alan wrote:
> Hi Christian,
>
> Well I hope you enjoyed the holidays. Have a week off myself right now
> so I intend to forget all about this stuff for a while.
> But just before I do I thought I'd let you know how I got on.
>
> So I provided my own ChangeRecorder which meant I could provide my own
> version
> of ListChangeImpl. In here I overrode the applyAndReverse method.
> The only change I made here was to change the way the objects are being
> added to the list
>
> So it was
> originalList.addAll(index, getValues());
>
> and changed to
>
> originalList.addAll(getValues());
>
> Initial results look quite good. I am no longer getting the
> BasicIndexOutOfBoundsException from the BasicEList which was being caused by
> my indexes being messed up so the objects are being added back on an undo.
>
> So I am not skipping the recording of anything in this case. WHat I am doing
> is saying
>
> "Add the stuff back and forget the index"
>
> Does this have any merit or do I hear another "STOP" coming on ? :-)
>
> thanks,
>
> Alan.
>
>
>
>
>
>
>
>
> "Christian W. Damus" <give.a.damus@gmail.com> wrote in message
> news:nemoSat050308094509@news.eclipse.org...
>
>> Hi, Alan,
>>
>> You asked for it: STOP!
>>
>> :-)
>>
>> Sorry, I've been on vacation (actually, I'm not sorry, but you know
>> ..)
>>
>> Any attempt to skip the recording of a subset of changes will probably
>> result in corruption of the ChangeDescriptions, as correctly undoing
>> them relies on all changes to all objects being recorded. You will
>> probably find that changes fail to apply themselves to objects that
>> are not in the state that the changes expect.
>>
>> Cheers,
>>
>> Christian
>>
>>
>> On Monday 04-28-2008 (10:30), Alan wrote:
>>
>>> Hi Christian,
>>>
>>> The global undo stack idea is currently being floated and we can see
>>> how that flies with the powers that be.
>>>
>>> But my stubborn streak is keeping me going at this so I've being
>>> playing around
>>> with adding my own ChangeFactory and even my own ChangeRecorder.
>>> So now's your chance to jump in and shout STOP :-)
>>>
>>> I thought the shouldRecord method of TransactionChangeRecorder
>>> looked promising but didn't help even after return true for any
>>> object contained with the shared resource.
>>>
>>> You know of anyone who has put in there own ChangeRecorder/Factory ?
>>>
>>> thanks again.
>>>
>> -----8<-----
>>
>> --
>> I'm trying a new usenet client for Mac, Nemo OS X.
>> You can download it at http://www.malcom-mac.com/nemo
>>
>>
>
>
>


--------------090802040708030605050503
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Alan,<br>
<br>
If you don't add them back at the right index but simply at the end of
the list, it's not really and undo.&nbsp;&nbsp; And if the object isn't quite
back in the original state, someone might well think they've undone the
changes when in actual fact,if they save, they'll have made some
reordering changes.&nbsp; Masking symptoms just seems like a bad idea...<br>
<br>
<br>
Alan wrote:
<blockquote cite="mid:fvmnbp$84v$1@build.eclipse.org" type="cite">
<pre wrap="">Hi Christian,

Well I hope you enjoyed the holidays. Have a week off myself right now
so I intend to forget all about this stuff for a while.
But just before I do I thought I'd let you know how I got on.

So I provided my own ChangeRecorder which meant I could provide my own
version
of ListChangeImpl. In here I overrode the applyAndReverse method.
The only change I made here was to change the way the objects are being
added to the list

So it was
originalList.addAll(index, getValues());

and changed to

originalList.addAll(getValues());

Initial results look quite good. I am no longer getting the
BasicIndexOutOfBoundsException from the BasicEList which was being caused by
my indexes being messed up so the objects are being added back on an undo.

So I am not skipping the recording of anything in this case. WHat I am doing
is saying

"Add the stuff back and forget the index"

Does this have any merit or do I hear another "STOP" coming on ? :-)

thanks,

Alan.








"Christian W. Damus" <a class="moz-txt-link-rfc2396E" href="mailto:give.a.damus@gmail.com">&lt;give.a.damus@gmail.com&gt;</a> wrote in message
<a class="moz-txt-link-freetext" href="news:nemoSat050308094509@news.eclipse.org">news:nemoSat050308094509@news.eclipse.org</a>...
</pre>
<blockquote type="cite">
<pre wrap="">Hi, Alan,

You asked for it: STOP!

:-)

Sorry, I've been on vacation (actually, I'm not sorry, but you know
...)

Any attempt to skip the recording of a subset of changes will probably
result in corruption of the ChangeDescriptions, as correctly undoing
them relies on all changes to all objects being recorded. You will
probably find that changes fail to apply themselves to objects that
are not in the state that the changes expect.

Cheers,

Christian


On Monday 04-28-2008 (10:30), Alan wrote:
</pre>
<blockquote type="cite">
<pre wrap=""> Hi Christian,
</pre>
</blockquote>
<blockquote type="cite">
<pre wrap=""> The global undo stack idea is currently being floated and we can see
how that flies with the powers that be.
</pre>
</blockquote>
<blockquote type="cite">
<pre wrap=""> But my stubborn streak is keeping me going at this so I've being
playing around
with adding my own ChangeFactory and even my own ChangeRecorder.
So now's your chance to jump in and shout STOP :-)
</pre>
</blockquote>
<blockquote type="cite">
<pre wrap=""> I thought the shouldRecord method of TransactionChangeRecorder
looked promising but didn't help even after return true for any
object contained with the shared resource.
</pre>
</blockquote>
<blockquote type="cite">
<pre wrap=""> You know of anyone who has put in there own ChangeRecorder/Factory ?
</pre>
</blockquote>
<blockquote type="cite">
<pre wrap=""> thanks again.
</pre>
</blockquote>
<pre wrap="">-----8&lt;-----

--
I'm trying a new usenet client for Mac, Nemo OS X.
You can download it at <a class="moz-txt-link-freetext" href="http://www.malcom-mac.com/nemo">http://www.malcom-mac.com/nemo</a>

</pre>
</blockquote>
<pre wrap=""><!---->

</pre>
</blockquote>
<br>
</body>
</html>

--------------090802040708030605050503--


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: ChangeDesciption issue [message #418970 is a reply to message #418950] Tue, 06 May 2008 11:16 Go to previous message
Alan is currently offline AlanFriend
Messages: 44
Registered: July 2009
Member
This is a multi-part message in MIME format.

------=_NextPart_000_0008_01C8AF72.F7BC3B60
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi Ed,

I take your point, but the only place where this adding back at the end =
occurs is in the shared resource from what I can see. And in here the =
order of things does not seem important.
I know I maybe be opening myself up to subtle problems but so far this =
solution seems to be working ok. (Needs far more testing alright)
Just want to see if there is any possible alternative to global undo.

thanks,
Alan.


"Ed Merks" <merks@ca.ibm.com> wrote in message =
news:fvmrbo$3cv$1@build.eclipse.org...
Alan,

If you don't add them back at the right index but simply at the end of =
the list, it's not really and undo. And if the object isn't quite back =
in the original state, someone might well think they've undone the =
changes when in actual fact,if they save, they'll have made some =
reordering changes. Masking symptoms just seems like a bad idea...


Alan wrote:=20
Hi Christian,

Well I hope you enjoyed the holidays. Have a week off myself right now
so I intend to forget all about this stuff for a while.
But just before I do I thought I'd let you know how I got on.

So I provided my own ChangeRecorder which meant I could provide my own=20
version
of ListChangeImpl. In here I overrode the applyAndReverse method.
The only change I made here was to change the way the objects are being=20
added to the list

So it was
originalList.addAll(index, getValues());

and changed to

originalList.addAll(getValues());

Initial results look quite good. I am no longer getting the=20
BasicIndexOutOfBoundsException from the BasicEList which was being =
caused by=20
my indexes being messed up so the objects are being added back on an =
undo.

So I am not skipping the recording of anything in this case. WHat I am =
doing=20
is saying

"Add the stuff back and forget the index"

Does this have any merit or do I hear another "STOP" coming on ? :-)

thanks,

Alan.








"Christian W. Damus" <give.a.damus@gmail.com> wrote in message=20
news:nemoSat050308094509@news.eclipse.org...
Hi, Alan,

You asked for it: STOP!

:-)

Sorry, I've been on vacation (actually, I'm not sorry, but you know
...)

Any attempt to skip the recording of a subset of changes will probably
result in corruption of the ChangeDescriptions, as correctly undoing
them relies on all changes to all objects being recorded. You will
probably find that changes fail to apply themselves to objects that
are not in the state that the changes expect.

Cheers,

Christian


On Monday 04-28-2008 (10:30), Alan wrote:
Hi Christian,
The global undo stack idea is currently being floated and we can =
see
how that flies with the powers that be.
But my stubborn streak is keeping me going at this so I've being
playing around
with adding my own ChangeFactory and even my own ChangeRecorder.
So now's your chance to jump in and shout STOP :-)
I thought the shouldRecord method of TransactionChangeRecorder
looked promising but didn't help even after return true for any
object contained with the shared resource.
You know of anyone who has put in there own =
ChangeRecorder/Factory ?
thanks again.
-----8<-----

--=20
I'm trying a new usenet client for Mac, Nemo OS X.
You can download it at http://www.malcom-mac.com/nemo

=20

=20

------=_NextPart_000_0008_01C8AF72.F7BC3B60
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type =
content=3Dtext/html;charset=3DISO-8859-1>
<META content=3D"MSHTML 6.00.6000.16640" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY text=3D#000000 bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hi Ed,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I take your point, but the only place =
where this=20
adding back at the end occurs is in the shared resource from what I can =
see. And=20
in here the order of things does not seem important.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I know I maybe be opening myself up to =
subtle=20
problems but so far this solution seems to be working ok. (Needs far =
more=20
testing alright)</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Just want to see if there is any =
possible=20
alternative to global undo.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>thanks,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Alan.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<BLOCKQUOTE=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Ed Merks" &lt;<A =
href=3D"mailto:merks@ca.ibm.com">merks@ca.ibm.com</A>&gt;=20
wrote in message <A=20
=
href=3D"news:fvmrbo$3cv$1@build.eclipse.org">news:fvmrbo$3cv$1@build.ecli=
pse.org</A>...</DIV>Alan,<BR><BR>If=20
you don't add them back at the right index but simply at the end of =
the list,=20
it's not really and undo.&nbsp;&nbsp; And if the object isn't quite =
back in=20
the original state, someone might well think they've undone the =
changes when=20
in actual fact,if they save, they'll have made some reordering =
changes.&nbsp;=20
Masking symptoms just seems like a bad idea...<BR><BR><BR>Alan wrote:=20
<BLOCKQUOTE cite=3Dmid:fvmnbp$84v$1@build.eclipse.org =
type=3D"cite"><PRE wrap=3D"">Hi Christian,

Well I hope you enjoyed the holidays. Have a week off myself right now
so I intend to forget all about this stuff for a while.
But just before I do I thought I'd let you know how I got on.

So I provided my own ChangeRecorder which meant I could provide my own=20
version
of ListChangeImpl. In here I overrode the applyAndReverse method.
The only change I made here was to change the way the objects are being=20
added to the list

So it was
originalList.addAll(index, getValues());

and changed to

originalList.addAll(getValues());

Initial results look quite good. I am no longer getting the=20
BasicIndexOutOfBoundsException from the BasicEList which was being =
caused by=20
my indexes being messed up so the objects are being added back on an =
undo.

So I am not skipping the recording of anything in this case. WHat I am =
doing=20
is saying

"Add the stuff back and forget the index"

Does this have any merit or do I hear another "STOP" coming on ? :-)

thanks,

Alan.








"Christian W. Damus" <A class=3Dmoz-txt-link-rfc2396E =
href=3D"mailto:give.a.damus@gmail.com">&lt;give.a.damus@gmail.com&gt;</A>=
wrote in message=20
<A class=3Dmoz-txt-link-freetext =
href=3D"news:nemoSat050308094509@news.eclipse.org">news:nemoSat0503080945=
09@news.eclipse.org</A>...
</PRE>
<BLOCKQUOTE type=3D"cite"><PRE wrap=3D"">Hi, Alan,

You asked for it: STOP!

:-)

Sorry, I've been on vacation (actually, I'm not sorry, but you know
...)

Any attempt to skip the recording of a subset of changes will probably
result in corruption of the ChangeDescriptions, as correctly undoing
them relies on all changes to all objects being recorded. You will
probably find that changes fail to apply themselves to objects that
are not in the state that the changes expect.

Cheers,

Christian


On Monday 04-28-2008 (10:30), Alan wrote:
</PRE>
<BLOCKQUOTE type=3D"cite"><PRE wrap=3D""> Hi Christian,
</PRE></BLOCKQUOTE>
<BLOCKQUOTE type=3D"cite"><PRE wrap=3D""> The global undo stack =
idea is currently being floated and we can see
how that flies with the powers that be.
</PRE></BLOCKQUOTE>
<BLOCKQUOTE type=3D"cite"><PRE wrap=3D""> But my stubborn streak =
is keeping me going at this so I've being
playing around
with adding my own ChangeFactory and even my own ChangeRecorder.
So now's your chance to jump in and shout STOP :-)
</PRE></BLOCKQUOTE>
<BLOCKQUOTE type=3D"cite"><PRE wrap=3D""> I thought the =
shouldRecord method of TransactionChangeRecorder
looked promising but didn't help even after return true for any
object contained with the shared resource.
</PRE></BLOCKQUOTE>
<BLOCKQUOTE type=3D"cite"><PRE wrap=3D""> You know of anyone who =
has put in there own ChangeRecorder/Factory ?
</PRE></BLOCKQUOTE>
<BLOCKQUOTE type=3D"cite"><PRE wrap=3D""> thanks again.
</PRE></BLOCKQUOTE><PRE wrap=3D"">-----8&lt;-----

--=20
I'm trying a new usenet client for Mac, Nemo OS X.
You can download it at <A class=3Dmoz-txt-link-freetext =
href=3D"http://www.malcom-mac.com/nemo">http://www.malcom-mac.com/nemo</A=
>

</PRE></BLOCKQUOTE><PRE wrap=3D""><!---->

</PRE></BLOCKQUOTE><BR></BLOCKQUOTE></BODY></HTML>

------=_NextPart_000_0008_01C8AF72.F7BC3B60--
Previous Topic:Ecore id attribute with spaces
Next Topic:Default value of an inherited string attribute
Goto Forum:
  


Current Time: Fri Apr 19 20:28:02 GMT 2024

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

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

Back to the top