RbSubclipseMessages.getString("ERROR_INFORMATION_LABLE"),
RbSubclipseMessages.getString("ERROR_SERVER_REQURIED")); //$NON-NLS-1$
return false;
}
ModelReviewRequest reviewRequest = null;
//如果是修改
if(mainPage.isUpdate()){
//先查找出
reviewRequest = mainPage.getReviewRequest();
//设置额外信息
if( rbConfig.isAllowOptionalPageCommit() ){
requestOptionInfoWizardPage.setReviewRequestOptionalInfo(reviewRequest);
}
}else{//如果是新增
reviewRequest = mainPage.getReviewRequest();
//设置额外信息
if( rbConfig.isAllowOptionalPageCommit() ){
requestOptionInfoWizardPage.setReviewRequestOptionalInfo(reviewRequest);
}
}
if( null != reviewRequest
&& null != reviewRequest.getRepository()
&& null != reviewRequest.getRepository().getPath()
&& !reviewRequest.getRepository().getPath().trim().isEmpty()){
try {
boolean repositoryCorrect = true;
if( null == resourcesSelectedByUser || resourcesSelectedByUser.length == 0 ){
//用一种很特殊的方式取得url相关的值,用以支持支持SVN资源库中打开的历史记录
if( !this.getSvnHistoryUrl().toLowerCase().startsWith(reviewRequest.getRepository().getPath().trim())){
repositoryCorrect = false;
}
}
else{
IResource[] mainPageSelectedResources = getResources();
String svnUrlProject = RbSVNUrlUtils.getSVNUrlForProject((mainPageSelectedResources[0]));
if( !svnUrlProject.trim().toLowerCase().startsWith(reviewRequest.getRepository().getPath().trim().toLowerCase())){
repositoryCorrect = false;
}
}
if( !repositoryCorrect ){
CloseDialogWithHttpLink closeDialogWithLink = new CloseDialogWithHttpLink(getShell(),
ReviewboardUtil.norminateRepositoryUrl(reviewboardClient.getServerUrl())+"/r/"+reviewRequest.getId(),
RbSubclipseMessages.getString("ERROR_INFORMATION_LABLE"),
RbSubclipseMessages.getString("ERROR_NOTVALID_REPOSITORY"));
Display display = Display.getCurrent();
Color informationColor = display.getSystemColor(SWT.COLOR_RED);
closeDialogWithLink.setInformationColor(informationColor);
closeDialogWithLink.open();
return false;
}
} catch (Exception e) {
}
}
//如果是修改
if(mainPage.isUpdate()){
if( null == reviewRequest || reviewRequest.getId() == 0 ){
MessageDialog.openError(getShell(),
RbSubclipseMessages.getString("ERROR_INFORMATION_LABLE"),
MessageFormat.format(RbSubclipseMessages.getString("ERRO_REQUEST_0"), new Object[]{ String.valueOf(mainPage.getRequestId()) }));
return false;
}
if( null != reviewRequest.getStatus() ){
if( reviewRequest.getStatus().equals( ReviewRequestStatus.SUBMITTED ) ){
CloseDialogWithHttpLink closeDialogWithLink = new CloseDialogWithHttpLink(getShell(),
ReviewboardUtil.norminateRepositoryUrl(reviewboardClient.getServerUrl())+"/r/"+reviewRequest.getId(),
RbSubclipseMessages.getString("ERROR_INFORMATION_LABLE"),
MessageFormat.format(RbSubclipseMessages.getString("ERRO_REQUEST_1"), new Object[]{ String.valueOf(mainPage.getRequestId()) }));
Display display = Display.getCurrent();
Color informationColor = display.getSystemColor(SWT.COLOR_RED);
closeDialogWithLink.setInformationColor(informationColor);
closeDialogWithLink.open();
return false;
}
if( reviewRequest.getStatus().equals( ReviewRequestStatus.DISCARDED ) ){
CloseDialogWithHttpLink closeDialogWithLink = new CloseDialogWithHttpLink(getShell(),
ReviewboardUtil.norminateRepositoryUrl(reviewboardClient.getServerUrl())+"/r/"+reviewRequest.getId(),
RbSubclipseMessages.getString("ERROR_INFORMATION_LABLE"),
MessageFormat.format(RbSubclipseMessages.getString("ERRO_REQUEST_2"), new Object[]{ String.valueOf(mainPage.getRequestId()) }));
Display display = Display.getCurrent();
Color informationColor = display.getSystemColor(SWT.COLOR_RED);
closeDialogWithLink.setInformationColor(informationColor);
closeDialogWithLink.open();
return false;
}
}
//再修改内容
reviewboardService.updateReviewRequestFilterNoValue(reviewRequest, new NullProgressMonitor());
//再上传diff
reviewboardService.uploadDiff(reviewRequest.getId(), diffUploadBaseUrl, fileDiffs, null, new NullProgressMonitor());
//如果是publish
if( !mainPage.isDraft() ){
reviewboardService.publishReviewRequest(reviewRequest.getId(), new NullProgressMonitor());
}
CloseDialogWithHttpLink closeDialogWithLink = new CloseDialogWithHttpLink(getShell(),
ReviewboardUtil.norminateRepositoryUrl(reviewboardClient.getServerUrl())+"/r/"+reviewRequest.getId(),
RbSubclipseMessages.getString("SUCCESS_UPDATE"),
RbSubclipseMessages.getString("SUCCESS_UPDATE_1")+reviewRequest.getId() +"");
closeDialogWithLink.open();
}
else{//如果是新增
ModelReviewRequest reviewRequestNew = reviewboardService.newReviewRequestAll( reviewRequest,
diffUploadBaseUrl, fileDiffs, new NullProgressMonitor());
//如果是publish
if( !mainPage.isDraft()){
reviewboardService.publishReviewRequest(reviewRequestNew.getId(), new NullProgressMonitor());
}
CloseDialogWithHttpLink closeDialogWithLink = new CloseDialogWithHttpLink(getShell(),
ReviewboardUtil.norminateRepositoryUrl(reviewboardClient.getServerUrl())+"/r/"+reviewRequestNew.getId(),
RbSubclipseMessages.getString("SUCCESS_COMMIT"),
RbSubclipseMessages.getString("SUCCESS_COMMIT_1")+reviewRequestNew.getId() +"");
closeDialogWithLink.open();
}
return true;