Class LogMessageReceiver

  • All Implemented Interfaces:
    IMessageReceiver

    public class LogMessageReceiver
    extends MessageReceiver
    A simple fallback receiver that does not store messages.
    Author:
    Holger Eichelberger
    • Constructor Summary

      Constructors 
      Constructor Description
      LogMessageReceiver​(java.lang.Class<?> origin, java.lang.String bundleName)
      Creates a log message receiver.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void collect​(IMessage message, org.eclipse.emf.ecore.EObject cause, org.eclipse.emf.ecore.EStructuralFeature causeFeature, int code)
      Receives an EASy message.
      void error​(java.lang.String message, org.eclipse.emf.ecore.EObject cause, org.eclipse.emf.ecore.EStructuralFeature causeFeature, int code)
      Receives an error message.
      void error​(org.eclipse.emf.ecore.resource.Resource.Diagnostic diagnostic)
      Adds a diagnostic error, typically from a standalone parser configuration.
      int getErrorCount()
      Returns the number of errors.
      private java.lang.String getLocation​(org.eclipse.emf.ecore.resource.Resource.Diagnostic diagnostic)
      Returns the location of diagnostic taking the location hint as fallback.
      Message getMessage​(int index)
      Returns the specified message.
      int getMessageCount()
      Returns the number of messages.
      void setLocationHint​(org.eclipse.emf.common.util.URI locationHint)
      Defines a location hint in case that diagnostics do not carry this information.
      void warning​(java.lang.String message, org.eclipse.emf.ecore.EObject cause, org.eclipse.emf.ecore.EStructuralFeature causeFeature, int code)
      Receives a warning message.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • LogMessageReceiver

        public LogMessageReceiver​(java.lang.Class<?> origin,
                                  java.lang.String bundleName)
        Creates a log message receiver.
        Parameters:
        origin - the origin where the messages shall be reported for
        bundleName - the bundle name (may be null)
    • Method Detail

      • error

        public void error​(java.lang.String message,
                          org.eclipse.emf.ecore.EObject cause,
                          org.eclipse.emf.ecore.EStructuralFeature causeFeature,
                          int code)
        Description copied from interface: IMessageReceiver
        Receives an error message.
        Parameters:
        message - the message
        cause - the cause (as instance of the EMF grammar model)
        causeFeature - the cause of the feature as an appropriate constant from IvmlPackage.Literals
        code - a numerical identification of the error
      • warning

        public void warning​(java.lang.String message,
                            org.eclipse.emf.ecore.EObject cause,
                            org.eclipse.emf.ecore.EStructuralFeature causeFeature,
                            int code)
        Description copied from interface: IMessageReceiver
        Receives a warning message.
        Parameters:
        message - the message
        cause - the cause (as instance of the EMF grammar model)
        causeFeature - the cause of the feature as an appropriate constant from IvmlPackage.Literals
        code - a numerical identification of the warning
      • collect

        public void collect​(IMessage message,
                            org.eclipse.emf.ecore.EObject cause,
                            org.eclipse.emf.ecore.EStructuralFeature causeFeature,
                            int code)
        Description copied from interface: IMessageReceiver
        Receives an EASy message. This allows re-directing the message while keeping the relation to the original one, e.g., for cleaning up messages.
        Parameters:
        message - the message
        cause - the cause (as instance of the EMF grammar model)
        causeFeature - the cause of the feature as an appropriate constant from IvmlPackage.Literals
        code - a numerical identification of the error
      • getMessage

        public Message getMessage​(int index)
        Description copied from class: MessageReceiver
        Returns the specified message.
        Specified by:
        getMessage in class MessageReceiver
        Parameters:
        index - the position of the message to be returned
        Returns:
        the specified message
      • error

        public void error​(org.eclipse.emf.ecore.resource.Resource.Diagnostic diagnostic)
        Description copied from class: MessageReceiver
        Adds a diagnostic error, typically from a standalone parser configuration.
        Specified by:
        error in class MessageReceiver
        Parameters:
        diagnostic - the diagnostic to be added
      • getLocation

        private java.lang.String getLocation​(org.eclipse.emf.ecore.resource.Resource.Diagnostic diagnostic)
        Returns the location of diagnostic taking the location hint as fallback.
        Parameters:
        diagnostic - the diagnostic (may be null)
        Returns:
        the location
      • setLocationHint

        public void setLocationHint​(org.eclipse.emf.common.util.URI locationHint)
        Defines a location hint in case that diagnostics do not carry this information. Reset if not used.
        Parameters:
        locationHint - the location hint, may be null for none