use of com.intellij.history.integration.revertion.UndoChangeRevertingVisitor in project intellij-community by JetBrains.
the class ChangeRange method revert.
public ChangeRange revert(ChangeRange reverse) throws IOException {
final Ref<Long> first = new Ref<>();
final Ref<Long> last = new Ref<>();
LocalHistoryFacade.Listener l = new LocalHistoryFacade.Listener() {
public void changeAdded(Change c) {
if (first.isNull())
first.set(c.getId());
last.set(c.getId());
}
};
myVcs.addListener(l, null);
try {
myVcs.accept(new UndoChangeRevertingVisitor(myGateway, myToChangeId, myFromChangeId));
} catch (UndoChangeRevertingVisitor.RuntimeIOException e) {
throw (IOException) e.getCause();
} finally {
myVcs.removeListener(l);
}
if (reverse != null) {
if (first.isNull())
first.set(reverse.myFromChangeId);
if (last.isNull())
last.set(reverse.myToChangeId);
}
return new ChangeRange(myGateway, myVcs, first.get(), last.get());
}
Aggregations