Interface IBreakpoint

  • All Superinterfaces:
    IAdaptable
    All Known Subinterfaces:
    ILineBreakpoint, IWatchpoint
    All Known Implementing Classes:
    Breakpoint, LineBreakpoint

    public interface IBreakpoint
    extends IAdaptable
    A breakpoint is capable of suspending the execution of a program at a specific location when a program is running in debug mode. Each breakpoint has an associated marker which stores and persists all attributes associated with a breakpoint.

    A breakpoint is defined in two parts:

    1. By an extension of kind "org.eclipse.debug.core.breakpoints"
    2. By a marker definition that corresponds to the above breakpoint extension

    For example, following is a definition of corresponding breakpoint and breakpoint marker definitions. Note that the markerType attribute defined by the breakpoint extension corresponds to the type of the marker definition.

     <extension point="org.eclipse.debug.core.breakpoints">
       <breakpoint
          id="com.example.Breakpoint"
          class="com.example.Breakpoint"
          markerType="com.example.BreakpointMarker">
       </breakpoint>
     </extension>
     <extension
          point="org.eclipse.core.resources.markers"
          id="com.example.BreakpointMarker"
          name="Example Breakpoint">
       <super type="org.eclipse.debug.core.breakpointMarker"/>
       <attribute name="exampleAttribute"/>
     </extension>
     

    The breakpoint manager instantiates persisted breakpoints by traversing all markers that are a subtype of "org.eclipse.debug.core.breakpointMarker", and instantiating the class defined by the class attribute on the associated breakpoint extension. The method setMarker is then called to associate a marker with the breakpoint.

    Breakpoints may or may not be registered with the breakpoint manager, and are persisted and restored as such. Since marker definitions only allow all or none of a specific marker type to be persisted, breakpoints define a PERSISTED attribute for selective persistence of breakpoints of the same type.

    Since:
    2.0
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static String BREAKPOINT_MARKER
      Root breakpoint marker type (value "org.eclipse.debug.core.breakpointMarker").
      static String ENABLED
      Enabled breakpoint marker attribute (value "org.eclipse.debug.core.enabled").
      static String ID
      Debug model identifier breakpoint marker attribute (value "org.eclipse.debug.core.id").
      static String LINE_BREAKPOINT_MARKER
      Line breakpoint marker type (value "org.eclipse.debug.core.lineBreakpoint").
      static String PERSISTED
      Persisted breakpoint marker attribute (value "org.eclipse.debug.core.persisted").
      static String REGISTERED
      Registered breakpoint marker attribute (value "org.eclipse.debug.core.registered").
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void delete()
      Deletes this breakpoint's underlying marker, and removes this breakpoint from the breakpoint manager.
      IMarker getMarker()
      Returns the marker associated with this breakpoint, or null if no marker is associated with this breakpoint.
      String getModelIdentifier()
      Returns the identifier of the debug model this breakpoint is associated with.
      boolean isEnabled()
      Returns whether this breakpoint is enabled
      boolean isPersisted()
      Returns whether this breakpoint is to be persisted across workspace invocations, or when a project is closed and re-opened.
      boolean isRegistered()
      Returns whether this breakpoint is currently registered with the breakpoint manager.
      void setEnabled​(boolean enabled)
      Sets the enabled state of this breakpoint.
      void setMarker​(IMarker marker)
      Sets the marker associated with this breakpoint.
      void setPersisted​(boolean registered)
      Sets whether this breakpoint is to be persisted across workspace invocations, or when a project is closed and re-opened.
      void setRegistered​(boolean registered)
      Sets whether this breakpoint is currently registered with the breakpoint manager.
    • Field Detail

      • BREAKPOINT_MARKER

        static final String BREAKPOINT_MARKER
        Root breakpoint marker type (value "org.eclipse.debug.core.breakpointMarker").
      • LINE_BREAKPOINT_MARKER

        static final String LINE_BREAKPOINT_MARKER
        Line breakpoint marker type (value "org.eclipse.debug.core.lineBreakpoint").
      • ID

        static final String ID
        Debug model identifier breakpoint marker attribute (value "org.eclipse.debug.core.id"). The attribute is a String corresponding to the identifier of the debug model a breakpoint is associated with.
        See Also:
        Constant Field Values
    • Method Detail

      • delete

        void delete()
             throws CoreException
        Deletes this breakpoint's underlying marker, and removes this breakpoint from the breakpoint manager.
        Throws:
        CoreException - if unable to delete this breakpoint's underlying marker
      • getMarker

        IMarker getMarker()
        Returns the marker associated with this breakpoint, or null if no marker is associated with this breakpoint.
        Returns:
        associated marker, or null if there is no associated marker.
      • setMarker

        void setMarker​(IMarker marker)
                throws CoreException
        Sets the marker associated with this breakpoint. This method is called once at breakpoint creation.
        Parameters:
        marker - the marker to associate with this breakpoint
        Throws:
        CoreException - if an error occurs accessing the marker
      • getModelIdentifier

        String getModelIdentifier()
        Returns the identifier of the debug model this breakpoint is associated with.
        Returns:
        the identifier of the debug model this breakpoint is associated with
      • isEnabled

        boolean isEnabled()
                   throws CoreException
        Returns whether this breakpoint is enabled
        Returns:
        whether this breakpoint is enabled
        Throws:
        CoreException - if unable to access the associated attribute from this breakpoint's underlying marker
      • setEnabled

        void setEnabled​(boolean enabled)
                 throws CoreException
        Sets the enabled state of this breakpoint. This has no effect if the current enabled state is the same as specified by the enabled parameter.
        Parameters:
        enabled - whether this breakpoint should be enabled
        Throws:
        CoreException - if unable to set the associated attribute on this breakpoint's underlying marker.
      • isRegistered

        boolean isRegistered()
                      throws CoreException
        Returns whether this breakpoint is currently registered with the breakpoint manager.
        Returns:
        whether this breakpoint is currently registered with the breakpoint manager
        Throws:
        CoreException - if unable to access the associated attribute on this breakpoint's underlying marker
      • setRegistered

        void setRegistered​(boolean registered)
                    throws CoreException
        Sets whether this breakpoint is currently registered with the breakpoint manager.
        Parameters:
        registered - whether this breakpoint is registered with the breakpoint manager
        Throws:
        CoreException - if unable to set the associated attribute on this breakpoint's underlying marker.
      • isPersisted

        boolean isPersisted()
                     throws CoreException
        Returns whether this breakpoint is to be persisted across workspace invocations, or when a project is closed and re-opened. Since marker definitions only allow all/none of a specific type of marker to be persisted (rather than selected markers of a specific type), breakpoints define this functionality.
        Returns:
        whether this breakpoint is to be persisted
        Throws:
        CoreException - if unable to access the associated attribute on this breakpoint's underlying marker
      • setPersisted

        void setPersisted​(boolean registered)
                   throws CoreException
        Sets whether this breakpoint is to be persisted across workspace invocations, or when a project is closed and re-opened. Has no effect if this breakpoint's marker definition is defined as not persisted. Sets the underlying TRANSIENT attribute on this breakpoint's marker to true.
        Parameters:
        registered - whether this breakpoint is to be persisted across workspace invocations
        Throws:
        CoreException - if unable to set the associated attribute on this breakpoint's underlying marker.