public final class ObjectUndoContext extends UndoContext
An undo context that can be used to represent any given object. Clients can add matching contexts to this context. This class may be instantiated by clients.
Constructor and Description |
---|
ObjectUndoContext(Object object)
Construct an operation context that represents the given object.
|
ObjectUndoContext(Object object,
String label)
Construct an operation context that represents the given object and has a
specialized label.
|
Modifier and Type | Method and Description |
---|---|
void |
addMatch(IUndoContext context)
Add the specified context as a match of this context.
|
String |
getLabel()
Get the label that describes the undo context.
|
Object |
getObject()
Return the object that is represented by this context.
|
boolean |
matches(IUndoContext context)
Return whether the specified context is considered a match for the
receiving context.
|
void |
removeMatch(IUndoContext context)
Remove the specified context as a match of this context.
|
String |
toString()
The string representation of this operation.
|
public ObjectUndoContext(Object object)
object
- the object to be represented.public String getLabel()
UndoContext
Get the label that describes the undo context. The default implementation returns the empty String. Subclasses may override.
getLabel
in interface IUndoContext
getLabel
in class UndoContext
public Object getObject()
public void addMatch(IUndoContext context)
context
- the context to be added as a match of this contextpublic void removeMatch(IUndoContext context)
context
- the context to be removed from the list of matches for this
contextpublic boolean matches(IUndoContext context)
UndoContext
Return whether the specified context is considered a match for the receiving context. When a context matches another context, operations that have the context are considered to also have the matching context. The default implementation checks whether the supplied context is identical to this context. Subclasses may override.
matches
in interface IUndoContext
matches
in class UndoContext
context
- the context to be checked against the receiving context.true
if the receiving context can be considered a
match for the specified context, and false
if it
cannot.
Copyright (c) 2000, 2018 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.