public class ChangeRecorder extends BasicChangeRecorder implements Adapter.Internal
change model
representing the changes needed to reverse (undo) all
the model changes made while recording.Adapter.Internal
Modifier and Type | Field and Description |
---|---|
protected java.util.Map<EObject,URI> |
eObjectToProxyURIMap |
protected boolean |
loadingTargets |
protected java.util.List<Notifier> |
originalTargetObjects |
protected boolean |
resolveProxies |
protected java.util.List<Notifier> |
targetObjects |
changeDescription, recording, recordingTransientFeatures
Constructor and Description |
---|
ChangeRecorder() |
ChangeRecorder(java.util.Collection<?> rootObjects) |
ChangeRecorder(EObject rootObject) |
ChangeRecorder(Resource resource) |
ChangeRecorder(ResourceSet resourceSet) |
Modifier and Type | Method and Description |
---|---|
protected void |
addAdapter(Notifier notifier) |
void |
beginRecording(ChangeDescription changeDescription,
java.util.Collection<?> rootObjects)
Begins recording any changes made to the elements of the specified collection,
adding the changes to an existing
ChangeDescription . |
void |
beginRecording(java.util.Collection<?> rootObjects)
Begins recording any changes made to the elements of the specified collection.
|
protected void |
consolidateChanges()
Consolidates the changes that have happen since the last consolidation.
|
void |
dispose()
Disposes this change recorder.
|
java.util.Map<EObject,URI> |
getEObjectToProxyURIMap() |
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) |
protected void |
handleTarget(EObject targetEObject) |
boolean |
isAdapterForType(java.lang.Object type)
Returns whether the adapter is of the given type.
|
protected boolean |
isOrphan(EObject eObject) |
boolean |
isResolveProxies() |
void |
notifyChanged(Notification notification)
Notifies that a change to some feature has occurred.
|
protected void |
prepareChangeDescriptionForResume()
Prepares this ChangeRecorder's
BasicChangeRecorder.changeDescription for the scenarios where the user
is resuming a previous recording. |
protected void |
removeAdapter(Notifier notifier) |
void |
setEObjectToProxyURIMap(java.util.Map<EObject,URI> eObjectToProxyURIMap)
When this is set to a non-null value,
the original proxy URI of each object will be recorded
as the change recorder is attached to each object.
|
void |
setResolveProxies(boolean resolveProxies) |
void |
setTarget(Notifier target)
Handles installation of the adapter
by adding the adapter to each of the directly contained objects.
|
protected boolean |
shouldRecord(EStructuralFeature feature,
EReference containment,
Notification notification,
EObject eObject) |
void |
unsetTarget(Notifier oldTarget)
Unsets the target from which the adapter will receive notification.
|
createChangeDescription, createFeatureChange, createResourceChange, eliminateEmptyChanges, endRecording, finalizeChange, finalizeChange, getChangeDescription, getFeatureChange, getFeatureChanges, getResourceChange, getResourceChanges, isRecording, isRecordingTransientFeatures, setChangeDescription, setRecording, setRecordingTransientFeatures, shouldRecord, summarize
analyzeLists, analyzeLists, createAddListChange, createListChange, createListChanges, createMoveListChange, createRemoveListChange, equal
protected java.util.List<Notifier> targetObjects
protected java.util.List<Notifier> originalTargetObjects
protected boolean loadingTargets
protected boolean resolveProxies
public ChangeRecorder()
public ChangeRecorder(EObject rootObject)
public ChangeRecorder(Resource resource)
public ChangeRecorder(ResourceSet resourceSet)
public ChangeRecorder(java.util.Collection<?> rootObjects)
public boolean isResolveProxies()
public void setResolveProxies(boolean resolveProxies)
public void setEObjectToProxyURIMap(java.util.Map<EObject,URI> eObjectToProxyURIMap)
ChangeDescription.copyAndReverse(Map)
.public void dispose()
BasicChangeRecorder
dispose
in class BasicChangeRecorder
protected void removeAdapter(Notifier notifier)
public void beginRecording(java.util.Collection<?> rootObjects)
rootObjects
- A collection of instances of Notifier
public void beginRecording(ChangeDescription changeDescription, java.util.Collection<?> rootObjects)
ChangeDescription
.
This allows clients to resume a previous recording.
Unpredictable (and probably bad) results may happen if the change description 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 collection of instances of Notifier
protected void prepareChangeDescriptionForResume()
BasicChangeRecorder.changeDescription
for the scenarios where the user
is resuming a previous recording.beginRecording(ChangeDescription, Collection)
protected void consolidateChanges()
BasicChangeRecorder
consolidateChanges
in class BasicChangeRecorder
protected boolean isOrphan(EObject eObject)
public void notifyChanged(Notification notification)
Adapter
notifyChanged
in interface Adapter
notification
- a description of the change.protected boolean shouldRecord(EStructuralFeature feature, EReference containment, Notification notification, EObject eObject)
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()
protected void handleTarget(EObject targetEObject)
public void unsetTarget(Notifier oldTarget)
Adapter.Internal
unsetTarget
in interface Adapter.Internal
oldTarget
- the old notifier.Adapter.getTarget()
,
Adapter.setTarget(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(java.lang.Object type)
Adapter
isAdapterForType
in interface Adapter
type
- the type.AdapterFactory.isFactoryForType(java.lang.Object)