Java Code Examples for org.eclipse.xtext.validation.ValidationMessageAcceptor#acceptError()
The following examples show how to use
org.eclipse.xtext.validation.ValidationMessageAcceptor#acceptError() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SolidityIssueCreator.java From solidity-ide with Eclipse Public License 1.0 | 6 votes |
protected void createSolcIssue(CompileError error, Set<File> filesToCompile, EObject currentObject, ValidationMessageAcceptor acceptor) { SourceLocation sourceLocation = error.getSourceLocation(); if(sourceLocation == null) { return; } String fileName = sourceLocation.getFile(); File errorFile = findFileForName(filesToCompile, fileName); int offset = sourceLocation.getStart(); String message = error.getMessage(); EObject element = getEObject(errorFile, offset, currentObject); String severity = error.getSeverity(); if (severity.equals(ERROR)) { acceptor.acceptError(message, element, null, offset, createErrorCodeFromMessage(severity, message)); } else if (severity.equals(WARNING)) { acceptor.acceptWarning(message, element, null, offset, createErrorCodeFromMessage(severity, message)); } }
Example 2
Source File: ImportsVariableResolver.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
@Override public void validateParameters(Variable variable, ValidationMessageAcceptor validationMessageAcceptor) { if (variable.getParameters().isEmpty()) { validationMessageAcceptor.acceptError(getType() + "-variables have mandatory parameters.", variable, TemplatesPackage.Literals.VARIABLE__TYPE, ValidationMessageAcceptor.INSIGNIFICANT_INDEX, null); } else { EList<String> parameters = variable.getParameters(); for (int i = 0; i < parameters.size(); i++) { String param = parameters.get(i); try { IValueConverter<String> converter = ((XbaseValueConverterService) valueConverterService) .getQualifiedNameWithWildCardValueConverter(); converter.toString(param); } catch (ValueConverterException e) { validationMessageAcceptor.acceptError(getType() + " - parameter " + param + " is not a valid qualifier.", variable, TemplatesPackage.Literals.VARIABLE__PARAMETERS, i, null); } } } }
Example 3
Source File: AbstractIssue.java From dsl-devkit with Eclipse Public License 1.0 | 6 votes |
/** {@inheritDoc} */ public void accept(final ValidationMessageAcceptor acceptor, final EObject object, final EStructuralFeature feature, final String message, final SeverityKind severityKind, final int index, final String issueCode, final String... issueData) { switch (severityKind) { case ERROR: acceptor.acceptError(message, object, feature, index, issueCode, issueData); return; case WARNING: acceptor.acceptWarning(message, object, feature, index, issueCode, issueData); return; case INFO: acceptor.acceptInfo(message, object, feature, index, issueCode, issueData); return; case IGNORE: default: return; } }
Example 4
Source File: AnnotationValueValidator.java From xtext-extras with Eclipse Public License 2.0 | 5 votes |
public void validateAnnotationValue(XExpression value, ValidationMessageAcceptor acceptor) { try { if (!isValidAnnotationValue(value)) { acceptor.acceptError("The value for an annotation attribute must be a constant expression", value, null, ValidationMessageAcceptor.INSIGNIFICANT_INDEX, IssueCodes.ANNOTATIONS_ILLEGAL_ATTRIBUTE); } } catch (NotResolvedFeatureException e) { // do nothing } }
Example 5
Source File: InspectableTemplateVariableResolverDecorator.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
@Override public void validateParameters(Variable variable, ValidationMessageAcceptor validationMessageAcceptor) { if (!canHaveParameters()) { if (variable.getParameters().size() > 0) validationMessageAcceptor.acceptError(getUnexpectedParametersMessage(), variable, TemplatesPackage.Literals.VARIABLE__PARAMETERS, ValidationMessageAcceptor.INSIGNIFICANT_INDEX, null); } if (hasMandatoryParameters()) { if (variable.getParameters().isEmpty()) { validationMessageAcceptor.acceptError(getMandatorParametersMessage(), variable, TemplatesPackage.Literals.VARIABLE__TYPE, ValidationMessageAcceptor.INSIGNIFICANT_INDEX, null); } } }
Example 6
Source File: XtextValidator.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
public void doCreateMessage(String message, String code, int severity, EObject context, EStructuralFeature feature, ValidationMessageAcceptor acceptor) { if (severity == Diagnostic.WARNING) { acceptor.acceptWarning(message, context, feature, ValidationMessageAcceptor.INSIGNIFICANT_INDEX, code); } else if (severity == Diagnostic.ERROR) { acceptor.acceptError(message, context, feature, ValidationMessageAcceptor.INSIGNIFICANT_INDEX, code); } else if (severity == Diagnostic.INFO) { acceptor.acceptInfo(message, context, feature, ValidationMessageAcceptor.INSIGNIFICANT_INDEX, code); } }
Example 7
Source File: StateNamesAreUniqueValidationHelper.java From statecharts with Eclipse Public License 1.0 | 5 votes |
protected void createDuplicateStateNameError(IEObjectDescription description, ValidationMessageAcceptor acceptor) { String msg = STATE_NAME_NOT_UNIQUE; EObject object = description.getEObjectOrProxy(); EStructuralFeature feature = getNameFeature(object); acceptor.acceptError(msg, object, feature, ValidationMessageAcceptor.INSIGNIFICANT_INDEX, getErrorCode()); }
Example 8
Source File: STextNamesAreUniqueValidationHelper.java From statecharts with Eclipse Public License 1.0 | 5 votes |
@Override protected void createDuplicateNameError(IEObjectDescription description, EClass clusterType, ValidationMessageAcceptor acceptor) { EObject object = description.getEObjectOrProxy(); EStructuralFeature feature = getNameFeature(object); String errorMsg = getDuplicateNameErrorMessage(description, clusterType, feature); if (errorMsg.contains("''")) { errorMsg = errorMsg.replace("Duplicate Entry ''", "Duplicate unnamed Entry"); } acceptor.acceptError(errorMsg, object, feature, ValidationMessageAcceptor.INSIGNIFICANT_INDEX, getErrorCode()); }
Example 9
Source File: XsemanticsValidatorErrorGenerator.java From xsemantics with Eclipse Public License 1.0 | 4 votes |
protected void error(ValidationMessageAcceptor validationMessageAcceptor, String message, EObject source, EStructuralFeature feature, String code, String... issueData) { validationMessageAcceptor.acceptError(message, source, feature, ValidationMessageAcceptor.INSIGNIFICANT_INDEX, code, issueData); }