use of com.intellij.javascript.flex.css.FlexStyleIndexInfo in project intellij-plugins by JetBrains.
the class LibraryStyleInfoCollector method collectInherited.
private byte[] collectInherited(final VirtualFile jarFile) {
bytes.allocateShort();
final VirtualFile libraryFile = Library.getSwfFile(jarFile);
final FileBasedIndex fileBasedIndex = FileBasedIndex.getInstance();
final GlobalSearchScope searchScope = GlobalSearchScope.fileScope(module.getProject(), libraryFile);
final List<String> dataKeys = new ArrayList<>(32);
fileBasedIndex.processAllKeys(FlexStyleIndex.INDEX_ID, dataKey -> {
dataKeys.add(dataKey);
return true;
}, module.getProject());
final THashSet<String> uniqueGuard = new THashSet<>();
final FileBasedIndex.ValueProcessor<Set<FlexStyleIndexInfo>> processor = (file, value) -> {
final FlexStyleIndexInfo firstInfo = value.iterator().next();
if (firstInfo.getInherit().charAt(0) == 'y' && uniqueGuard.add(firstInfo.getAttributeName())) {
bytes.writeUInt29(stringWriter.getReference(firstInfo.getAttributeName()) - 1);
}
// may not be in a class stylePName be inherited, and another class of the same library not inherited
return false;
};
for (String dataKey : dataKeys) {
fileBasedIndex.processValues(FlexStyleIndex.INDEX_ID, dataKey, libraryFile, processor, searchScope);
}
if (uniqueGuard.isEmpty()) {
return null;
} else {
bytes.putShort(uniqueGuard.size(), 0);
return bytes.getByteArrayOut().toByteArray();
}
}
Aggregations