Class CustomValidationMessageAcceptor

  • All Implemented Interfaces:
    org.eclipse.xtext.validation.ValidationMessageAcceptor

    public class CustomValidationMessageAcceptor
    extends Object
    implements org.eclipse.xtext.validation.ValidationMessageAcceptor
    Implementation of ValidationMessageAcceptor for creating validation diagnostics for Bsl language. This class has some useful methods for creating validation diagnostics by language model object and its EStructuralFeature
    • Field Summary

      • Fields inherited from interface org.eclipse.xtext.validation.ValidationMessageAcceptor

        INSIGNIFICANT_INDEX
    • Constructor Summary

      Constructors 
      Constructor Description
      CustomValidationMessageAcceptor​(org.eclipse.emf.common.util.DiagnosticChain diagnostic, org.eclipse.xtext.validation.CheckType checkType)
      Constructor
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void acceptError​(String message, org.eclipse.emf.ecore.EObject object, int offset, int length, String code, String... issueData)  
      void acceptError​(String message, org.eclipse.emf.ecore.EObject object, org.eclipse.emf.ecore.EStructuralFeature feature, int index, String code, String... issueData)  
      void acceptInfo​(String message, org.eclipse.emf.ecore.EObject object, int offset, int length, String code, String... issueData)  
      void acceptInfo​(String message, org.eclipse.emf.ecore.EObject object, org.eclipse.emf.ecore.EStructuralFeature feature, int index, String code, String... issueData)  
      void acceptWarning​(String message, org.eclipse.emf.ecore.EObject object, int offset, int length, String code, String... issueData)  
      void acceptWarning​(String message, org.eclipse.emf.ecore.EObject object, org.eclipse.emf.ecore.EStructuralFeature feature, int index, String code, String... issueData)  
      protected org.eclipse.emf.common.util.Diagnostic createDiagnostic​(org.eclipse.xtext.diagnostics.Severity severity, String message, org.eclipse.emf.ecore.EObject object, int offset, int length, String code, String... issueData)
      Creates Diagnostic by model object
      protected org.eclipse.emf.common.util.Diagnostic createDiagnostic​(org.eclipse.xtext.diagnostics.Severity severity, String message, org.eclipse.emf.ecore.EObject object, org.eclipse.emf.ecore.EStructuralFeature feature, int index, String code, String... issueData)
      Creates Diagnostic by model object and its EStructuralFeature
      void error​(String message, org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EStructuralFeature feature)
      Creates error diagnostic with message for value corresponding to feature of object source
      void error​(String message, org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EStructuralFeature feature, int index)
      Creates error diagnostic with message for value corresponding to feature of object source
      void error​(String message, org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EStructuralFeature feature, int index, String code, String... issueData)
      Creates error diagnostic with message for value corresponding to feature of object source
      void error​(String message, org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EStructuralFeature feature, String code, String... issueData)
      Creates error diagnostic with message for value corresponding to feature of object source
      void info​(String message, org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EStructuralFeature feature)
      Creates information diagnostic with message for value corresponding to feature of object source
      void info​(String message, org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EStructuralFeature feature, int index)
      Creates information diagnostic with message for value corresponding to feature of object source
      void info​(String message, org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EStructuralFeature feature, int index, String code, String... issueData)
      Creates information diagnostic with message for value corresponding to feature of object source
      protected int toDiagnosticSeverity​(org.eclipse.xtext.diagnostics.Severity severity)
      Returns code of validation diagnostic by Severity
      void warning​(String message, org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EStructuralFeature feature)
      Creates warning diagnostic with message for value corresponding to feature of object source
      void warning​(String message, org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EStructuralFeature feature, int index)
      Creates warning diagnostic with message for value corresponding to feature of object source
      void warning​(String message, org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EStructuralFeature feature, int index, String code, String... issueData)
      Creates warning diagnostic with message for value corresponding to feature of object source
      void warning​(String message, org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EStructuralFeature feature, String code, String... issueData)
      Creates warning diagnostic with message for value corresponding to feature of object source
    • Constructor Detail

      • CustomValidationMessageAcceptor

        public CustomValidationMessageAcceptor​(org.eclipse.emf.common.util.DiagnosticChain diagnostic,
                                               org.eclipse.xtext.validation.CheckType checkType)
        Constructor
        Parameters:
        diagnostic - accumulator of validation diagnostics. All of creating diagnostic will be added to it. Can't be null
        checkType - actual validation type, can't be null
    • Method Detail

      • acceptError

        public void acceptError​(String message,
                                org.eclipse.emf.ecore.EObject object,
                                int offset,
                                int length,
                                String code,
                                String... issueData)
        Specified by:
        acceptError in interface org.eclipse.xtext.validation.ValidationMessageAcceptor
      • acceptWarning

        public void acceptWarning​(String message,
                                  org.eclipse.emf.ecore.EObject object,
                                  org.eclipse.emf.ecore.EStructuralFeature feature,
                                  int index,
                                  String code,
                                  String... issueData)
        Specified by:
        acceptWarning in interface org.eclipse.xtext.validation.ValidationMessageAcceptor
      • acceptInfo

        public void acceptInfo​(String message,
                               org.eclipse.emf.ecore.EObject object,
                               org.eclipse.emf.ecore.EStructuralFeature feature,
                               int index,
                               String code,
                               String... issueData)
        Specified by:
        acceptInfo in interface org.eclipse.xtext.validation.ValidationMessageAcceptor
      • acceptError

        public void acceptError​(String message,
                                org.eclipse.emf.ecore.EObject object,
                                org.eclipse.emf.ecore.EStructuralFeature feature,
                                int index,
                                String code,
                                String... issueData)
        Specified by:
        acceptError in interface org.eclipse.xtext.validation.ValidationMessageAcceptor
      • acceptWarning

        public void acceptWarning​(String message,
                                  org.eclipse.emf.ecore.EObject object,
                                  int offset,
                                  int length,
                                  String code,
                                  String... issueData)
        Specified by:
        acceptWarning in interface org.eclipse.xtext.validation.ValidationMessageAcceptor
      • acceptInfo

        public void acceptInfo​(String message,
                               org.eclipse.emf.ecore.EObject object,
                               int offset,
                               int length,
                               String code,
                               String... issueData)
        Specified by:
        acceptInfo in interface org.eclipse.xtext.validation.ValidationMessageAcceptor
      • info

        public void info​(String message,
                         org.eclipse.emf.ecore.EObject source,
                         org.eclipse.emf.ecore.EStructuralFeature feature)
        Creates information diagnostic with message for value corresponding to feature of object source
        Parameters:
        message - diagnostic message, can't be null
        source - model object each value corresponding to feature will be annotated, can'be null
        feature - feature of the object source. Value corresponding for it will be annotated, can'be null
      • info

        public void info​(String message,
                         org.eclipse.emf.ecore.EObject source,
                         org.eclipse.emf.ecore.EStructuralFeature feature,
                         int index)
        Creates information diagnostic with message for value corresponding to feature of object source
        Parameters:
        message - diagnostic message, can't be null
        source - model object each value corresponding to feature will be annotated, can'be null
        feature - feature of the object source. Value corresponding for it will be annotated, can'be null
        index - index of annotating object in collection of values corresponding to feature. Default value is -1
      • info

        public void info​(String message,
                         org.eclipse.emf.ecore.EObject source,
                         org.eclipse.emf.ecore.EStructuralFeature feature,
                         int index,
                         String code,
                         String... issueData)
        Creates information diagnostic with message for value corresponding to feature of object source
        Parameters:
        message - diagnostic message, can't be null
        source - model object each value corresponding to feature will be annotated, can'be null
        feature - feature of the object source. Value corresponding for it will be annotated, can'be null
        index - index of annotating object in collection of values corresponding to feature. Default value is -1
        code - error code corresponding to creating diagnostic. This code can be used for creating quick fixes, can be null
        issueData - additional data attaching to diagnostic, can't be null
      • warning

        public void warning​(String message,
                            org.eclipse.emf.ecore.EObject source,
                            org.eclipse.emf.ecore.EStructuralFeature feature)
        Creates warning diagnostic with message for value corresponding to feature of object source
        Parameters:
        message - diagnostic message, can't be null
        source - model object each value corresponding to feature will be annotated, can'be null
        feature - feature of the object source. Value corresponding for it will be annotated, can'be null
      • warning

        public void warning​(String message,
                            org.eclipse.emf.ecore.EObject source,
                            org.eclipse.emf.ecore.EStructuralFeature feature,
                            int index)
        Creates warning diagnostic with message for value corresponding to feature of object source
        Parameters:
        message - diagnostic message, can't be null
        source - model object each value corresponding to feature will be annotated, can'be null
        feature - feature of the object source. Value corresponding for it will be annotated, can'be null
        index - index of annotating object in collection of values corresponding to feature. Default value is -1
      • warning

        public void warning​(String message,
                            org.eclipse.emf.ecore.EObject source,
                            org.eclipse.emf.ecore.EStructuralFeature feature,
                            int index,
                            String code,
                            String... issueData)
        Creates warning diagnostic with message for value corresponding to feature of object source
        Parameters:
        message - diagnostic message, can't be null
        source - model object each value corresponding to feature will be annotated, can'be null
        feature - feature of the object source. Value corresponding for it will be annotated, can'be null
        index - index of annotating object in collection of values corresponding to feature. Default value is -1
        code - error code corresponding to creating diagnostic. This code can be used for creating quick fixes, can be null
        issueData - additional data attaching to diagnostic, can't be null
      • warning

        public void warning​(String message,
                            org.eclipse.emf.ecore.EObject source,
                            org.eclipse.emf.ecore.EStructuralFeature feature,
                            String code,
                            String... issueData)
        Creates warning diagnostic with message for value corresponding to feature of object source
        Parameters:
        message - diagnostic message, can't be null
        source - model object each value corresponding to feature will be annotated, can'be null
        feature - feature of the object source. Value corresponding for it will be annotated, can'be null
        code - error code corresponding to creating diagnostic. This code can be used for creating quick fixes, can be null
        issueData - additional data attaching to diagnostic, can't be null
      • error

        public void error​(String message,
                          org.eclipse.emf.ecore.EObject source,
                          org.eclipse.emf.ecore.EStructuralFeature feature)
        Creates error diagnostic with message for value corresponding to feature of object source
        Parameters:
        message - diagnostic message, can't be null
        source - model object each value corresponding to feature will be annotated, can'be null
        feature - feature of the object source. Value corresponding for it will be annotated, can'be null
      • error

        public void error​(String message,
                          org.eclipse.emf.ecore.EObject source,
                          org.eclipse.emf.ecore.EStructuralFeature feature,
                          int index)
        Creates error diagnostic with message for value corresponding to feature of object source
        Parameters:
        message - diagnostic message, can't be null
        source - model object each value corresponding to feature will be annotated, can'be null
        feature - feature of the object source. Value corresponding for it will be annotated, can'be null
        index - index of annotating object in collection of values corresponding to feature. Default value is -1
      • error

        public void error​(String message,
                          org.eclipse.emf.ecore.EObject source,
                          org.eclipse.emf.ecore.EStructuralFeature feature,
                          String code,
                          String... issueData)
        Creates error diagnostic with message for value corresponding to feature of object source
        Parameters:
        message - diagnostic message, can't be null
        source - model object each value corresponding to feature will be annotated, can'be null
        feature - feature of the object source. Value corresponding for it will be annotated, can'be null
        code - error code corresponding to creating diagnostic. This code can be used for creating quick fixes, can be null
        issueData - additional data attaching to diagnostic, can't be null
      • error

        public void error​(String message,
                          org.eclipse.emf.ecore.EObject source,
                          org.eclipse.emf.ecore.EStructuralFeature feature,
                          int index,
                          String code,
                          String... issueData)
        Creates error diagnostic with message for value corresponding to feature of object source
        Parameters:
        message - diagnostic message, can't be null
        source - model object each value corresponding to feature will be annotated, can'be null
        feature - feature of the object source. Value corresponding for it will be annotated, can'be null
        index - index of annotating object in collection of values corresponding to feature. Default value is -1
        code - error code corresponding to creating diagnostic. This code can be used for creating quick fixes, can be null
        issueData - additional data attaching to diagnostic, can't be null
      • createDiagnostic

        protected org.eclipse.emf.common.util.Diagnostic createDiagnostic​(org.eclipse.xtext.diagnostics.Severity severity,
                                                                          String message,
                                                                          org.eclipse.emf.ecore.EObject object,
                                                                          int offset,
                                                                          int length,
                                                                          String code,
                                                                          String... issueData)
        Creates Diagnostic by model object
        Parameters:
        severity - type of creating diagnostic, can't be null
        message - message of creating diagnostic, can't be null
        object - annotated model object by creating diagnostic, can't be null
        offset - the starting offset of creating diagnostic in annotating resource
        length - the length of creating diagnostic in annotating resource
        code - error code corresponding to creating diagnostic. This code can be used for creating quick fixes, can be null
        issueData - additional data attaching to diagnostic, can't be null
        Returns:
        creating diagnostic, never null
      • createDiagnostic

        protected org.eclipse.emf.common.util.Diagnostic createDiagnostic​(org.eclipse.xtext.diagnostics.Severity severity,
                                                                          String message,
                                                                          org.eclipse.emf.ecore.EObject object,
                                                                          org.eclipse.emf.ecore.EStructuralFeature feature,
                                                                          int index,
                                                                          String code,
                                                                          String... issueData)
        Creates Diagnostic by model object and its EStructuralFeature
        Parameters:
        severity - type of creating diagnostic, can't be null
        message - message of creating diagnostic, can't be null
        object - annotated model object by creating diagnostic, can't be null
        feature - feature of the object source. Value corresponding for it will be annotated, can'be null
        index - index of annotating object in collection of values corresponding to feature. Default value is -1
        code - error code corresponding to creating diagnostic. This code can be used for creating quick fixes, can be null
        issueData - additional data attaching to diagnostic, can't be null
        Returns:
        creating diagnostic, never null
      • toDiagnosticSeverity

        protected int toDiagnosticSeverity​(org.eclipse.xtext.diagnostics.Severity severity)
        Returns code of validation diagnostic by Severity
        Parameters:
        severity - converting Severity to code of validation diagnostic, can't be code>null
        Returns:
        code of validation diagnostic by Severity. Supports only Diagnostic.ERROR, Diagnostic.WARNING, Diagnostic.INFO in other cases IllegalArgumentException will be thrown