Class PropMarker

  • All Implemented Interfaces:
    java.lang.Runnable

    public class PropMarker
    extends java.lang.Object
    implements java.lang.Runnable
    The property marker is a class that holds error/warning/information about a property that is stored in a file.
    Author:
    Christopher Mindus
    • Field Summary

      Fields 
      Modifier and Type Field Description
      java.lang.String childError
      The name of child property in error.
      int index
      Index for property reference error, -1 when not set.
      int length
      The character length of the marker, -1 when not position based.
      java.lang.String location
      The location.
      static java.lang.String MARKER_ATTRIBUTE_CHILD_NAME
      Attribute in Property problem marker for Property Reference to a child name.
      static java.lang.String MARKER_ATTRIBUTE_PROPERTY_INDEX
      Attribute in Property problem marker for Property Reference with an indexed multi-property, assigns an Integer value (equal or greater than zero), otherwise not set.
      static java.lang.String MARKER_ATTRIBUTE_PROPERTY_REFERENCE
      Attribute in Property problem marker for Property Reference.
      static java.lang.String MARKER_ID_PROPERTY
      The Property problem marker ID.
      java.lang.String markerID
      The Eclipse-registered marker ID.
      java.lang.String message
      The message.
      java.lang.String[] quickFixIDs
      Array of registered quick-fixes for the problem (all must be registered in QuickFixer), never null.
      java.lang.String reference
      Property reference of the error, null when not a property error.
      int severity
      Marker severity: IMarker.SEVERITY_ERROR=2, IMarker.SEVERITY_WARNING=1 or IMarker.SEVERITY_INFO=0.
      int start
      The character start position of the marker, -1 when not position based.
    • Constructor Summary

      Constructors 
      Constructor Description
      PropMarker​(PropErrorItemOrigin errorItemOrigin)
      Creates a new property marker for a property error item.
      PropMarker​(java.lang.String markerID, boolean isError, java.lang.String message, int start, int length, java.lang.String... quickFixIDs)
      Creates a new property marker for a property, specialized to text file position, e.g for Java source file.
      PropMarker​(java.lang.String markerID, boolean isError, java.lang.String message, java.lang.String location, java.lang.String... quickFixIDs)
      Creates a new property marker for a property, typically used for general errors.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean createMarker​(org.eclipse.core.resources.IResource resource)
      Creates the marker.
      static void deleteAllMarkers​(org.eclipse.core.resources.IResource resource)
      Removes all markers for a resource directly or in a job if it fails.
      static void deleteAllMarkers​(org.eclipse.core.resources.IResource resource, java.lang.String type, boolean includeSubtypes, int depth, java.lang.Runnable completed)
      Removes all markers for a resource directly or in a job if it fails.
      static void deleteMarkers​(org.eclipse.core.resources.IResource resource, java.lang.String markerID)
      Removes all markers of the iizi Module type and any file errors associated with an attached property.
      void dispose​(org.eclipse.core.resources.IResource resource)
      Disposes of a marker.
      static GProp<?> getProperty​(org.eclipse.core.resources.IMarker marker)
      Gets the property from the reference in the marker.
      static void registerMarker​(java.lang.String markerID, boolean isPersistent)
      Registers a marker for a plug-in.
      void run()
      Performs the adding of the marker in a job.
      void setMultipleTracked()
      Sets the marker state to multiple-create, i.e.
      java.lang.String toString()
      The string representation.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • MARKER_ID_PROPERTY

        public static final java.lang.String MARKER_ID_PROPERTY
        The Property problem marker ID.
        See Also:
        Constant Field Values
      • MARKER_ATTRIBUTE_PROPERTY_REFERENCE

        public static final java.lang.String MARKER_ATTRIBUTE_PROPERTY_REFERENCE
        Attribute in Property problem marker for Property Reference.
        See Also:
        Constant Field Values
      • MARKER_ATTRIBUTE_CHILD_NAME

        public static final java.lang.String MARKER_ATTRIBUTE_CHILD_NAME
        Attribute in Property problem marker for Property Reference to a child name.
        See Also:
        Constant Field Values
      • MARKER_ATTRIBUTE_PROPERTY_INDEX

        public static final java.lang.String MARKER_ATTRIBUTE_PROPERTY_INDEX
        Attribute in Property problem marker for Property Reference with an indexed multi-property, assigns an Integer value (equal or greater than zero), otherwise not set.
        See Also:
        Constant Field Values
      • markerID

        public final java.lang.String markerID
        The Eclipse-registered marker ID.
      • severity

        public final int severity
        Marker severity: IMarker.SEVERITY_ERROR=2, IMarker.SEVERITY_WARNING=1 or IMarker.SEVERITY_INFO=0.
      • message

        public final java.lang.String message
        The message.
      • location

        public final java.lang.String location
        The location.
      • reference

        public final java.lang.String reference
        Property reference of the error, null when not a property error.
      • index

        public final int index
        Index for property reference error, -1 when not set.
      • start

        public final int start
        The character start position of the marker, -1 when not position based.
      • length

        public final int length
        The character length of the marker, -1 when not position based.
      • quickFixIDs

        public final java.lang.String[] quickFixIDs
        Array of registered quick-fixes for the problem (all must be registered in QuickFixer), never null.
      • childError

        public final java.lang.String childError
        The name of child property in error.
    • Constructor Detail

      • PropMarker

        public PropMarker​(java.lang.String markerID,
                          boolean isError,
                          java.lang.String message,
                          java.lang.String location,
                          java.lang.String... quickFixIDs)
        Creates a new property marker for a property, typically used for general errors.
        Parameters:
        markerID - The Eclipse-registered marker ID.
        isError - Flag for error, false = warning.
        message - The message.
        location - The location.
        quickFixIDs - List of registered quick-fixes for the problem (all must be registered in QuickFixer)-
      • PropMarker

        public PropMarker​(java.lang.String markerID,
                          boolean isError,
                          java.lang.String message,
                          int start,
                          int length,
                          java.lang.String... quickFixIDs)
        Creates a new property marker for a property, specialized to text file position, e.g for Java source file.
        Parameters:
        markerID - The Eclipse-registered marker ID.
        isError - Flag for error, false = warning.
        message - The message.
        start - The (character) start location in the file.
        length - The length of the marker.
        quickFixIDs - List of registered quick-fixes for the problem (all must be registered in QuickFixer)-
      • PropMarker

        public PropMarker​(PropErrorItemOrigin errorItemOrigin)
        Creates a new property marker for a property error item.
        Parameters:
        errorItemOrigin - The error item including origin.
    • Method Detail

      • getProperty

        public static GProp<?> getProperty​(org.eclipse.core.resources.IMarker marker)
        Gets the property from the reference in the marker.
      • registerMarker

        public static void registerMarker​(java.lang.String markerID,
                                          boolean isPersistent)
        Registers a marker for a plug-in.
      • deleteMarkers

        public static void deleteMarkers​(org.eclipse.core.resources.IResource resource,
                                         java.lang.String markerID)
                                  throws org.eclipse.core.runtime.CoreException
        Removes all markers of the iizi Module type and any file errors associated with an attached property.
        Parameters:
        resource - The resource.
        markerID - The marker ID to remove or null for all.
        Throws:
        org.eclipse.core.runtime.CoreException - If a marker cannot be deleted.
      • deleteAllMarkers

        public static void deleteAllMarkers​(org.eclipse.core.resources.IResource resource)
        Removes all markers for a resource directly or in a job if it fails.
        Parameters:
        resource - The resource.
      • deleteAllMarkers

        public static void deleteAllMarkers​(org.eclipse.core.resources.IResource resource,
                                            java.lang.String type,
                                            boolean includeSubtypes,
                                            int depth,
                                            java.lang.Runnable completed)
        Removes all markers for a resource directly or in a job if it fails.
        Parameters:
        resource - The resource.
        type - The type of marker to consider, or null to indicate all types.
        includeSubtypes - Whether or not to consider sub-types of the given type.
        depth - How far to recurse (see IResource.DEPTH_* ).
        completed - A runnable that is called when it completes, null for none.
      • setMultipleTracked

        public void setMultipleTracked()
        Sets the marker state to multiple-create, i.e. the marker ID can be used several times for the marker, and that the marker creation will be tracked.
      • createMarker

        public boolean createMarker​(org.eclipse.core.resources.IResource resource)
        Creates the marker.
        Returns:
        false if the marker cannot be created due to resource inaccessibility, true otherwise.
      • run

        public void run()
        Performs the adding of the marker in a job.
        Specified by:
        run in interface java.lang.Runnable
      • dispose

        public void dispose​(org.eclipse.core.resources.IResource resource)
        Disposes of a marker.
        Parameters:
        resource - The resource, or null for no marker removal on the resource.
      • toString

        public java.lang.String toString()
        The string representation.
        Overrides:
        toString in class java.lang.Object