|
RECODER 0.92 | |||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||
java.lang.Objectrecoder.AbstractService
recoder.service.ChangeHistory
public class ChangeHistory
Keeps records on the syntactical changes that occured after the last validation of the model. All transformations should inform this instance of their changes that are visible to the model. In addition, the change history allows to define top-level transformation sequences and perform rollbacks on these.
| Field Summary |
|---|
| Fields inherited from class recoder.AbstractService |
|---|
serviceConfiguration |
| Constructor Summary | |
|---|---|
ChangeHistory(ServiceConfiguration config)
Creates a new change history for the given configuration. |
|
| Method Summary | |
|---|---|
void |
addChangeHistoryListener(ChangeHistoryListener chl)
Adds a change history listener to the history. |
void |
addModelUpdateListener(ModelUpdateListener l)
Adds a model update listener to the history. |
void |
attached(ProgramElement root)
Informs the change history of the addition of a new subtree given by its root element. |
void |
begin(Transformation transformation)
Reports the start of a new transformation. |
void |
commit()
Flushes all transformation sequences making them irreversible. |
void |
detached(ProgramElement root,
int pos)
Informs the change history of the deletion of a subtree given by its root element. |
void |
detached(ProgramElement root,
NonTerminalProgramElement parent,
int pos)
Informs the change history of the deletion of a subtree given by its root element. |
boolean |
isReported(Transformation transformation)
Checks if the given transformation is reported in this history and can be rolled back. |
boolean |
needsUpdate()
Checks if there are changes in the change queue. |
void |
removeChangeHistoryListener(ChangeHistoryListener chl)
Removes a change history listener from the history. |
void |
removeModelUpdateListener(ModelUpdateListener l)
Removes a model update listener from the history. |
void |
replaced(ProgramElement root,
ProgramElement replacement)
Informs the change history of the replacement of a subtree by another one given by their root elements. |
void |
rollback()
Removes all transformations in the stack and reverts all changes that have not been committed yet. |
void |
rollback(Transformation transformation)
Removes the last transformations and reverts all their changes until the given transformation has been rolled back. |
void |
updateModel()
Notifies all listeners of the current changes and resets the lists. |
| Methods inherited from class recoder.AbstractService |
|---|
getServiceConfiguration, initialize |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ChangeHistory(ServiceConfiguration config)
| Method Detail |
|---|
public void addChangeHistoryListener(ChangeHistoryListener chl)
chl - a listener.public void removeChangeHistoryListener(ChangeHistoryListener chl)
chl - a listener.public void addModelUpdateListener(ModelUpdateListener l)
mul - a listener.public void removeModelUpdateListener(ModelUpdateListener l)
mul - a listener.public void attached(ProgramElement root)
root - the root of the change.
public void detached(ProgramElement root,
NonTerminalProgramElement parent,
int pos)
root - the root of the detached subtree.parent - the former parent of the detached subtree; may be null
only if the root is a compilation unit.pos - the positional code of the root in its former parent, as
obtained by
NonTerminalProgramElement.getChildPositionCode(recoder.java.ProgramElement);
the code may be arbitrary if the root is a compilation unit.
public void detached(ProgramElement root,
int pos)
root - the root of the detached subtree.pos - the positional code of the root in its former parent, as
obtained by
NonTerminalProgramElement.getChildPositionCode(recoder.java.ProgramElement);
the code may be arbitrary if the root is a compilation unit.
public void replaced(ProgramElement root,
ProgramElement replacement)
root - the root of a subtree that has been replaced.replacement - the root of a subtree that took over the role of the former
tree.public final boolean needsUpdate()
true, if there are changes left in the queue,
false otherwise.public final void updateModel()
public void begin(Transformation transformation)
commit(), a dummy transformation is inserted which is
automatically overwritten if a new transformation begins and the default
transformation report sequence is still empty.
transformation - the transformation that begins.
public void rollback(Transformation transformation)
throws NoSuchTransformationException
NoSuchTransformationException - if the given transformation is not known, for instance if
it has already been removed.public void rollback()
commit()public boolean isReported(Transformation transformation)
transformation - the transformation to locate.
true, if the given transformation can be rolled
back, false otherwise.public void commit()
|
RECODER 0.92 | |||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||