use of org.eclipse.wst.validation.internal.ValidationResultSummary 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;
}
use of org.eclipse.wst.validation.internal.ValidationResultSummary in project liferay-ide by liferay.
the class KaleoUtil method checkWorkflowDefinitionForErrors.
public static String checkWorkflowDefinitionForErrors(IFile workspaceFile) {
String retval = null;
try {
StringBuilder errorMsgs = new StringBuilder();
ValOperation result = ValidationRunner.validate(workspaceFile, ValType.Manual, null, true);
ValidationResultSummary validationResult = result.getResult();
if (validationResult.getSeverityError() == 1) {
ValidationResults results = result.getResults();
for (ValidatorMessage message : results.getMessages()) {
if (message.getAttribute(IMarker.SEVERITY, -1) == IMarker.SEVERITY_ERROR) {
errorMsgs.append(message.getAttribute(IMarker.MESSAGE)).append('\n');
}
}
}
retval = errorMsgs.toString();
} catch (Exception e) {
}
return retval;
}
Aggregations