Example usage for org.eclipse.jdt.internal.core.search BasicSearchEngine createWorkspaceScope

List of usage examples for org.eclipse.jdt.internal.core.search BasicSearchEngine createWorkspaceScope

Introduction

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

Prototype

public static IJavaSearchScope createWorkspaceScope() 

Source Link

Usage

From source file:org.eclipse.jdt.core.search.SearchEngine.java

License:Open Source License

/**
 * Returns a Java search scope with the workspace as the only limit.
 *
 * @return a new workspace scope//w ww  .  j a  va  2 s. c  o m
 */
public static IJavaSearchScope createWorkspaceScope() {
    return BasicSearchEngine.createWorkspaceScope();
}

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

License:Open Source License

public void cleanUpIndexes() {
    SimpleSet knownPaths = new SimpleSet();
    IJavaSearchScope scope = BasicSearchEngine.createWorkspaceScope();
    PatternSearchJob job = new PatternSearchJob(null, SearchEngine.getDefaultSearchParticipant(), scope, null);
    Index[] selectedIndexes = job.getIndexes(null);
    for (int i = 0, l = selectedIndexes.length; i < l; i++) {
        String path = selectedIndexes[i].getIndexFile().getAbsolutePath();
        knownPaths.add(path);/*from   w  w w . j ava 2s. com*/
    }

    if (this.indexStates != null) {
        Object[] keys = this.indexStates.keyTable;
        IPath[] locations = new IPath[this.indexStates.elementSize];
        int count = 0;
        for (int i = 0, l = keys.length; i < l; i++) {
            IPath key = (IPath) keys[i];
            if (key != null && !knownPaths.includes(key.toOSString()))
                locations[count++] = key;
        }
        if (count > 0)
            removeIndexesState(locations);
    }
    deleteIndexFiles(knownPaths);
}