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

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

Introduction

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

Prototype

public IndexBinaryFolder(IContainer folder, IndexManager manager) 

Source Link

Usage

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

License:Open Source License

/**
 * Trigger addition of a library to an index
 * Note: the actual operation is performed in background
 *//* w  w w . j  av  a2  s.com*/
public void indexLibrary(IPath path, IProject requestingProject) {
    // requestingProject is no longer used to cancel jobs but leave it here just in case
    if (JavaCore.getPlugin() == null)
        return;

    Object target = JavaModel.getTarget(path, true);
    IndexRequest request = null;
    if (target instanceof IFile) {
        request = new AddJarFileToIndex((IFile) target, this);
    } else if (target instanceof File) {
        request = new AddJarFileToIndex(path, this);
    } else if (target instanceof IContainer) {
        request = new IndexBinaryFolder((IContainer) target, this);
    } else {
        return;
    }

    // check if the same request is not already in the queue
    if (!isJobWaiting(request))
        request(request);
}

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;/* w w w  .  j  a v  a  2 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);
}