|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.emf.workspace.AbstractResourceUndoContextPolicy
public abstract class AbstractResourceUndoContextPolicy
The default implementation of the resource undo-context policy, suitable for clients to extend/override as required. The default policy is to consider any resource as affected by an operation if either
Notification
is received from a contained object or
from the resource, itself, orEReference
(i.e., one having no opposite) has an old value or a new
value in the resource
In the first case, above, a subclass can choose to include only changes to a resource's contents-list and URI as being significant (other resource properties not affecting the serialization of the resource).
The second case, above, is intended for applications that use
ResourceUndoContext
s to manage the Undo menus of their editors. It is
a pessimistic assumption that the referenced resource may either have derived
attributes whose values influenced precursor or successor operations, or that
such operations are influenced by the references incoming to the resource.
Thus, the concern is not so much with the dirty state of the resource as it
is with the integrity of the undo history for the associated editor and the
dependencies between successive operations. Subclasses can disable this case
by overriding the pessimisticCrossReferences()
method.
pessimisticCrossReferences()
,
considerAllResourceChanges()
Field Summary |
---|
Fields inherited from interface org.eclipse.emf.workspace.IResourceUndoContextPolicy |
---|
DEFAULT |
Constructor Summary | |
---|---|
protected |
AbstractResourceUndoContextPolicy()
Initializes me. |
Method Summary | |
---|---|
protected boolean |
considerAllResourceChanges()
May be overridden by subclasses to consider changes to any feature of a resource, not just its contents-list or URI, as affecting it. |
protected void |
crossResourceReference(Set<Resource> resources,
EObject owner,
Notification notification)
Handles notifications that can potentially represent cross-resource references. |
Set<Resource> |
getContextResources(IUndoableOperation operation,
List<? extends Notification> notifications)
Determines the resources in the undo context of the specified operation, during which execution the changes indicated by the given notifications occurred. |
protected boolean |
isAbstractChange(Notification notification)
Queries whether the specified notification signals an abstract change to a resource, which would potentially put that resource into the operation context. |
protected void |
objectChange(Set<Resource> resources,
EObject object,
Notification notification)
Adds to the collection of resources any that are affected by the specified notification from an object. |
protected boolean |
pessimisticCrossReferences()
May be overridden by subclasses to disable pessimistic handling of cross-resource references. |
protected void |
resourceChange(Set<Resource> resources,
Resource resource,
Notification notification)
Adds to the collection of resources any that are affected by the specified notification from a resource. |
protected void |
resourceSetChange(Set<Resource> resources,
ResourceSet resourceSet,
Notification notification)
Adds to the collection of resources any that are affected by the specified notification from a resourceSet. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected AbstractResourceUndoContextPolicy()
Method Detail |
---|
public Set<Resource> getContextResources(IUndoableOperation operation, List<? extends Notification> notifications)
IResourceUndoContextPolicy
getContextResources
in interface IResourceUndoContextPolicy
operation
- the operation. It may or may not have finished executing. Must
not be null
notifications
- a list of notifications of changes caused by the operation
during its execution, in the order in which they occurred.
This may be an empty list, but never null
null
protected boolean isAbstractChange(Notification notification)
notification
- a notification of some concrete change in the resource set
protected boolean pessimisticCrossReferences()
true
always.
protected boolean considerAllResourceChanges()
true
if all changes to a resource are considered as
affecting it for the purposes of undo context; false
if only the contents-list and URI areprotected void resourceChange(Set<Resource> resources, Resource resource, Notification notification)
resources
- collects the affected resourcesresource
- a resource that sent a notificationnotification
- the notification sent by the resourceprotected void objectChange(Set<Resource> resources, EObject object, Notification notification)
resources
- collects the affected resourcesobject
- a object that sent a notificationnotification
- the notification sent by the objectprotected void resourceSetChange(Set<Resource> resources, ResourceSet resourceSet, Notification notification)
resources
- collects the affected resourcesresourceSet
- a resource set that sent a notificationnotification
- the notification sent by the resource setprotected void crossResourceReference(Set<Resource> resources, EObject owner, Notification notification)
objectChange(Set, EObject, Notification)
method.
resources
- collects the affected resourcesowner
- the owner of the reference that changednotification
- a potential cross-resource reference change notification
|
Copyright 2002, 2007 IBM Corporation and others. All Rights Reserved. |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |