当前位置: 首页>>代码示例>>Java>>正文


Java FileIndexLocation类代码示例

本文整理汇总了Java中org.eclipse.jdt.internal.core.index.FileIndexLocation的典型用法代码示例。如果您正苦于以下问题:Java FileIndexLocation类的具体用法?Java FileIndexLocation怎么用?Java FileIndexLocation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


FileIndexLocation类属于org.eclipse.jdt.internal.core.index包,在下文中一共展示了FileIndexLocation类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: deleteIndexFiles

import org.eclipse.jdt.internal.core.index.FileIndexLocation; //导入依赖的package包/类
private void deleteIndexFiles(SimpleSet pathsToKeep) {
  File[] indexesFiles = getSavedIndexesDirectory().listFiles();
  if (indexesFiles == null) return;

  for (int i = 0, l = indexesFiles.length; i < l; i++) {
    String fileName = indexesFiles[i].getAbsolutePath();
    if (pathsToKeep != null && pathsToKeep.includes(new FileIndexLocation(indexesFiles[i])))
      continue;
    String suffix = ".index"; // $NON-NLS-1$
    if (fileName.regionMatches(
        true, fileName.length() - suffix.length(), suffix, 0, suffix.length())) {
      if (JobManager.VERBOSE || DEBUG)
        Util.verbose("Deleting index file " + indexesFiles[i]); // $NON-NLS-1$
      indexesFiles[i].delete();
    }
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:18,代码来源:IndexManager.java

示例2: readParticipantsIndexNamesFile

import org.eclipse.jdt.internal.core.index.FileIndexLocation; //导入依赖的package包/类
private void readParticipantsIndexNamesFile() {
  SimpleLookupTable containers = new SimpleLookupTable(3);
  try {
    char[] participantIndexNames =
        org.eclipse.jdt.internal.compiler.util.Util.getFileCharContent(
            this.participantIndexNamesFile, null);
    if (participantIndexNames.length > 0) {
      char[][] names = CharOperation.splitOn('\n', participantIndexNames);
      if (names.length >= 3) {
        // First line is DiskIndex signature  (see writeParticipantsIndexNamesFile())
        if (DiskIndex.SIGNATURE.equals(new String(names[0]))) {
          for (int i = 1, l = names.length - 1; i < l; i += 2) {
            IndexLocation indexLocation =
                new FileIndexLocation(new File(new String(names[i])), true);
            containers.put(indexLocation, new Path(new String(names[i + 1])));
          }
        }
      }
    }
  } catch (IOException ignored) {
    if (JobManager.VERBOSE)
      Util.verbose("Failed to read participant index file names"); // $NON-NLS-1$
  }
  this.participantsContainers = containers;
  return;
}
 
开发者ID:eclipse,项目名称:che,代码行数:27,代码来源:IndexManager.java

示例3: getIndexes

import org.eclipse.jdt.internal.core.index.FileIndexLocation; //导入依赖的package包/类
public Index[] getIndexes(IProgressMonitor progressMonitor) {
	// acquire the in-memory indexes on the fly
	IndexLocation[] indexLocations;
	int length;
	if (this.participant instanceof JavaSearchParticipant) {
		indexLocations = ((JavaSearchParticipant)this.participant).selectIndexURLs(this.pattern, this.scope);
		length = indexLocations.length;
	} else {
		IPath[] paths = this.participant.selectIndexes(this.pattern, this.scope);
		length = paths.length;
		indexLocations = new IndexLocation[paths.length];
		for (int i = 0, len = paths.length; i < len; i++) {
			indexLocations[i] = new FileIndexLocation(paths[i].toFile(), true);
		}
	}
	Index[] indexes = JavaModelManager.getIndexManager().getIndexes(indexLocations, progressMonitor);
	this.areIndexesReady = indexes.length == length;
	return indexes;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:20,代码来源:PatternSearchJob.java

示例4: getIndexStates

import org.eclipse.jdt.internal.core.index.FileIndexLocation; //导入依赖的package包/类
private SimpleLookupTable getIndexStates() {
  if (this.indexStates != null) return this.indexStates;

  this.indexStates = new SimpleLookupTable();
  File indexesDirectoryPath = getSavedIndexesDirectory();
  char[][] savedNames = readIndexState(getJavaPluginWorkingLocation().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) {
        IndexLocation indexLocation =
            new FileIndexLocation(
                new File(
                    indexesDirectoryPath,
                    String.valueOf(savedName))); // shares indexesDirectoryPath's segments
        if (JobManager.VERBOSE)
          Util.verbose("Reading saved index file " + indexLocation); // $NON-NLS-1$
        this.indexStates.put(indexLocation, SAVED_STATE);
      }
    }
  } else {
    // All the index files are getting deleted and hence there is no need to
    // further check for change in javaLikeNames.
    writeJavaLikeNamesFile();
    this.javaLikeNamesChanged = false;
    deleteIndexFiles();
  }
  readIndexMap();
  return this.indexStates;
}
 
开发者ID:eclipse,项目名称:che,代码行数:33,代码来源:IndexManager.java

示例5: updateParticipant

import org.eclipse.jdt.internal.core.index.FileIndexLocation; //导入依赖的package包/类
public void updateParticipant(IPath indexPath, IPath containerPath) {
  if (this.participantsContainers == null) {
    readParticipantsIndexNamesFile();
  }
  IndexLocation indexLocation = new FileIndexLocation(indexPath.toFile(), true);
  if (this.participantsContainers.get(indexLocation) == null) {
    this.participantsContainers.put(indexLocation, containerPath);
    this.participantUpdated = true;
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:11,代码来源:IndexManager.java

示例6: generateIndexForJar

import org.eclipse.jdt.internal.core.index.FileIndexLocation; //导入依赖的package包/类
public void generateIndexForJar(String pathToJar, String pathToIndexFile) throws IOException {
	File f = new File(pathToJar);
	if (!f.exists()) {
		throw new FileNotFoundException(pathToJar + " not found"); //$NON-NLS-1$
	}
	IndexLocation indexLocation = new FileIndexLocation(new File(pathToIndexFile));
	Index index = new Index(indexLocation, pathToJar, false /*reuse index file*/);
	SearchParticipant participant = SearchEngine.getDefaultSearchParticipant();
	index.separator = JAR_SEPARATOR;
	ZipFile zip = new ZipFile(pathToJar);
	try {
		for (Enumeration e = zip.entries(); e.hasMoreElements();) {
			// iterate each entry to index it
			ZipEntry ze = (ZipEntry) e.nextElement();
			String zipEntryName = ze.getName();
			if (Util.isClassFileName(zipEntryName)) {
				final byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getZipEntryByteContent(ze, zip);
				JavaSearchDocument entryDocument = new JavaSearchDocument(ze, new Path(pathToJar), classFileBytes, participant);
				entryDocument.setIndex(index);
				new BinaryIndexer(entryDocument).indexDocument();
			}
		}
		index.save();
	} finally {
		zip.close();
	}
	return;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:29,代码来源:DefaultJavaIndexer.java


注:本文中的org.eclipse.jdt.internal.core.index.FileIndexLocation类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。