Interface IMarkerManagerV2

All Superinterfaces:
IManagedService
All Known Implementing Classes:
MarkerManagerV2

public interface IMarkerManagerV2 extends IManagedService
Version 2 of the marker manager.

The main difference of this service from IMarkerManager is that this service provides 'eventually consistent' API, i.e. some changes made with some methods of this service may not be immediately 'visible' for reading. Another difference is that this service provides a richer marker access API.

This service operates on the same markers as IMarkerManager. In fact, IMarkerManager is just a facade for this service, its methods redirect to the methods of this service.

This service is thread-safe, but some methods may not behave in a consistent manner if used concurrently with the same arguments. See the individual methods' javadocs for more information about possible inconsistencies.

Methods may throw MarkerException.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The name of the marker manager as managed service.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Adds general update listener.
    void
    commit(Collection<org.eclipse.core.resources.IProject> projects)
    Makes sure any uncommitted changes to the given project's markers are committed and visible for readers.
    createReader(Collection<org.eclipse.core.resources.IProject> projects)
    Creates a normal (not all-markers) reader for the given projects.
    createReader(Collection<org.eclipse.core.resources.IProject> projects, boolean allMarkers)
    Returns a new marker reader, which represents the current state of markers.
    createReader(org.eclipse.core.resources.IProject project)
    Creates a normal (not all-markers) reader for the given project.
    void
    executeCrashProcessTask(org.eclipse.core.resources.IProject project, ICrashProcessTask task)
    Executes a crash processing task on the given project.
    Returns all indexes registered in this marker manager.
    void
    reindex(org.eclipse.core.resources.IProject project, Object objectId, org.eclipse.core.runtime.IProgressMonitor monitor)
    Updates the indexes of markers of the given object of the specified project by calling MarkerIndex.getValue(Marker) for each index on each of the markers and saving the results.
    void
    reindex(org.eclipse.core.resources.IProject project, org.eclipse.core.runtime.IProgressMonitor monitor)
    Updates indexes of markers of the specified project by calling MarkerIndex.getValue(Marker) for each index on each of the project's markers and saving the results.
    void
    reindex(org.eclipse.core.resources.IProject project, org.eclipse.core.runtime.IProgressMonitor monitor, Collection<Object> objectIds, Function<IMarkerReader,Iterable<Object>> objectIdsSupplier)
    Schedules the update of the indexes of markers that comply with the given filters (if any) by calling MarkerIndex.getValue(Marker) for each index on each of the markers and saving the results.
    void
    removeContainmentMarkers(IDtProject dtProject, Long topObjectId, Set<Long> removedContainmentIds)
    Removes markers associated with the given containment object IDs of the given top object.
    void
    Removes general update listener.
    void
    removeMarkers(org.eclipse.core.resources.IProject project, Object objectId)
    Removes markers for the specified objectId associated with the given project.
    void
    removeMarkers(org.eclipse.core.resources.IProject project, Object objectId, long sourceObjectId, String checkId)
    Removes markers for the specified objectId, checkId and sourceObjectId associated with the given project.
    void
    removeMarkersByCheckId(org.eclipse.core.resources.IProject project, String checkId)
    Removes all markers generated by the provided check for all applicable target objects.
    void
    setMarkers(org.eclipse.core.resources.IProject project, MarkerUpdateBatch markerUpdateBatch)
    Sets all markers from the given batch.
    void
    setMarkers(org.eclipse.core.resources.IProject project, Object objectId, Marker[] markers)
    Sets markers for the specified objectId associated with the given project.
    void
    updateSeverity(org.eclipse.core.resources.IProject project, String checkId, MarkerSeverity newSeverity)
    Updates severity of markers generated by the provided checkId, if any

    Methods inherited from interface com._1c.g5.wiring.IManagedService

    activate, deactivate
  • Field Details

  • Method Details

    • addListener

      void addListener(IMarkerUpdateListener listener)
      Adds general update listener.

      Listeners are always called after commit.

      Parameters:
      listener - the listener to add, cannot be null.
    • removeListener

      void removeListener(IMarkerUpdateListener listener)
      Removes general update listener.
      Parameters:
      listener - the listener to remove, cannot be null.
    • getRegisteredIndexes

      Set<MarkerIndex> getRegisteredIndexes(MarkerIndex.Activity activity)
      Returns all indexes registered in this marker manager.
      Parameters:
      activity - activity the index is involved in. Cannot be null.
      Returns:
      all indexes registered in this marker manager. Never null.
    • setMarkers

      void setMarkers(org.eclipse.core.resources.IProject project, Object objectId, Marker[] markers)
      Sets markers for the specified objectId associated with the given project.

      If the specified objectId is of Long type then it is supposed that markers array contains all markers including contained objects.

      If some markers already exist for the specified objectId they will be replaced by a new ones.
      If the given markers array is null or empty, the existing markers for the specified objectId will be removed.

      This method removes (and replaces with the new ones if markers is not null) the following markers:

      1. All markers of the object with the given objectId.
      2. All markers of the objects for which the object with given objectId is the top object.
      Markers, for which the object with the given objectId is the source object, are not removed. If you need to remove those as well, call removeMarkers(IProject, Object).

      Caution! If two threads call this at the same time with the same project and objectId, but different markers, it's not defined which markers are actually stored. Do not do this.

      Changes made by this method may not be immediately visible by marker accessing methods or readers. See commit(Collection) for details.

      Parameters:
      project - the project, cannot be null.
      objectId - the object identifier. It can be of type String or Long only. The identifier cannot be null.
      markers - the array of markers.
    • setMarkers

      void setMarkers(org.eclipse.core.resources.IProject project, MarkerUpdateBatch markerUpdateBatch)
      Sets all markers from the given batch.

      Changes made by this method may not be immediately visible by marker accessing methods or readers. See commit(Collection) for details.

      Parameters:
      project - the project, cannot be null.
      markerUpdateBatch - the markers' batch. See MarkerUpdateBatch for more info. Cannot be null.
    • removeMarkers

      void removeMarkers(org.eclipse.core.resources.IProject project, Object objectId)
      Removes markers for the specified objectId associated with the given project. The removal automatically cleans all markers that were created for this object as well as all markers that were created in association with this object (e.g. context of checks, etc)

      This method removes the following markers:

      1. All markers of the object with the given objectId.
      2. All markers of the objects for which the object with given objectId is the top object.
      3. All markers of the objects for which the object with given objectId is the source object.
      4. All markers of the objects for which the object with given objectId is the top object of their source object.

      Changes made by this method may not be immediately visible by marker accessing methods or readers. See commit(Collection) for details.

      Parameters:
      project - the project, cannot be null.
      objectId - the object identifier. It can be of type String or Long only. The identifier cannot be null.
    • removeMarkers

      void removeMarkers(org.eclipse.core.resources.IProject project, Object objectId, long sourceObjectId, String checkId)
      Removes markers for the specified objectId, checkId and sourceObjectId associated with the given project.

      This method is equivalent to call setMarkers(project, objectId, sourceObjectId, null);. See that method's documentation for the details.

      Changes made by this method may not be immediately visible by marker accessing methods or readers. See commit(Collection) for details.

      Parameters:
      project - the project, cannot be null.
      objectId - the object identifier. It can be of type String or Long only. The identifier cannot be null.
      sourceObjectId - The identifier of the source object which validation resulted in those markers. Used to clear previous markers being generated for the same source. Use -1 to specify situations when no identifiable source object is present (e.g. module markers, etc) and markers should be removed completelly
      checkId - the checkId, cannot be null.
      See Also:
    • removeMarkersByCheckId

      void removeMarkersByCheckId(org.eclipse.core.resources.IProject project, String checkId)
      Removes all markers generated by the provided check for all applicable target objects.

      Changes made by this method may not be immediately visible by marker accessing methods or readers. See commit(Collection) for details.

      Parameters:
      project - The project to update markers for. May not be null
      checkId - The check identifier. May not be null
    • updateSeverity

      void updateSeverity(org.eclipse.core.resources.IProject project, String checkId, MarkerSeverity newSeverity)
      Updates severity of markers generated by the provided checkId, if any

      Changes made by this method may not be immediately visible by marker accessing methods or readers. See commit(Collection) for details.

      Parameters:
      project - The project to update markers for. May not be null
      checkId - The check identifier. May not be null
      newSeverity - New severity to set. May not be null
    • removeContainmentMarkers

      void removeContainmentMarkers(IDtProject dtProject, Long topObjectId, Set<Long> removedContainmentIds)
      Removes markers associated with the given containment object IDs of the given top object. Also removes markers, for which source object ID is set to one of the given containment object IDs.

      Only model containments are supported (that's for sure). Only model top object id is supported (as this call is only for the model changes).

      Changes made by this method may not be immediately visible by marker accessing methods or readers. See commit(Collection) for details.

      Parameters:
      dtProject - project, cannot be null.
      topObjectId - top object ID, cannot be null.
      removedContainmentIds - containment object IDs, cannot be null.
    • reindex

      void reindex(org.eclipse.core.resources.IProject project, org.eclipse.core.runtime.IProgressMonitor monitor)
      Updates indexes of markers of the specified project by calling MarkerIndex.getValue(Marker) for each index on each of the project's markers and saving the results.

      If the project is unknown, or the marker manager is not initialized yet, nothing will happen.

      This method blocks and may take a long time.

      This method is atomic: either all markers, which existed when it started, are reindexed, or none. If new markers are added concurrently while this method is working, they will not be reindexed. This is OK, because for newly added markers MarkerIndex.getValue(Marker) is called upon adding them, so reindex is not needed.

      This method doesn't take global filters into account and reindexes all markers of the given project.

      Changes made by this method may not be immediately visible by marker accessing methods or readers. See commit(Collection) for details.

      Parameters:
      project - project to update, cannot be null.
      monitor - progress monitor, may be null.
    • reindex

      void reindex(org.eclipse.core.resources.IProject project, Object objectId, org.eclipse.core.runtime.IProgressMonitor monitor)
      Updates the indexes of markers of the given object of the specified project by calling MarkerIndex.getValue(Marker) for each index on each of the markers and saving the results.

      If the project is unknown, the marker manager is not initialized yet, the object not found or doesn't have any markers, nothing will happen.

      This method blocks and may take a long time.

      This method is atomic: either all affected markers, which existed when it started, are reindexed, or none. If new markers of this object are added concurrently while this method is working, they will not be reindexed. This is OK, because for newly added markers MarkerIndex.getValue(Marker) is called upon adding them, so reindex is not needed.

      This method doesn't take global filters into account and reindexes all object markers.

      Changes made by this method may not be immediately visible by marker accessing methods or readers. See commit(Collection) for details.

      Parameters:
      project - project to update, cannot be null.
      objectId - ID of the object to be reindexed. For BM objects, this needs to be the top object ID. Cannot be null.
      monitor - progress monitor, may be null.
    • reindex

      void reindex(org.eclipse.core.resources.IProject project, org.eclipse.core.runtime.IProgressMonitor monitor, Collection<Object> objectIds, Function<IMarkerReader,Iterable<Object>> objectIdsSupplier)
      Schedules the update of the indexes of markers that comply with the given filters (if any) by calling MarkerIndex.getValue(Marker) for each index on each of the markers and saving the results.

      If the project is unknown, the marker manager is not initialized yet, the objects are not found or don't have any markers, nothing will happen.

      This method blocks and may take a long time.

      This method doesn't take global filters into account and reindexes all object markers.

      Parameters:
      project - project to update, cannot be null.
      monitor - progress monitor, may be null.
      objectIds - object IDs to reindex. If not empty, these objects will be reindexed in addition to those supplied by objectIdsSupplier. If null or empty, and objectIdsSupplier is null, the whole project will be reindexed.
      objectIdsSupplier - supplier of additional object IDs for reindexing. These objects will be reindexed along with the given objectIds (if any). May be null, in which case only the given objectIds will be reindexed. If those are null or empty as well, the whole project will be reindexed. If the supplier returns empty iterable and objectIds is null or empty, nothing will be reindexed.
    • commit

      void commit(Collection<org.eclipse.core.resources.IProject> projects)
      Makes sure any uncommitted changes to the given project's markers are committed and visible for readers.

      This method blocks and may take a long time.

      Do not call this method unless there is a special need for it. Normally, marker manager periodically commits by itself, and this should cover most cases. This method's primary use is when you need to make changes and then immediately access the changed markers. This should be a rare occasion outside of unit or integration tests.

      Parameters:
      projects - projects to commit. If null or empty, commits all projects.
    • executeCrashProcessTask

      void executeCrashProcessTask(org.eclipse.core.resources.IProject project, ICrashProcessTask task)
      Executes a crash processing task on the given project. The relevant ICrashProcessTask.ICrashInfo about this project will be provided to the task's ICrashProcessTask.process(ICrashInfo, IBmTransaction, IProgressMonitor) method. If that method finishes successfully and returns true, the crash is resolved, and subsequent calls of this method for the same project will call their tasks on empty ICrashProcessTask.ICrashInfo.
      Parameters:
      project - project to process, never null.
      task - task to execute, never null.
    • createReader

      IMarkerReader createReader(Collection<org.eclipse.core.resources.IProject> projects, boolean allMarkers)
      Returns a new marker reader, which represents the current state of markers. Only committed marker changes are visible to the reader. Uncommitted changes and changes made after the reader is created may not visible to the reader.
      Parameters:
      projects - projects the reader will have access to. If null or empty, all projects will be included.
      allMarkers - whether the reader should have access to all markers (ignoring the global filters) or not.
      Returns:
      a new marker reader, never null.
    • createReader

      default IMarkerReader createReader(Collection<org.eclipse.core.resources.IProject> projects)
      Creates a normal (not all-markers) reader for the given projects.
      Parameters:
      projects - projects the reader will have access to. If null or empty, all projects will be included.
      Returns:
      a new marker reader, never null.
    • createReader

      default IMarkerReader createReader(org.eclipse.core.resources.IProject project)
      Creates a normal (not all-markers) reader for the given project.
      Parameters:
      project - projects the reader will have access to. If null, all projects will be included.
      Returns:
      a new marker reader, never null.