|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.emf.ecore.change.util.ChangeRecorder
A change recorder for the tree contents of a collection of EObjects. It monitors the specified objects and
then produces a change model
representing the changes needed to reverse (undo) all
the model changes made while recording.
Nested Class Summary |
Nested classes inherited from class org.eclipse.emf.common.notify.Adapter |
Adapter.Internal |
Field Summary | |
protected ChangeDescription |
changeDescription
|
protected boolean |
loadingTargets
|
protected List |
originalTargetObjects
|
protected boolean |
recording
|
protected boolean |
resolveProxies
|
protected List |
targetObjects
|
Constructor Summary | |
ChangeRecorder()
|
|
ChangeRecorder(Collection rootObjects)
|
|
ChangeRecorder(EObject rootObject)
|
|
ChangeRecorder(Resource resource)
|
|
ChangeRecorder(ResourceSet resourceSet)
|
Method Summary | |
protected void |
addAdapter(Notifier notifier)
|
void |
beginRecording(ChangeDescription changeDescription,
Collection rootObjects)
Begins recording any changes made to the elements of the specifed collection, adding the changes to and existing ChangeDescription .
|
void |
beginRecording(Collection rootObjects)
Begins recording any changes made to the elements of the specifed collection. |
protected void |
consolidateChanges()
Consolidates the changes that have happen since the last consolidation. |
protected void |
createAddListChange(EList oldList,
EList changesList,
Object newObject,
int index)
Convenience method added to allow subclasses to modify the default implementation for the scenario in which an element was added to the monitored list. |
protected ChangeDescription |
createChangeDescription()
|
protected FeatureChange |
createFeatureChange(EObject eObject,
EStructuralFeature eStructuralFeature,
Object value,
boolean isSet)
|
protected ListChange |
createListChange(EList changesList,
ChangeKind kind,
int index)
|
protected void |
createListChanges(EList oldList,
EList newList,
EList changesList)
|
protected void |
createMoveListChange(EList oldList,
EList changesList,
Object newObject,
int index,
int toIndex)
Convenience method added to allow subclasses to modify the default implementation for the scenario in which an element was moved in the monitored list. |
protected void |
createRemoveListChange(EList oldList,
EList changesList,
Object newObject,
int index)
Convenience method added to allow subclasses to modify the default implementation for the scenario in which an element was removed from the monitored list. |
protected ResourceChange |
createResourceChange(Resource resource,
EList value)
|
void |
dispose()
Disposes this change recorder by detaching it from its targets, clearing the collections attributes and setting the internal reference to the change description to null. |
ChangeDescription |
endRecording()
Ends the recording. |
protected void |
finalizeChange(FeatureChange change,
EObject eObject)
|
protected void |
finalizeChange(ResourceChange change)
|
protected FeatureChange |
getFeatureChange(List featureChanges,
EStructuralFeature eStructuralFeature)
|
protected List |
getFeatureChanges(EObject eObject)
|
protected ResourceChange |
getResourceChange(Resource resource)
|
protected EList |
getResourceChanges()
|
Notifier |
getTarget()
Returns the target from which the adapter receives notification. |
protected void |
handleFeature(EStructuralFeature feature,
EReference containment,
Notification notification,
EObject eObject)
|
protected void |
handleResource(Notification notification)
|
boolean |
isAdapterForType(Object type)
Returns whether the adapter is of the given type. |
boolean |
isRecording()
|
boolean |
isResolveProxies()
|
void |
notifyChanged(Notification notification)
Notifies that a change to some feature has occurred. |
protected void |
prepareChangeDescriptionForResume()
Prepares this ChangeRecorder's changeDescription for the scenarios where the user
is resumming a previous recording. |
protected void |
removeAdapter(Notifier notifier)
|
void |
setResolveProxies(boolean resolveProxies)
|
void |
setTarget(Notifier target)
Handles installation of the adapter by adding the adapter to each of the directly contained objects. |
ChangeDescription |
summarize()
Summarizes the changes made to the analysed objects on the change description
returned by the endRecording() without ending the recording.
|
void |
unsetTarget(Notifier oldTarget)
Unsets the target from which the adapter will receive notification. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected boolean recording
protected ChangeDescription changeDescription
protected List targetObjects
protected List originalTargetObjects
protected boolean loadingTargets
protected boolean resolveProxies
Constructor Detail |
public ChangeRecorder()
public ChangeRecorder(EObject rootObject)
public ChangeRecorder(Resource resource)
public ChangeRecorder(ResourceSet resourceSet)
public ChangeRecorder(Collection rootObjects)
Method Detail |
public boolean isRecording()
public boolean isResolveProxies()
public void setResolveProxies(boolean resolveProxies)
public void dispose()
protected void removeAdapter(Notifier notifier)
public void beginRecording(Collection rootObjects)
rootObjects
- A collecion of instances of Notifier
public void beginRecording(ChangeDescription changeDescription, Collection rootObjects)
ChangeDescription
.
This allows clients to resume a previous recording.
Unpredictable (and probably bad) results may happen if the change descrition is inconsistent with the current state of the application.
changeDescription
- A change description with changes made during a previous
recording or null if a new change description should be instantiated.rootObjects
- A collecion of instances of Notifier
public ChangeDescription summarize()
change description
returned by the endRecording()
without ending the recording.
This method doesn't do anything if this ChangeRecorder is not recording.
ChangeDescription
or null if there is nothing being recorded.public ChangeDescription endRecording()
ChangeDescription
or null if there is nothing being recorded.protected void prepareChangeDescriptionForResume()
changeDescription
for the scenarios where the user
is resumming a previous recording.
beginRecording(ChangeDescription, Collection)
protected void consolidateChanges()
public void notifyChanged(Notification notification)
Adapter
notifyChanged
in interface Adapter
notification
- a description of the change.protected void handleFeature(EStructuralFeature feature, EReference containment, Notification notification, EObject eObject)
protected void handleResource(Notification notification)
public void setTarget(Notifier target)
setTarget
in interface Adapter
target
- the new notifier.Adapter.getTarget()
public void unsetTarget(Notifier oldTarget)
Adapter.Internal
unsetTarget
in interface Adapter.Internal
oldTarget
- the old notifier.Adapter.getTarget()
,
Adapter.setTarget(org.eclipse.emf.common.notify.Notifier)
protected void addAdapter(Notifier notifier)
public Notifier getTarget()
Adapter
getTarget
in interface Adapter
Adapter.setTarget(org.eclipse.emf.common.notify.Notifier)
public boolean isAdapterForType(Object type)
Adapter
isAdapterForType
in interface Adapter
type
- the type.
AdapterFactory.isFactoryForType(java.lang.Object)
protected EList getResourceChanges()
protected ResourceChange getResourceChange(Resource resource)
protected List getFeatureChanges(EObject eObject)
protected FeatureChange getFeatureChange(List featureChanges, EStructuralFeature eStructuralFeature)
protected void finalizeChange(ResourceChange change)
protected void finalizeChange(FeatureChange change, EObject eObject)
protected void createListChanges(EList oldList, EList newList, EList changesList)
protected void createAddListChange(EList oldList, EList changesList, Object newObject, int index)
createListChanges(EList, EList, EList)
protected void createRemoveListChange(EList oldList, EList changesList, Object newObject, int index)
createListChanges(EList, EList, EList)
protected void createMoveListChange(EList oldList, EList changesList, Object newObject, int index, int toIndex)
createListChanges(EList, EList, EList)
protected ListChange createListChange(EList changesList, ChangeKind kind, int index)
protected FeatureChange createFeatureChange(EObject eObject, EStructuralFeature eStructuralFeature, Object value, boolean isSet)
protected ResourceChange createResourceChange(Resource resource, EList value)
protected ChangeDescription createChangeDescription()
|
Copyright 2001-2006 IBM Corporation and others. All Rights Reserved. |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |