本文整理汇总了Java中com.intellij.util.indexing.FileContent类的典型用法代码示例。如果您正苦于以下问题:Java FileContent类的具体用法?Java FileContent怎么用?Java FileContent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FileContent类属于com.intellij.util.indexing包,在下文中一共展示了FileContent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: map
import com.intellij.util.indexing.FileContent; //导入依赖的package包/类
@NotNull
@Override
public Map<String, Set<String>> map(@NotNull FileContent inputData) {
final Map<String, Set<String>> indexMap = new HashMap<>();
if (inputData.getFileType().isBinary()) {
return indexMap;
}
final PsiFile file = inputData.getPsiFile();
if (fileDetector.isMainOpenApiFile(file)) {
Set<String> partialOpenApiFileNames = getPartialOpenApiFileNames(file);
indexMap.put(OpenApiFileIndex.PARTIAL_OPEN_API_FILES, partialOpenApiFileNames);
indexMap.put(OpenApiFileIndex.MAIN_OPEN_API_FILE, ImmutableSet.of(file.getName() + DELIMITER + OpenApiFileType.MAIN));
}
return indexMap;
}
示例2: map
import com.intellij.util.indexing.FileContent; //导入依赖的package包/类
@NotNull
@Override
public Map<String, Set<String>> map(@NotNull FileContent inputData) {
final Map<String, Set<String>> indexMap = new HashMap<>();
if (inputData.getFileType().isBinary()) {
return indexMap;
}
final PsiFile file = inputData.getPsiFile();
if (fileDetector.isMainSwaggerFile(file)) {
Set<String> partialSwaggerFileNames = getPartialSwaggerFileNames(file);
indexMap.put(SwaggerFileIndex.PARTIAL_SWAGGER_FILES, partialSwaggerFileNames);
indexMap.put(SwaggerFileIndex.MAIN_SWAGGER_FILE, ImmutableSet.of(file.getName() + DELIMITER + SwaggerFileType.MAIN));
}
return indexMap;
}
示例3: map
import com.intellij.util.indexing.FileContent; //导入依赖的package包/类
@NotNull
@Override
public Map<TodoIndexEntry, Integer> map(@NotNull FileContent inputData) {
Map<TodoIndexEntry, Integer> result = ContainerUtil.newTroveMap();
for (DataIndexer<TodoIndexEntry, Integer, FileContent> indexer : indexers) {
for (Map.Entry<TodoIndexEntry, Integer> entry : indexer.map(inputData).entrySet()) {
TodoIndexEntry key = entry.getKey();
if (result.containsKey(key)) {
result.put(key, result.get(key) + entry.getValue());
} else {
result.put(key, entry.getValue());
}
}
}
return result;
}
示例4: map
import com.intellij.util.indexing.FileContent; //导入依赖的package包/类
@Override
@NotNull
public Map<IdIndexEntry, Integer> map(@NotNull final FileContent inputData) {
final IdDataConsumer consumer = new IdDataConsumer();
final CharSequence chars = inputData.getContentAsText();
IdTableBuilding.scanWords(new IdTableBuilding.ScanWordProcessor() {
@Override
public void run(final CharSequence chars11, @Nullable char[] charsArray, final int start, final int end) {
if (charsArray != null) {
consumer.addOccurrence(charsArray, start, end, (int)UsageSearchContext.IN_PLAIN_TEXT);
}
else {
consumer.addOccurrence(chars11, start, end, (int)UsageSearchContext.IN_PLAIN_TEXT);
}
}
}, chars, 0, chars.length());
return consumer.getResult();
}
示例5: readOrBuild
import com.intellij.util.indexing.FileContent; //导入依赖的package包/类
@Override
public ObjectStubTree readOrBuild(Project project, VirtualFile vFile, @Nullable PsiFile psiFile) {
if (!canHaveStub(vFile)) {
return null;
}
try {
final FileContent fc = new FileContentImpl(vFile, vFile.contentsToByteArray());
fc.putUserData(IndexingDataKeys.PROJECT, project);
final Stub element = StubTreeBuilder.buildStubTree(fc);
if (element instanceof PsiFileStub) {
return new StubTree((PsiFileStub)element);
}
}
catch (IOException e) {
throw new RuntimeException(e);
}
return null;
}
示例6: withAppEngineFlexYamlContent
import com.intellij.util.indexing.FileContent; //导入依赖的package包/类
private AppEngineFlexPattern withAppEngineFlexYamlContent() {
return with(
new PatternCondition<FileContent>("with-appengine-java-flexible") {
@Override
public boolean accepts(@NotNull FileContent fileContent, ProcessingContext context) {
// checks for flex engine file names and then checks for required configuration line
// inside.
boolean nameMatch = APP_ENGINE_FLEX_CONFIG_FILES.contains(fileContent.getFileName());
if (nameMatch) {
Scanner scanner = new Scanner(fileContent.getContentAsText().toString());
while (scanner.hasNextLine()) {
if (scanner.nextLine().startsWith(APP_ENGINE_FLEX_REQUIRED_YAML_CONTENT)) {
return true;
}
}
}
return false;
}
});
}
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-intellij,代码行数:21,代码来源:AppEngineFlexibleFrameworkDetector.java
示例7: map
import com.intellij.util.indexing.FileContent; //导入依赖的package包/类
@Override
@NotNull
public Map<String, Void> map(@NotNull final FileContent inputData) {
if (!PantsUtil.isPantsProject(inputData.getProject())) {
return Collections.emptyMap();
}
final VirtualFile file = inputData.getFile();
Optional<VirtualFile> buildRoot = PantsUtil.findBuildRoot(file);
if (!buildRoot.isPresent()) {
return Collections.emptyMap();
}
String relative = FileUtil.getRelativePath(buildRoot.get().getPath(), file.getParent().getPath(), File.separatorChar);
if (relative == null || relative.isEmpty()) {
return Collections.emptyMap();
}
else {
return Collections.singletonMap(relative, null);
}
}
示例8: isValidForIndex
import com.intellij.util.indexing.FileContent; //导入依赖的package包/类
public static boolean isValidForIndex(@NotNull FileContent inputData, @NotNull PsiFile psiFile) {
String fileName = psiFile.getName();
if(fileName.startsWith(".") || fileName.endsWith("Test")) {
return false;
}
VirtualFile baseDir = inputData.getProject().getBaseDir();
if(baseDir == null) {
return false;
}
// is Test file in path name
String relativePath = VfsUtil.getRelativePath(inputData.getFile(), baseDir, '/');
if(relativePath != null && (relativePath.contains("/Test/") || relativePath.contains("/Fixtures/"))) {
return false;
}
return true;
}
示例9: buildStubTree
import com.intellij.util.indexing.FileContent; //导入依赖的package包/类
@Override
public StubElement buildStubTree(FileContent fileContent) {
try {
VirtualFile file = fileContent.getFile();
Project project = fileContent.getProject();
byte[] content = fileContent.getContent();
final ClsStubBuilderFactory[] factories = Extensions.getExtensions(ClsStubBuilderFactory.EP_NAME);
for (ClsStubBuilderFactory factory : factories) {
if (!factory.isInnerClass(file) && factory.canBeProcessed(file, content)) {
PsiFileStub stub = factory.buildFileStub(file, content, project);
if (stub != null) return stub;
}
}
if (!fileContent.getFileName().contains("$")) {
LOG.info("No stub built for file " + fileContent);
}
return null;
}
catch (ClsFormatException e) {
return null;
}
}
示例10: map
import com.intellij.util.indexing.FileContent; //导入依赖的package包/类
@Override
@NotNull
public Map<IdIndexEntry, Integer> map(final FileContent inputData) {
final IdDataConsumer consumer = new IdDataConsumer();
final CharSequence chars = inputData.getContentAsText();
scanWords(new ScanWordProcessor() {
@Override
public void run(final CharSequence chars11, @Nullable char[] charsArray, final int start, final int end) {
if (charsArray != null) {
consumer.addOccurrence(charsArray, start, end, (int)UsageSearchContext.IN_PLAIN_TEXT);
} else {
consumer.addOccurrence(chars11, start, end, (int)UsageSearchContext.IN_PLAIN_TEXT);
}
}
}, chars, 0, chars.length());
return consumer.getResult();
}
示例11: map
import com.intellij.util.indexing.FileContent; //导入依赖的package包/类
@NotNull
@Override
public Map<TodoIndexEntry, Integer> map(FileContent inputData) {
Map<TodoIndexEntry, Integer> result = ContainerUtil.newTroveMap();
for (DataIndexer<TodoIndexEntry, Integer, FileContent> indexer : indexers) {
for (Map.Entry<TodoIndexEntry, Integer> entry : indexer.map(inputData).entrySet()) {
TodoIndexEntry key = entry.getKey();
if (result.containsKey(key)) {
result.put(key, result.get(key) + entry.getValue());
} else {
result.put(key, entry.getValue());
}
}
}
return result;
}
示例12: map
import com.intellij.util.indexing.FileContent; //导入依赖的package包/类
/**
* Maps indexed files content to the {@link IgnoreEntryOccurrence}.
*
* @param inputData indexed file data
* @return {@link IgnoreEntryOccurrence} data mapped with {@link IgnoreFileTypeKey}
*/
@NotNull
@Override
public Map<IgnoreFileTypeKey, IgnoreEntryOccurrence> map(@NotNull final FileContent inputData) {
if (!(inputData.getPsiFile() instanceof IgnoreFile)) {
return Collections.emptyMap();
}
final IgnoreEntryOccurrence result = new IgnoreEntryOccurrence(inputData.getFile());
final IgnoreFileType type = (IgnoreFileType) inputData.getFileType();
IgnoreFile ignoreFile = (IgnoreFile) inputData.getPsiFile();
ignoreFile.acceptChildren(new IgnoreVisitor() {
@Override
public void visitEntry(@NotNull IgnoreEntry entry) {
final Pattern pattern = Glob.createPattern(entry);
if (pattern != null) {
result.add(pattern.matcher(""), entry.isNegated());
}
}
});
return Collections.singletonMap(new IgnoreFileTypeKey(type), result);
}
示例13: isValidForIndex
import com.intellij.util.indexing.FileContent; //导入依赖的package包/类
public static boolean isValidForIndex(FileContent inputData) {
String fileName = inputData.getPsiFile().getName();
if(fileName.startsWith(".") || fileName.contains("Test")) {
return false;
}
// we check for project path, on no match we are properly inside external library paths
String relativePath = VfsUtil.getRelativePath(inputData.getFile(), inputData.getProject().getBaseDir(), '/');
if(relativePath == null) {
return true;
}
// is Test file in path name
return !(relativePath.contains("\\Test\\") || relativePath.contains("\\Fixtures\\"));
}
示例14: map
import com.intellij.util.indexing.FileContent; //导入依赖的package包/类
@NotNull
@Override
public Map<String, String> map(FileContent inputData) {
Map<String, String> result = new THashMap<String, String>();
for (PsiElement child : inputData.getPsiFile().getChildren()) {
if (child instanceof ThriftTopLevelDeclaration) {
String topLevelName = ((ThriftTopLevelDeclaration)child).getName();
if (topLevelName != null) {
for (ThriftDeclaration declaration : ((ThriftTopLevelDeclaration)child).findSubDeclarations()) {
String subName = declaration.getName();
if (subName != null) {
result.put(subName, topLevelName);
}
}
}
}
}
return result;
}
示例15: map
import com.intellij.util.indexing.FileContent; //导入依赖的package包/类
@Nonnull
@Override
public Map<TodoIndexEntry, Integer> map(FileContent inputData) {
Map<TodoIndexEntry, Integer> result = ContainerUtil.newTroveMap();
for (DataIndexer<TodoIndexEntry, Integer, FileContent> indexer : indexers) {
for (Map.Entry<TodoIndexEntry, Integer> entry : indexer.map(inputData).entrySet()) {
TodoIndexEntry key = entry.getKey();
if (result.containsKey(key)) {
result.put(key, result.get(key) + entry.getValue());
}
else {
result.put(key, entry.getValue());
}
}
}
return result;
}