Package org.eclipse.core.runtime

Examples of org.eclipse.core.runtime.IPath


  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);
  }
View Full Code Here


      removeIndexesState(locations);
  }
  deleteIndexFiles(knownPaths);
}
public IPath computeIndexLocation(IPath containerPath) {
  IPath indexLocation = (IPath) this.indexLocations.get(containerPath);
  if (indexLocation == null) {
    String pathString = containerPath.toOSString();
    checksumCalculator.reset();
    checksumCalculator.update(pathString.getBytes());
    String fileName = Long.toString(checksumCalculator.getValue()) + ".index"; //$NON-NLS-1$
View Full Code Here

* - if (createIfMissing) then create a new empty index and record it in memory
*
* Warning: Does not check whether index is consistent (not being used)
*/
public synchronized Index getIndex(IPath containerPath, boolean reuseExistingFile, boolean createIfMissing) {
  IPath indexLocation = computeIndexLocation(containerPath);
  return getIndex(containerPath, indexLocation, reuseExistingFile, createIfMissing);
}
View Full Code Here

}
public synchronized Index getIndex(IPath indexLocation) {
  return (Index) this.indexes.get(indexLocation); // is null if unknown, call if the containerPath must be computed
}
public synchronized Index getIndexForUpdate(IPath containerPath, boolean reuseExistingFile, boolean createIfMissing) {
  IPath indexLocation = computeIndexLocation(containerPath);
  if (getIndexStates().get(indexLocation) == REBUILDING_STATE)
    return getIndex(containerPath, indexLocation, reuseExistingFile, createIfMissing);

  return null; // abort the job since the index has been removed from the REBUILDING_STATE
}
View Full Code Here

}
private SimpleLookupTable getIndexStates() {
  if (this.indexStates != null) return this.indexStates;

  this.indexStates = new SimpleLookupTable();
  IPath indexesDirectoryPath = getJavaPluginWorkingLocation();
  char[][] savedNames = readIndexState(indexesDirectoryPath.toOSString());
  if (savedNames != null) {
    for (int i = 1, l = savedNames.length; i < l; i++) { // first name is saved signature, see readIndexState()
      char[] savedName = savedNames[i];
      if (savedName.length > 0) {
        IPath indexLocation = indexesDirectoryPath.append(new String(savedName)); // shares indexesDirectoryPath's segments
        if (VERBOSE)
          Util.verbose("Reading saved index file " + indexLocation); //$NON-NLS-1$
        this.indexStates.put(indexLocation, SAVED_STATE);
      }
    }
View Full Code Here

  return this.indexStates;
}
private IPath getJavaPluginWorkingLocation() {
  if (this.javaPluginLocation != null) return this.javaPluginLocation;

  IPath stateLocation = JavaCore.getPlugin().getStateLocation();
  return this.javaPluginLocation = stateLocation;
}
View Full Code Here

  }

  this.request(new AddFolderToIndex(sourceFolder, project, inclusionPatterns, exclusionPatterns, this));
}
public synchronized void jobWasCancelled(IPath containerPath) {
  IPath indexLocation = computeIndexLocation(containerPath);
  Index index = getIndex(indexLocation);
  if (index != null) {
    index.monitor = null;
    this.indexes.removeKey(indexLocation);
  }
View Full Code Here

public synchronized Index recreateIndex(IPath containerPath) {
  // only called to over write an existing cached index...
  String containerPathString = containerPath.getDevice() == null ? containerPath.toString() : containerPath.toOSString();
  try {
    // Path is already canonical
    IPath indexLocation = computeIndexLocation(containerPath);
    Index index = getIndex(indexLocation);
    ReadWriteMonitor monitor = index == null ? null : index.monitor;

    if (VERBOSE)
      Util.verbose("-> recreating index: "+indexLocation+" for path: "+containerPathString); //$NON-NLS-1$ //$NON-NLS-2$
    index = new Index(indexLocation.toOSString(), containerPathString, false /*reuse index file*/);
    this.indexes.put(indexLocation, index);
    index.monitor = monitor;
    return index;
  } catch (IOException e) {
    // The file could not be created. Possible reason: the project has been deleted.
View Full Code Here

* This is a no-op if the index did not exist.
*/
public synchronized void removeIndex(IPath containerPath) {
  if (VERBOSE)
    Util.verbose("removing index " + containerPath); //$NON-NLS-1$
  IPath indexLocation = computeIndexLocation(containerPath);
  Index index = getIndex(indexLocation);
  File indexFile = null;
  if (index != null) {
    index.monitor = null;
    indexFile = index.getIndexFile();
  }
  if (indexFile == null)
    indexFile = new File(indexLocation.toOSString()); // index is not cached yet, but still want to delete the file
  if (indexFile.exists())
    indexFile.delete();
  this.indexes.removeKey(indexLocation);
  updateIndexState(indexLocation, null);
}
View Full Code Here

  Object[] valueTable = this.indexes.valueTable;
  IPath[] locations = null;
  int max = this.indexes.elementSize;
  int count = 0;
  for (int i = 0, l = keyTable.length; i < l; i++) {
    IPath indexLocation = (IPath) keyTable[i];
    if (indexLocation == null)
      continue;
    if (path.isPrefixOf(indexLocation)) {
      Index index = (Index) valueTable[i];
      index.monitor = null;
View Full Code Here

TOP

Related Classes of org.eclipse.core.runtime.IPath

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.