Class IndexManager
java.lang.Object
org.aspectj.org.eclipse.jdt.internal.core.search.processing.JobManager
org.aspectj.org.eclipse.jdt.internal.core.search.indexing.IndexManager
- All Implemented Interfaces:
IIndexConstants
-
Field Summary
Modifier and TypeFieldDescriptionstatic boolean
static final String
synchronized by IndexManager.this
key = containerPath, value = indexLocation path
indexLocation path is created by appending an index file name to the getJavaPluginWorkingLocation() pathstatic final String
static final Integer
static final Integer
static final Integer
static final Integer
static final Integer
Fields inherited from class org.aspectj.org.eclipse.jdt.internal.core.search.processing.JobManager
VERBOSE
Fields inherited from interface org.aspectj.org.eclipse.jdt.internal.core.search.indexing.IIndexConstants
AND_PATTERN, ANNOT_REF_PATTERN, ANNOTATION_REF, ANNOTATION_TYPE_SUFFIX, CLASS_AND_ENUM_SUFFIX, CLASS_AND_INTERFACE_SUFFIX, CLASS_SUFFIX, CONSTRUCTOR_DECL, CONSTRUCTOR_PATTERN, CONSTRUCTOR_REF, COUNTS, DEFAULT_CONSTRUCTOR, ENUM_SUFFIX, FIELD_DECL, FIELD_PATTERN, INTERFACE_AND_ANNOTATION_SUFFIX, INTERFACE_SUFFIX, LOCAL_VAR_PATTERN, META_INDEX_CATEGORIES, META_INDEX_QUALIFIED_SUPER_TYPE_QUALIFIER_REF, META_INDEX_QUALIFIED_TYPE_QUALIFIER_REF, META_INDEX_SIMPLE_SUPER_TYPE_QUALIFIER_REF, META_INDEX_SIMPLE_TYPE_QUALIFIER_REF, METHOD_DECL, METHOD_DECL_PLUS, METHOD_PATTERN, METHOD_REF, MODULE_DECL, MODULE_INFO, MODULE_PATTERN, MODULE_REF, OBJECT, ONE_STAR, ONE_STAR_CHAR, ONE_ZERO, ONE_ZERO_CHAR, OR_PATTERN, PARAMETER_SEPARATOR, PKG_DECL_PATTERN, PKG_REF_PATTERN, REF, SECONDARY_SUFFIX, SEPARATOR, SUPER_REF, SUPER_REF_PATTERN, TYPE_DECL, TYPE_DECL_PATTERN, TYPE_PARAM_PATTERN, TYPE_REF_PATTERN, TYPE_SUFFIX, ZERO_CHAR
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
aboutToUpdateIndex
(org.eclipse.core.runtime.IPath containerPath, Integer newIndexState) void
addBinary
(org.eclipse.core.resources.IFile resource, org.eclipse.core.runtime.IPath containerPath) Trigger addition of a resource to an index Note: the actual operation is performed in backgroundvoid
addSource
(org.eclipse.core.resources.IFile resource, org.eclipse.core.runtime.IPath containerPath, SourceElementParser parser) Trigger addition of a resource to an index Note: the actual operation is performed in backgroundvoid
Removes unused indexes from disk.computeIndexLocation
(org.eclipse.core.runtime.IPath containerPath) computeIndexLocation
(org.eclipse.core.runtime.IPath containerPath, URL newIndexURL) Compute the pre-built index location for a specified URLfinal void
void
deleteIndexFiles
(org.eclipse.core.runtime.IProgressMonitor monitor) void
ensureIndexExists
(IndexLocation indexLocation, org.eclipse.core.runtime.IPath containerPath) getIndex
(IndexLocation indexLocation) Returns the index for a given index locationgetIndex
(org.eclipse.core.runtime.IPath containerPath, boolean reuseExistingFile, boolean createIfMissing) Returns the index for a given project, according to the following algorithm: - if index is already in memory: answers this one back - if (reuseExistingFile) then read it and return this index and record it in memory - if (createIfMissing) then create a new empty index and record it in memory Warning: Does not check whether index is consistent (not being used)getIndex
(org.eclipse.core.runtime.IPath containerPath, IndexLocation indexLocation, boolean reuseExistingFile, boolean createIfMissing) Returns the index for a given project, according to the following algorithm: - if index is already in memory: answers this one back - if (reuseExistingFile) then read it and return this index and record it in memory - if (createIfMissing) then create a new empty index and record it in memory Warning: Does not check whether index is consistent (not being used)Index[]
getIndexes
(IndexLocation[] locations, org.eclipse.core.runtime.IProgressMonitor progressMonitor) Returns all the existing indexes for a list of index locations.getIndexForUpdate
(org.eclipse.core.runtime.IPath containerPath, boolean reuseExistingFile, boolean createIfMissing) getSourceElementParser
(IJavaProject project, ISourceElementRequestor requestor) void
indexAll
(org.eclipse.core.resources.IProject project) Trigger addition of the entire content of a project Note: the actual operation is performed in backgroundvoid
indexDocument
(SearchDocument searchDocument, SearchParticipant searchParticipant, Index index, org.eclipse.core.runtime.IPath indexLocation) void
indexLibrary
(org.eclipse.core.runtime.IPath path, org.eclipse.core.resources.IProject requestingProject, URL indexURL) void
indexLibrary
(org.eclipse.core.runtime.IPath path, org.eclipse.core.resources.IProject requestingProject, URL indexURL, boolean updateIndex) Trigger addition of a library to an index Note: the actual operation is performed in backgroundvoid
indexResolvedDocument
(SearchDocument searchDocument, SearchParticipant searchParticipant, Index index, org.eclipse.core.runtime.IPath indexLocation) void
indexSourceFolder
(JavaProject javaProject, org.eclipse.core.runtime.IPath sourceFolder, char[][] inclusionPatterns, char[][] exclusionPatterns) Index the content of the given source folder.void
jobWasCancelled
(org.eclipse.core.runtime.IPath containerPath) protected void
Advance to the next available job, once the current one has been completed.protected void
notifyIdle
(long idlingMilliSeconds) No more job awaiting.Name of the background processrecreateIndex
(org.eclipse.core.runtime.IPath containerPath) Recreates the index for a given path, keeping the same read-write monitor.void
Trigger removal of a resource to an index Note: the actual operation is performed in backgroundvoid
removeIndex
(org.eclipse.core.runtime.IPath containerPath) Removes the index for a given path.void
removeIndexFamily
(org.eclipse.core.runtime.IPath path) Removes all indexes whose paths start with (or are equal to) the given path.void
removeIndexPath
(org.eclipse.core.runtime.IPath path) Removes all indexes whose paths start with (or are equal to) the given path.void
removeSourceFolderFromIndex
(JavaProject javaProject, org.eclipse.core.runtime.IPath sourceFolder, char[][] inclusionPatterns, char[][] exclusionPatterns) Remove the content of the given source folder from the index.void
reset()
Flush current stateboolean
resetIndex
(org.eclipse.core.runtime.IPath containerPath) Resets the index for a given path.void
void
Commit all index memory changes to diskvoid
savePreBuiltIndex
(Index index) saveIndex(Index)
will only update the state if there are no other jobs running against the same underlying resource for this index.void
scheduleDocumentIndexing
(SearchDocument searchDocument, org.eclipse.core.runtime.IPath container, IndexLocation indexLocation, SearchParticipant searchParticipant) toString()
void
updateParticipant
(org.eclipse.core.runtime.IPath indexPath, org.eclipse.core.runtime.IPath containerPath) org.eclipse.core.runtime.IStatus
waitForIndex
(boolean enableIndexer, org.eclipse.core.runtime.IProgressMonitor monitor) Waits until all indexing jobs are done or given monitor is cancelled.Methods inherited from class org.aspectj.org.eclipse.jdt.internal.core.search.processing.JobManager
awaitingJobsCount, currentJob, currentJobForced, disable, discardJobs, enable, hasPendingJobMatching, isEnabled, isJobWaiting, performConcurrentJob, request, requestIfNotWaiting, shutdown
-
Field Details
-
indexLocations
synchronized by IndexManager.this
key = containerPath, value = indexLocation path
indexLocation path is created by appending an index file name to the getJavaPluginWorkingLocation() path -
SAVED_STATE
-
UPDATING_STATE
-
UNKNOWN_STATE
-
REBUILDING_STATE
-
REUSE_STATE
-
MANAGE_PRODUCT_INDEXES_PROPERTY
- See Also:
-
INDEX_MANAGER_NOTIFY_IDLE_WAIT_PROPERTY
- See Also:
-
DEBUG
public static boolean DEBUG
-
-
Constructor Details
-
IndexManager
public IndexManager()
-
-
Method Details
-
waitForIndex
public org.eclipse.core.runtime.IStatus waitForIndex(boolean enableIndexer, org.eclipse.core.runtime.IProgressMonitor monitor) Waits until all indexing jobs are done or given monitor is cancelled.- Parameters:
enableIndexer
-true
if this method should temporarily enable index manager and disable it again at the end (if the index manager was disabled before calling this method). Iffalse
is given and index manager is disabled, this method will block until index manager will be enabled again.monitor
- for cancellation- Returns:
Status#CANCEL_STATUS
if the waiting was cancelled,Status#OK_STATUS
otherwise
-
aboutToUpdateIndex
-
addBinary
public void addBinary(org.eclipse.core.resources.IFile resource, org.eclipse.core.runtime.IPath containerPath) Trigger addition of a resource to an index Note: the actual operation is performed in background -
addSource
public void addSource(org.eclipse.core.resources.IFile resource, org.eclipse.core.runtime.IPath containerPath, SourceElementParser parser) Trigger addition of a resource to an index Note: the actual operation is performed in background -
cleanUpIndexes
public void cleanUpIndexes()Removes unused indexes from disk. -
computeIndexLocation
public IndexLocation computeIndexLocation(org.eclipse.core.runtime.IPath containerPath, URL newIndexURL) Compute the pre-built index location for a specified URL -
computeIndexLocation
-
deleteIndexFiles
public final void deleteIndexFiles() -
deleteIndexFiles
public void deleteIndexFiles(org.eclipse.core.runtime.IProgressMonitor monitor) -
ensureIndexExists
public void ensureIndexExists(IndexLocation indexLocation, org.eclipse.core.runtime.IPath containerPath) -
getSourceElementParser
public SourceElementParser getSourceElementParser(IJavaProject project, ISourceElementRequestor requestor) -
getIndex
Returns the index for a given index location- Parameters:
indexLocation
- The path of the index file- Returns:
- The corresponding index or
null
if not found
-
getIndex
public Index getIndex(org.eclipse.core.runtime.IPath containerPath, boolean reuseExistingFile, boolean createIfMissing) Returns the index for a given project, according to the following algorithm: - if index is already in memory: answers this one back - if (reuseExistingFile) then read it and return this index and record it in memory - if (createIfMissing) then create a new empty index and record it in memory Warning: Does not check whether index is consistent (not being used) -
getIndex
public Index getIndex(org.eclipse.core.runtime.IPath containerPath, IndexLocation indexLocation, boolean reuseExistingFile, boolean createIfMissing) Returns the index for a given project, according to the following algorithm: - if index is already in memory: answers this one back - if (reuseExistingFile) then read it and return this index and record it in memory - if (createIfMissing) then create a new empty index and record it in memory Warning: Does not check whether index is consistent (not being used) -
getIndexes
public Index[] getIndexes(IndexLocation[] locations, org.eclipse.core.runtime.IProgressMonitor progressMonitor) Returns all the existing indexes for a list of index locations. Note that this may trigger some indexes recreation work
Method is synchronized because it uses this.indexLocations and this.indexes- Parameters:
locations
- The list of of the index files path- Returns:
- The corresponding indexes list.
-
getIndexForUpdate
public Index getIndexForUpdate(org.eclipse.core.runtime.IPath containerPath, boolean reuseExistingFile, boolean createIfMissing) -
indexDocument
public void indexDocument(SearchDocument searchDocument, SearchParticipant searchParticipant, Index index, org.eclipse.core.runtime.IPath indexLocation) -
indexResolvedDocument
public void indexResolvedDocument(SearchDocument searchDocument, SearchParticipant searchParticipant, Index index, org.eclipse.core.runtime.IPath indexLocation) -
indexAll
public void indexAll(org.eclipse.core.resources.IProject project) Trigger addition of the entire content of a project Note: the actual operation is performed in background -
indexLibrary
public void indexLibrary(org.eclipse.core.runtime.IPath path, org.eclipse.core.resources.IProject requestingProject, URL indexURL) -
indexLibrary
public void indexLibrary(org.eclipse.core.runtime.IPath path, org.eclipse.core.resources.IProject requestingProject, URL indexURL, boolean updateIndex) Trigger addition of a library to an index Note: the actual operation is performed in background -
indexSourceFolder
public void indexSourceFolder(JavaProject javaProject, org.eclipse.core.runtime.IPath sourceFolder, char[][] inclusionPatterns, char[][] exclusionPatterns) Index the content of the given source folder. -
jobWasCancelled
public void jobWasCancelled(org.eclipse.core.runtime.IPath containerPath) -
moveToNextJob
protected void moveToNextJob()Advance to the next available job, once the current one has been completed. Note: clients awaiting until the job count is zero are still waiting at this point.- Overrides:
moveToNextJob
in classJobManager
-
notifyIdle
protected void notifyIdle(long idlingMilliSeconds) No more job awaiting.- Specified by:
notifyIdle
in classJobManager
-
processName
Name of the background process- Specified by:
processName
in classJobManager
-
recreateIndex
Recreates the index for a given path, keeping the same read-write monitor. Returns the new empty index or null if it didn't exist before. Warning: Does not check whether index is consistent (not being used) -
remove
Trigger removal of a resource to an index Note: the actual operation is performed in background -
removeIndex
public void removeIndex(org.eclipse.core.runtime.IPath containerPath) Removes the index for a given path. This is a no-op if the index did not exist. -
removeIndexPath
public void removeIndexPath(org.eclipse.core.runtime.IPath path) Removes all indexes whose paths start with (or are equal to) the given path. -
removeIndexFamily
public void removeIndexFamily(org.eclipse.core.runtime.IPath path) Removes all indexes whose paths start with (or are equal to) the given path. -
removeSourceFolderFromIndex
public void removeSourceFolderFromIndex(JavaProject javaProject, org.eclipse.core.runtime.IPath sourceFolder, char[][] inclusionPatterns, char[][] exclusionPatterns) Remove the content of the given source folder from the index. -
reset
public void reset()Flush current state- Overrides:
reset
in classJobManager
-
resetIndex
public boolean resetIndex(org.eclipse.core.runtime.IPath containerPath) Resets the index for a given path. Returns true if the index was reset, false otherwise. -
savePreBuiltIndex
saveIndex(Index)
will only update the state if there are no other jobs running against the same underlying resource for this index. Pre-built indexes must be in aREUSE_STATE
state even if there is another job to run against it as the subsequent job will find the index and not save it in the right state. Refer to https://bugs.eclipse.org/bugs/show_bug.cgi?id=405932- Throws:
IOException
-
saveIndex
- Throws:
IOException
-
saveIndexes
public void saveIndexes()Commit all index memory changes to disk -
scheduleDocumentIndexing
public void scheduleDocumentIndexing(SearchDocument searchDocument, org.eclipse.core.runtime.IPath container, IndexLocation indexLocation, SearchParticipant searchParticipant) -
toString
- Overrides:
toString
in classJobManager
-
updateParticipant
public void updateParticipant(org.eclipse.core.runtime.IPath indexPath, org.eclipse.core.runtime.IPath containerPath) -
findMatchingIndexNames
-
getMetaIndex
-