List of usage examples for org.eclipse.jdt.internal.core.index IndexLocation getUrl
public URL getUrl()
From source file:com.codenvy.ide.ext.java.server.internal.core.search.indexing.IndexManager.java
License:Open Source License
/** * Compute the pre-built index location for a specified URL *//* www . ja v a2 s. c o m*/ public synchronized IndexLocation computeIndexLocation(IPath containerPath, final URL newIndexURL) { IndexLocation indexLocation = (IndexLocation) this.indexLocations.get(containerPath); if (indexLocation == null) { if (newIndexURL != null) { indexLocation = IndexLocation.createIndexLocation(newIndexURL); // update caches indexLocation = (IndexLocation) getIndexStates().getKey(indexLocation); this.indexLocations.put(containerPath, indexLocation); } } else { // an existing index location exists - make sure it has not changed (i.e. the URL has not changed) URL existingURL = indexLocation.getUrl(); if (newIndexURL != null) { // if either URL is different then the index location has been updated so rebuild. if (!newIndexURL.equals(existingURL)) { // URL has changed so remove the old index and create a new one this.removeIndex(containerPath); // create a new one indexLocation = IndexLocation.createIndexLocation(newIndexURL); // update caches indexLocation = (IndexLocation) getIndexStates().getKey(indexLocation); this.indexLocations.put(containerPath, indexLocation); } } } return indexLocation; }