Example usage for org.eclipse.jdt.internal.core.search.indexing IndexAllProject IndexAllProject

List of usage examples for org.eclipse.jdt.internal.core.search.indexing IndexAllProject IndexAllProject

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.core.search.indexing IndexAllProject IndexAllProject.

Prototype

public IndexAllProject(IProject project, IndexManager manager) 

Source Link

Usage

From source file:org.eclipse.jdt.internal.core.search.indexing.IndexManager.java

License:Open Source License

/**
 * Trigger addition of the entire content of a project
 * Note: the actual operation is performed in background
 *///from   w ww. j  a v a 2  s.  c om
public void indexAll(IProject project) {
    if (JavaCore.getPlugin() == null)
        return;

    // Also request indexing of binaries on the classpath
    // determine the new children
    try {
        JavaModel model = JavaModelManager.getJavaModelManager().getJavaModel();
        JavaProject javaProject = (JavaProject) model.getJavaProject(project);
        // only consider immediate libraries - each project will do the same
        // NOTE: force to resolve CP variables before calling indexer - 19303, so that initializers
        // will be run in the current thread.
        IClasspathEntry[] entries = javaProject.getResolvedClasspath();
        for (int i = 0; i < entries.length; i++) {
            IClasspathEntry entry = entries[i];
            if (entry.getEntryKind() == IClasspathEntry.CPE_LIBRARY)
                indexLibrary(entry.getPath(), project);
        }
    } catch (JavaModelException e) { // cannot retrieve classpath info
    }

    // check if the same request is not already in the queue
    IndexRequest request = new IndexAllProject(project, this);
    if (!isJobWaiting(request))
        request(request);
}

From source file:org.eclipse.jdt.internal.core.search.indexing.IndexManager.java

License:Open Source License

/**
 * Index the content of the given source folder.
 *///from w  ww  . j  a  va2  s  .c  om
public void indexSourceFolder(JavaProject javaProject, IPath sourceFolder, char[][] inclusionPatterns,
        char[][] exclusionPatterns) {
    IProject project = javaProject.getProject();
    if (this.jobEnd > this.jobStart) {
        // skip it if a job to index the project is already in the queue
        IndexRequest request = new IndexAllProject(project, this);
        if (isJobWaiting(request))
            return;
    }

    request(new AddFolderToIndex(sourceFolder, project, inclusionPatterns, exclusionPatterns, this));
}

From source file:org.eclipse.jdt.internal.core.search.indexing.IndexManager.java

License:Open Source License

private void rebuildIndex(IPath indexLocation, IPath containerPath) {
    Object target = JavaModel.getTarget(containerPath, true);
    if (target == null)
        return;/*from   w ww .  j a va2  s .  co m*/

    if (VERBOSE)
        Util.verbose("-> request to rebuild index: " + indexLocation + " path: " + containerPath); //$NON-NLS-1$ //$NON-NLS-2$

    updateIndexState(indexLocation, REBUILDING_STATE);
    IndexRequest request = null;
    if (target instanceof IProject) {
        IProject p = (IProject) target;
        if (JavaProject.hasJavaNature(p))
            request = new IndexAllProject(p, this);
    } else if (target instanceof IFolder) {
        request = new IndexBinaryFolder((IFolder) target, this);
    } else if (target instanceof IFile) {
        request = new AddJarFileToIndex((IFile) target, this);
    } else if (target instanceof File) {
        request = new AddJarFileToIndex(containerPath, this);
    }
    if (request != null)
        request(request);
}

From source file:org.eclipse.jdt.internal.core.search.indexing.IndexManager.java

License:Open Source License

/**
 * Remove the content of the given source folder from the index.
 *//*ww  w  . j a v  a 2s.co m*/
public void removeSourceFolderFromIndex(JavaProject javaProject, IPath sourceFolder, char[][] inclusionPatterns,
        char[][] exclusionPatterns) {
    IProject project = javaProject.getProject();
    if (this.jobEnd > this.jobStart) {
        // skip it if a job to index the project is already in the queue
        IndexRequest request = new IndexAllProject(project, this);
        if (isJobWaiting(request))
            return;
    }

    request(new RemoveFolderFromIndex(sourceFolder, inclusionPatterns, exclusionPatterns, project, this));
}