Interface IMarkerManagerV2
- All Superinterfaces:
IManagedService
- All Known Implementing Classes:
MarkerManagerV2
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
FieldsModifier and TypeFieldDescriptionstatic final String
The name of the marker manager as managed service. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addListener
(IMarkerUpdateListener listener) 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.default IMarkerReader
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.default IMarkerReader
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 acrash processing task
on the given project.getRegisteredIndexes
(MarkerIndex.Activity activity) 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 callingMarkerIndex.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 callingMarkerIndex.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 callingMarkerIndex.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
removeListener
(IMarkerUpdateListener listener) Removes general update listener.void
removeMarkers
(org.eclipse.core.resources.IProject project, Object objectId) Removes markers for the specifiedobjectId
associated with the givenproject
.void
removeMarkers
(org.eclipse.core.resources.IProject project, Object objectId, long sourceObjectId, String checkId) Removes markers for the specifiedobjectId, checkId and sourceObjectId
associated with the givenproject
.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 givenbatch
.void
setMarkers
(org.eclipse.core.resources.IProject project, Object objectId, Marker[] markers) Sets markers for the specifiedobjectId
associated with the givenproject
.void
updateSeverity
(org.eclipse.core.resources.IProject project, String checkId, MarkerSeverity newSeverity) Updates severity of markers generated by the provided checkId, if anyMethods inherited from interface com._1c.g5.wiring.IManagedService
activate, deactivate
-
Field Details
-
SERVICE_NAME
The name of the marker manager as managed service.- See Also:
-
-
Method Details
-
addListener
Adds general update listener.Listeners are always called after commit.
- Parameters:
listener
- the listener to add, cannot benull
.
-
removeListener
Removes general update listener.- Parameters:
listener
- the listener to remove, cannot benull
.
-
getRegisteredIndexes
Returns all indexes registered in this marker manager.- Parameters:
activity
- activity the index is involved in. Cannot benull
.- Returns:
- all indexes registered in this marker manager. Never
null
.
-
setMarkers
Sets markers for the specifiedobjectId
associated with the givenproject
.If the specified
objectId
is of Long type then it is supposed thatmarkers
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 isnull
or empty, the existing markers for the specifiedobjectId
will be removed.This method removes (and replaces with the new ones if
markers
is notnull
) the following markers:- All markers of the object with the given
objectId
. - All markers of the objects for which the object with given
objectId
is thetop object
.
objectId
is thesource object
, are not removed. If you need to remove those as well, callremoveMarkers(IProject, Object)
.Caution! If two threads call this at the same time with the same
project
andobjectId
, but differentmarkers
, 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
. Seecommit(Collection)
for details. - All markers of the object with the given
-
setMarkers
Sets all markers from the givenbatch
.Changes made by this method may not be immediately visible by marker accessing methods or
readers
. Seecommit(Collection)
for details.- Parameters:
project
- the project, cannot benull
.markerUpdateBatch
- the markers' batch. SeeMarkerUpdateBatch
for more info. Cannot benull
.
-
removeMarkers
Removes markers for the specifiedobjectId
associated with the givenproject
. 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:
- All markers of the object with the given
objectId
. - All markers of the objects for which the object with given
objectId
is thetop object
. - All markers of the objects for which the object with given
objectId
is thesource object
. - All markers of the objects for which the object with given
objectId
is thetop object
of theirsource object
.
Changes made by this method may not be immediately visible by marker accessing methods or
readers
. Seecommit(Collection)
for details. - All markers of the object with the given
-
removeMarkers
void removeMarkers(org.eclipse.core.resources.IProject project, Object objectId, long sourceObjectId, String checkId) Removes markers for the specifiedobjectId, checkId and sourceObjectId
associated with the givenproject
.This method is equivalent to call
setMarkers(project, objectId, sourceObjectId, null);
. Seethat method's documentation
for the details.Changes made by this method may not be immediately visible by marker accessing methods or
readers
. Seecommit(Collection)
for details.- Parameters:
project
- the project, cannot benull
.objectId
- the object identifier. It can be of typeString
orLong
only. The identifier cannot benull
.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 completellycheckId
- the checkId, cannot benull
.- See Also:
-
removeMarkersByCheckId
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
. Seecommit(Collection)
for details.- Parameters:
project
- The project to update markers for. May not benull
checkId
- The check identifier. May not benull
-
updateSeverity
void updateSeverity(org.eclipse.core.resources.IProject project, String checkId, MarkerSeverity newSeverity) Updates severity of markers generated by the provided checkId, if anyChanges made by this method may not be immediately visible by marker accessing methods or
readers
. Seecommit(Collection)
for details.- Parameters:
project
- The project to update markers for. May not benull
checkId
- The check identifier. May not benull
newSeverity
- New severity to set. May not benull
-
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
. Seecommit(Collection)
for details.- Parameters:
dtProject
- project, cannot benull
.topObjectId
- top object ID, cannot benull
.removedContainmentIds
- containment object IDs, cannot benull
.
-
reindex
void reindex(org.eclipse.core.resources.IProject project, org.eclipse.core.runtime.IProgressMonitor monitor) Updates indexes of markers of the specified project by callingMarkerIndex.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
. Seecommit(Collection)
for details.- Parameters:
project
- project to update, cannot benull
.monitor
- progress monitor, may benull
.
-
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 callingMarkerIndex.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
. Seecommit(Collection)
for details.- Parameters:
project
- project to update, cannot benull
.objectId
- ID of the object to be reindexed. For BM objects, this needs to be the top object ID. Cannot benull
.monitor
- progress monitor, may benull
.
-
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 callingMarkerIndex.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 benull
.monitor
- progress monitor, may benull
.objectIds
- object IDs to reindex. If not empty, these objects will be reindexed in addition to those supplied byobjectIdsSupplier
. Ifnull
or empty, andobjectIdsSupplier
isnull
, the whole project will be reindexed.objectIdsSupplier
- supplier of additional object IDs for reindexing. These objects will be reindexed along with the givenobjectIds
(if any). May benull
, in which case only the givenobjectIds
will be reindexed. If those arenull
or empty as well, the whole project will be reindexed. If the supplier returns empty iterable andobjectIds
isnull
or empty, nothing will be reindexed.
-
commit
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. Ifnull
or empty, commits all projects.
-
executeCrashProcessTask
Executes acrash processing task
on the given project. The relevantICrashProcessTask.ICrashInfo
about this project will be provided to the task'sICrashProcessTask.process(ICrashInfo, IBmTransaction, IProgressMonitor)
method. If that method finishes successfully and returnstrue
, the crash is resolved, and subsequent calls of this method for the same project will call their tasks on emptyICrashProcessTask.ICrashInfo
.- Parameters:
project
- project to process, nevernull
.task
- task to execute, nevernull
.
-
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. Ifnull
or empty, all projects will be included.allMarkers
- whether the reader should have access to all markers (ignoring theglobal filters
) or not.- Returns:
- a new marker reader, never
null
.
-
createReader
Creates a normal (not all-markers) reader for the given projects.- Parameters:
projects
- projects the reader will have access to. Ifnull
or empty, all projects will be included.- Returns:
- a new marker reader, never
null
.
-
createReader
Creates a normal (not all-markers) reader for the given project.- Parameters:
project
- projects the reader will have access to. Ifnull
, all projects will be included.- Returns:
- a new marker reader, never
null
.
-