use of org.talend.mdm.repository.ui.dialogs.ValidationResultDialog in project tmdm-studio-se by Talend.
the class MDMValidationRunner method runInWorkspace.
/*
* (non-Javadoc)
*
* @see org.eclipse.core.resources.WorkspaceJob#runInWorkspace(org.eclipse.core.runtime.IProgressMonitor)
*/
@SuppressWarnings({ "restriction", "hiding" })
@Override
public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
if (UIUtil.isWorkInUI() && lockDirtyDialog.needShowDialog()) {
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
if (lockDirtyDialog.open() == IDialogConstants.CANCEL_ID) {
setReturnCode(IDialogConstants.CANCEL_ID);
} else {
lockDirtyDialog.saveDirtyObjects();
}
}
});
if (getReturnCode() == IDialogConstants.CANCEL_ID) {
setValidateResult(new MDMValidationService.ModelValidateResult());
return Status.CANCEL_STATUS;
}
}
final ValOperation vo = ValidationRunner.validate(toValidate, ValType.Manual, monitor, false);
if (vo.isCanceled()) {
setValidateResult(new MDMValidationService.ModelValidateResult());
return Status.CANCEL_STATUS;
}
final ValidationResultSummary result = vo.getResult();
final IModelValidateResult validateResult = new MDMValidationService.ModelValidateResult(viewObjMap);
if (needShowValidationResults(result)) {
final Set<IResource> resources = toValidate.values().iterator().next();
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
ValidationResultDialog d = new ValidationResultDialog(new Shell(), result, validationPref, viewObjMap);
int code = d.open();
validateResult.setSelectedButton(code);
setValidateResult(validateResult);
}
});
} else {
setValidateResult(validateResult);
if (validateResult.hasErrOrWarning()) {
int code = ValidationPreferenceService.getInstance().getDeployActionWhenValidateFail();
validateResult.setSelectedButton(code);
} else {
validateResult.setSelectedButton(IModelValidationService.BUTTON_OK);
}
}
activeProblemView(result);
return Status.OK_STATUS;
}
Aggregations