public class ModelChangeDelta
extends java.lang.Object
This class (and its subclass CompoundModelChangeDelta
) is
intended to encapsulate all data related to a change in a MMI model. These
changes are brought about either via user actions, or through executed
commands.
ModelChangeDelta
s are used by implementations of the
ISourceSynchronizationProvider
interface to apply changes to
source models as a result of changes to a model.
ModelChangeDelta
s are created in two places during such
operations: Once during validation, in the VizElementValidator
and once during command execution, in the ModelChangeListener
when undo intervals are closed.
CompoundModelChangeDelta
,
ModelChangeListener
,
ISourceSynchronizationProvider
,
SourceSynchronizationService
Modifier and Type | Field and Description |
---|---|
protected java.util.Collection |
collection
For an add operation, this is the collection of objects being added to
the owner list.
|
protected org.eclipse.emf.ecore.EStructuralFeature |
feature
This is the feature of the owner object upon which the operation was
performed.
|
protected int |
index
For an add operation, this is the position at which the objects were
inserted.
|
protected int[] |
indices
Where the represented delta involves a collection, this is the array of
indices that were affected by the operation.
|
protected int |
oldIndex
For a move operation, this is the source position for the moved object.
|
protected java.lang.Object |
oldValue
The previous value in an add/set operation, the removed value in a remove
operation.
|
protected org.eclipse.emf.ecore.EObject |
owner
This is the owner object upon which the operation was performed.
|
protected java.util.Set |
participantIDs |
protected int |
type
The type of operation represented by this delta.
|
protected java.lang.Object |
value
The value that was added/set by the operation represented by this delta.
|
Modifier | Constructor and Description |
---|---|
protected |
ModelChangeDelta()
Zero argument constructor for the
ModelChangeDelta type. |
protected |
ModelChangeDelta(int t)
Constructor for the
ModelChangeDelta type. |
Modifier and Type | Method and Description |
---|---|
void |
addParticipantID(java.lang.String id)
Adds a participant identifier string to this
ModelChangeDelta . |
static boolean |
affectsVizElements(org.eclipse.emf.common.notify.Notification notification)
Test method to determine whether or not a particular
Notification represents a change to the model. |
static ModelChangeDelta |
createModelChangeDelta(java.util.List notifications)
Static factory method that creates a
ModelChangeDelta from
a List of EMF Notification s. |
static ModelChangeDelta |
createModelChangeDelta(org.eclipse.emf.common.notify.Notification notification)
Static factory method that creates a
ModelChangeDelta from
an EMF Notification . |
void |
dispose()
Cleans up this
ModelChangeDelta instance when it is no
longer needed. |
java.util.Collection |
getCollection() |
org.eclipse.emf.ecore.EStructuralFeature |
getFeature() |
int |
getIndex() |
int[] |
getIndices() |
int |
getOldIndex() |
java.lang.Object |
getOldValue() |
org.eclipse.emf.ecore.EObject |
getOwner() |
java.util.Set |
getParticipantIDs()
Gets the
Set of participant identifiers that participate
in this ModelChangeDelta |
int |
getType() |
java.lang.Object |
getValue() |
boolean |
isCompound() |
java.lang.String |
toString()
Generates a String representation of this
ModelChangeDelta
suitable for debug purposes only. |
ModelChangeDelta |
unwrap() |
protected java.util.Set participantIDs
protected org.eclipse.emf.ecore.EObject owner
protected org.eclipse.emf.ecore.EStructuralFeature feature
protected java.util.Collection collection
protected int index
protected int oldIndex
protected int[] indices
protected java.lang.Object value
protected java.lang.Object oldValue
protected int type
protected ModelChangeDelta(int t)
ModelChangeDelta
type.t
- --
The MCommand.Type
type of operation that this
ModelChangeDelta
instance is to represent.protected ModelChangeDelta()
ModelChangeDelta
type.public static final ModelChangeDelta createModelChangeDelta(java.util.List notifications)
ModelChangeDelta
from
a List
of EMF Notification
s.
This method takes a List
of Notification
s
as an input and extracts all relevant information on the changes to the
model that have been applied. The extracted information is wrapped in one
or more ModelChangeDelta
or
CompoundModelChangeDelta
elements and returned.
notifications
- --
The List
of Notification
s for
which delta information is to be generated.ModelChangeDelta
instance representing the
changes to the model described by the provided Notifications, or
null if the provided Notifications represent no changes to the
model.public static final ModelChangeDelta createModelChangeDelta(org.eclipse.emf.common.notify.Notification notification)
ModelChangeDelta
from
an EMF Notification
.notification
- --
The Notification
for which delta information is
to be generated.ModelChangeDelta
instance representing the
change to the model described by the provided Notification, or
null if the provided Notification represents no change to the
model.public static final boolean affectsVizElements(org.eclipse.emf.common.notify.Notification notification)
Notification
represents a change to the model.notification
- --
the notification
instance to be tested.Notification
instance
affects the model.public void addParticipantID(java.lang.String id)
ModelChangeDelta
. A participant identifier is a unique
String whose value is used to bind an
IStructuredReferenceHandler
to a particular source model
type.id
- --
The IStructuredReferenceHandler's identifier string.IStructuredReferenceHandler
public java.util.Set getParticipantIDs()
Set
of participant identifiers that participate
in this ModelChangeDelta
ModelChangeDelta
addParticipantID(String
id)
public int getType()
MCommand.Type
type of operation
represented by this ModelChangeDelta
public final java.util.Collection getCollection()
public final org.eclipse.emf.ecore.EStructuralFeature getFeature()
public final int getIndex()
public final int[] getIndices()
public final int getOldIndex()
public final java.lang.Object getOldValue()
public final org.eclipse.emf.ecore.EObject getOwner()
public final java.lang.Object getValue()
public boolean isCompound()
ModelChangeDelta
is
compound.public void dispose()
ModelChangeDelta
instance when it is no
longer needed.public ModelChangeDelta unwrap()
CompoundModelChangeDelta.unwrap()
public java.lang.String toString()
ModelChangeDelta
suitable for debug purposes only.toString
in class java.lang.Object