Object sel0 = sel.getFirstElement();
final IResource resource= (IResource)sel0;
CompareEditorInput compareEditorInput = null;
ISVNRemoteResource svnRemoteResource1 = null;
ISVNRemoteResource svnRemoteResource2 = null;
final ISVNLocalResource localResource= SVNWorkspaceRoot.getSVNResourceFor(resource);
String[] startAndStopVersion = getStartAndStopVersion();
SVNRevision[] fromAndToRevision = RbSVNUrlUtils.formateSVNRevisionUnify(startAndStopVersion[0], startAndStopVersion[1]);
SVNRevision startVersion = fromAndToRevision[0];
SVNRevision stopVersion = fromAndToRevision[1];
//修复版本号
if( stopVersion instanceof SVNRevision.Number ){
stopVersion = RbSVNUrlUtils.reviseSVNRevision( resource, (SVNRevision.Number)fromAndToRevision[1], true, true, null );
}
if( startVersion instanceof SVNRevision.Number ){
startVersion = RbSVNUrlUtils.reviseSVNRevision( resource, (SVNRevision.Number)fromAndToRevision[0], false, true,
stopVersion instanceof SVNRevision.Number ? (SVNRevision.Number)stopVersion : null );
}
//尽可能少地访问SVN库,以提高性能
if( startVersion instanceof SVNRevision.Number && stopVersion instanceof SVNRevision.Number ){
if( ((SVNRevision.Number)startVersion).getNumber() == ((SVNRevision.Number)stopVersion).getNumber() ){
MessageDialog.openError(getShell(),
RbSubclipseMessages.getString("ERROR_INFORMATION_LABLE"),
RbSubclipseMessages.getString("ERROR_COMPARE_1")); //$NON-NLS-1$
return ;
}
}
if( !(startVersion instanceof SVNRevision.Number) && !(stopVersion instanceof SVNRevision.Number) ){
if( startVersion.equals(stopVersion) ){
MessageDialog.openError(getShell(),
RbSubclipseMessages.getString("ERROR_INFORMATION_LABLE"),
RbSubclipseMessages.getString("ERROR_COMPARE_1")); //$NON-NLS-1$
return ;
}
}
try {
svnRemoteResource1 = localResource.getRemoteResource( startVersion );
svnRemoteResource2 = localResource.getRemoteResource( stopVersion );
} catch (Exception e) {
MessageDialog.openError(getShell(), RbSubclipseMessages.getString("ERROR_INFORMATION_LABLE"),
RbSubclipseMessages.getString("ERROR_COMPARE")+e.getMessage()); //$NON-NLS-1$
return ;
}