Class MarkerUtilities


  • public final class MarkerUtilities
    extends java.lang.Object
    Utility class for accessing marker attributes. The static methods provided on this class provide internal exception handling (unexpected CoreExceptions are logged to workbench).

    This class provides static methods only; it is not intended to be instantiated or subclassed by clients.

    Restriction:
    This class is not intended to be instantiated by clients.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void createMarker​(IResource resource, java.util.Map<java.lang.String,​java.lang.Object> attributes, java.lang.String markerType)
      Creates a marker on the given resource with the given type and attributes.
      static int getCharEnd​(IMarker marker)
      Returns the ending character offset of the given marker.
      static int getCharStart​(IMarker marker)
      Returns the starting character offset of the given marker.
      static int getLineNumber​(IMarker marker)
      Returns the line number of the given marker.
      static java.lang.String getMarkerType​(IMarker marker)
      Returns the marker type of the given marker or null if the type could not be determined.
      static java.lang.String getMessage​(IMarker marker)
      Returns the message associated with the given marker.
      static int getPriority​(IMarker marker)
      Returns the priority of the given marker.
      static int getSeverity​(IMarker marker)
      Returns the severity of the given marker.
      static java.lang.String[] getSuperTypes​(java.lang.String markerType)
      Returns the list of super types for the given marker.
      static boolean isMarkerType​(IMarker marker, java.lang.String type)
      Returns whether the given marker is of the given type (either directly or indirectly).
      static void setCharEnd​(java.util.Map<java.lang.String,​java.lang.Object> map, int charEnd)
      Sets the ending character offset in the given map using the standard marker attribute name as the key.
      static void setCharEnd​(IMarker marker, int charEnd)
      Sets the ending character offset of the given marker.
      static void setCharStart​(java.util.Map<java.lang.String,​java.lang.Object> map, int charStart)
      Sets the starting character offset in the given map using the standard marker attribute name as the key.
      static void setCharStart​(IMarker marker, int charStart)
      Sets the starting character offset of the given marker.
      static void setLineNumber​(java.util.Map<java.lang.String,​java.lang.Object> map, int lineNum)
      Sets the line number in the given map using the standard marker attribute name as the key.
      static void setLineNumber​(IMarker marker, int lineNum)
      Sets the line number of the given marker.
      static void setMessage​(java.util.Map<java.lang.String,​java.lang.Object> map, java.lang.String message)
      Sets the message in the given map using the standard marker attribute name as the key.
      • Methods inherited from class java.lang.Object

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

      • isMarkerType

        public static boolean isMarkerType​(IMarker marker,
                                           java.lang.String type)
        Returns whether the given marker is of the given type (either directly or indirectly).
        Parameters:
        marker - the marker to be checked
        type - the reference type
        Returns:
        trueif maker is an instance of the reference type
      • getMarkerType

        public static java.lang.String getMarkerType​(IMarker marker)
        Returns the marker type of the given marker or null if the type could not be determined.
        Parameters:
        marker - the marker
        Returns:
        the marker type
        Since:
        3.0
      • getMessage

        public static java.lang.String getMessage​(IMarker marker)
        Returns the message associated with the given marker.
        Parameters:
        marker - the marker
        Returns:
        the message associated with the marker or null
        Since:
        3.0
      • setCharEnd

        public static void setCharEnd​(java.util.Map<java.lang.String,​java.lang.Object> map,
                                      int charEnd)
        Sets the ending character offset in the given map using the standard marker attribute name as the key.
        Parameters:
        map - the map
        charEnd - the ending character offset
        See Also:
        IMarker.CHAR_END
      • setCharStart

        public static void setCharStart​(java.util.Map<java.lang.String,​java.lang.Object> map,
                                        int charStart)
        Sets the starting character offset in the given map using the standard marker attribute name as the key.
        Parameters:
        map - the map
        charStart - the starting character offset
        See Also:
        IMarker.CHAR_START
      • setLineNumber

        public static void setLineNumber​(java.util.Map<java.lang.String,​java.lang.Object> map,
                                         int lineNum)
        Sets the line number in the given map using the standard marker attribute name as the key.
        Parameters:
        map - the map
        lineNum - the line number
        See Also:
        IMarker.LINE_NUMBER
      • setMessage

        public static void setMessage​(java.util.Map<java.lang.String,​java.lang.Object> map,
                                      java.lang.String message)
        Sets the message in the given map using the standard marker attribute name as the key.
        Parameters:
        map - the map
        message - the message
        See Also:
        IMarker.MESSAGE
      • createMarker

        public static void createMarker​(IResource resource,
                                        java.util.Map<java.lang.String,​java.lang.Object> attributes,
                                        java.lang.String markerType)
                                 throws CoreException
        Creates a marker on the given resource with the given type and attributes.

        This method modifies the workspace (progress is not reported to the user).

        Parameters:
        resource - the resource
        attributes - the attribute map
        markerType - the type of marker
        Throws:
        CoreException - if this method fails
        See Also:
        IResource.createMarker(java.lang.String)
      • getSuperTypes

        public static java.lang.String[] getSuperTypes​(java.lang.String markerType)
        Returns the list of super types for the given marker. The list is a depth first list and maintains the sequence in which the super types are listed in the marker specification.
        Parameters:
        markerType - the marker's type
        Returns:
        a depth-first list of all super types of the given marker type