Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » change recorder
change recorder [message #418288] Thu, 10 April 2008 09:55 Go to next message
Eclipse UserFriend
Originally posted by: prateek.babel.in.bosch.com

Hello All,
I have a pretty simple problme with using of EMF supplied ChangeRecorder.
But not really able to solve it. Any help would be appreciated:

Scenario: I have a change recorder in which many changes on some objects
have been recorded. I would like to flush the change recorder only for
some particular objects. How to acheive this?

Example: Obj1, obj2 are already present in change recorder whith their set
of changes. How to remove only the changes of obj1 and leave obj2 as it is?

Thanks in advance,
Prateek
Re: change recorder [message #418290 is a reply to message #418288] Thu, 10 April 2008 10:55 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------070405030306090704020302
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Prateek,

When changes are being recorded it does:

protected List<FeatureChange> getFeatureChanges(EObject eObject)
{
ChangeDescription changeDescription = getChangeDescription();
List<FeatureChange> featureChanges =
changeDescription.getObjectChanges().get(eObject);
if (featureChanges == null)
{
Map.Entry<EObject, EList<FeatureChange>> entry =
ChangeFactory.eINSTANCE.createEObjectToChangesMapEntry(eObje ct);
changeDescription.getObjectChanges().add(entry);
featureChanges = entry.getValue();
}
return featureChanges;
}

Do doing

changeDescription.getObjectChanges().remove(eObject)

should clear the changes for that one object. Of course if
bidirectional references are involved, this might result in an
inconsistent set of changes being recorded...


Prateek Babel wrote:
> Hello All,
> I have a pretty simple problme with using of EMF supplied
> ChangeRecorder. But not really able to solve it. Any help would be
> appreciated:
>
> Scenario: I have a change recorder in which many changes on some
> objects have been recorded. I would like to flush the change recorder
> only for some particular objects. How to acheive this?
>
> Example: Obj1, obj2 are already present in change recorder whith their
> set of changes. How to remove only the changes of obj1 and leave obj2
> as it is?
>
> Thanks in advance,
> Prateek
>
>


--------------070405030306090704020302
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Prateek,<br>
<br>
When changes are being recorded it does:<br>
<blockquote><small>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: change recorder [message #418298 is a reply to message #418290] Fri, 11 April 2008 08:22 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: prateek.babel.in.bosch.com

Hello Ed,
Thanks
I hacve done the same. But still when i come back to the change recorder
after the present session..i get back all the data wchich i had removed in
me last session

Some code snipplet:
for (EObject changedObject : new
HashSet<EObject>(modelDelta.getObjectChanges().keySet())) {
String affectedOriginURI = findOriginURI(changedObject, modelDelta);
if (originURI.equals(affectedOriginURI)) {
modelDelta.getObjectChanges().remove(changedObject);
}
}
}
Re: change recorder [message #418304 is a reply to message #418298] Fri, 11 April 2008 10:33 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
Prateek,

Either it's not getting removed, or it's getting added back in. Do you
know which of the two is the case? The change description itself is a
model you can add an adapter to get notifications as it changes, so you
could use that to observe what's happening...


Prateek Babel wrote:
> Hello Ed,
> Thanks
> I hacve done the same. But still when i come back to the change
> recorder after the present session..i get back all the data wchich i
> had removed in me last session
>
> Some code snipplet:
> for (EObject changedObject : new
> HashSet<EObject>(modelDelta.getObjectChanges().keySet())) {
> String affectedOriginURI = findOriginURI(changedObject,
> modelDelta);
> if (originURI.equals(affectedOriginURI)) {
> modelDelta.getObjectChanges().remove(changedObject);
> }
> }
> }
>
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:How to Drag a node from a tree view to EMF editor?
Next Topic:Mapping (1 - n)
Goto Forum:
  


Current Time: Thu Apr 25 21:00:17 GMT 2024

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

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

Back to the top