Example usage for org.eclipse.jdt.internal.core.index Index remove

List of usage examples for org.eclipse.jdt.internal.core.index Index remove

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.core.index Index remove.

Prototype

public void remove(String containerRelativePath) 

Source Link

Usage

From source file:com.codenvy.ide.ext.java.server.internal.core.search.indexing.RemoveFromIndex.java

License:Open Source License

public boolean execute(IProgressMonitor progressMonitor) {

    if (this.isCancelled || progressMonitor != null && progressMonitor.isCanceled())
        return true;

    /* ensure no concurrent write access to index */
    Index index = this.manager.getIndex(this.containerPath, true,
            /*reuse index file*/ false /*create if none*/);
    if (index == null)
        return true;
    ReadWriteMonitor monitor = index.monitor;
    if (monitor == null)
        return true; // index got deleted since acquired

    try {//from   ww w.  j  a va2 s . c  o m
        monitor.enterWrite(); // ask permission to write
        index.remove(this.resourceName);
    } finally {
        monitor.exitWrite(); // free write lock
    }
    return true;
}