use of org.rstudio.studio.client.workbench.views.vcs.common.events.ViewFileRevisionEvent in project rstudio by rstudio.
the class CommitDetail method setDetails.
@Override
public void setDetails(final DiffParser unifiedParser, final boolean suppressViewLink) {
setProgressVisible(false);
invalidation_.invalidate();
final Token token = invalidation_.getInvalidationToken();
Scheduler.get().scheduleIncremental(new RepeatingCommand() {
@Override
public boolean execute() {
if (token.isInvalid())
return false;
final DiffFileHeader fileHeader = unifiedParser.nextFilePair();
if (fileHeader == null)
return false;
int filesCompared = 2;
ArrayList<ChunkOrLine> lines = new ArrayList<ChunkOrLine>();
DiffChunk chunk;
while (null != (chunk = unifiedParser.nextChunk())) {
if (!chunk.shouldIgnore())
filesCompared = chunk.getRanges().length;
lines.addAll(ChunkOrLine.fromChunk(chunk));
}
LineTableView view = new LineTableView(filesCompared);
view.setUseStartBorder(true);
view.setUseEndBorder(false);
view.setShowActions(false);
view.setData(lines, PatchMode.Stage);
view.setWidth("100%");
final DiffFrame diffFrame = new DiffFrame(null, fileHeader.getDescription(), null, commit_.getId(), view, new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
fireEvent(new ViewFileRevisionEvent(commit_.getId(), fileHeader.getDescription().trim()));
}
}, suppressViewLink);
diffFrame.setWidth("100%");
detailPanel_.add(diffFrame);
CommitTocRow tocAnchor = new CommitTocRow(fileHeader.getDescription());
tocAnchor.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
Point relativePosition = DomUtils.getRelativePosition(container_.getElement(), diffFrame.getElement());
container_.setVerticalScrollPosition(relativePosition.getY());
}
});
tocPanel_.add(tocAnchor);
return true;
}
});
}
Aggregations