Skip to content

Commit

Permalink
Performance - fetch data from CVS in background rather than in UI thread
Browse files Browse the repository at this point in the history
  • Loading branch information
angvoz committed Jan 13, 2013
1 parent 6b6f752 commit adba8e8
Showing 1 changed file with 20 additions and 15 deletions.
35 changes: 20 additions & 15 deletions VersionTree/src/net/sf/versiontree/views/VersionTreeView.java
Expand Up @@ -376,25 +376,30 @@ public IStatus run(IProgressMonitor monitor) {
}
}

ICVSRemoteFile remoteFile = (ICVSRemoteFile) CVSWorkspaceRoot.getRemoteResourceFor(cvsFile.getIResource());
final String revisionId = remoteFile != null ? remoteFile.getRevision() : null;
ILogEntry currentEntry = null;
if (entries != null && entries.length > 0) {
ICVSRemoteFile remoteFile = (ICVSRemoteFile) CVSWorkspaceRoot.getRemoteResourceFor(cvsFile.getIResource());
String revisionId = remoteFile != null ? remoteFile.getRevision() : null;
// Create tree pulling entries from CVS repository
branchTree = new BranchTree(entries, revisionId);
// Find current revision
if (revisionId != null) {
for (ILogEntry entry : entries) {
if (entry.getRevision().equals(revisionId)) {
currentEntry = entry;
break;
}
}
}
} else {
branchTree = null;
}
final ILogEntry currentEntryFinal = currentEntry;
getSite().getShell().getDisplay().asyncExec(new Runnable() {
public void run() {
if (treeView != null && ! treeView.isDisposed()) {
if (entries != null && entries.length > 0) {
// Create and show tree
branchTree = new BranchTree(entries, revisionId);
// set current revision
for (ILogEntry entry : entries) {
if (entry.getRevision().equals(revisionId)) {
setCurrentEntry(entry);
break;
}
}
} else {
branchTree = null;
}
renderVersionTree(branchTree);
setCurrentEntry(currentEntryFinal);
}
}
});
Expand Down

0 comments on commit adba8e8

Please sign in to comment.