本文整理匯總了Java中com.intellij.psi.PsiFile.getOriginalFile方法的典型用法代碼示例。如果您正苦於以下問題:Java PsiFile.getOriginalFile方法的具體用法?Java PsiFile.getOriginalFile怎麽用?Java PsiFile.getOriginalFile使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.intellij.psi.PsiFile
的用法示例。
在下文中一共展示了PsiFile.getOriginalFile方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: doGetExternalModel
import com.intellij.psi.PsiFile; //導入方法依賴的package包/類
@NotNull
private TSMetaModelImpl doGetExternalModel(final @NotNull PsiFile contextFile) {
final PsiFile originalFile = contextFile.getOriginalFile();
final VirtualFile vFile = originalFile.getVirtualFile();
final Project project = originalFile.getProject();
CachedValue<TSMetaModelImpl> externalModelCache = originalFile.getUserData(EXTERNAL_MODEL_CACHE_KEY);
if (externalModelCache == null) {
externalModelCache = CachedValuesManager.getManager(project).createCachedValue(
() -> ApplicationManager.getApplication().runReadAction(
(Computable<CachedValueProvider.Result<TSMetaModelImpl>>) () -> {
final List<VirtualFile> excludes = vFile == null
? Collections.emptyList()
: Collections.singletonList(vFile);
final TSMetaModelBuilder builder = new TSMetaModelBuilder(project, excludes);
final TSMetaModelImpl model = builder.buildModel();
return CachedValueProvider.Result.create(model, builder.getFiles());
}), false);
originalFile.putUserData(EXTERNAL_MODEL_CACHE_KEY, externalModelCache);
}
return externalModelCache.getValue();
}
開發者ID:AlexanderBartash,項目名稱:hybris-integration-intellij-idea-plugin,代碼行數:27,代碼來源:TSMetaModelAccessImpl.java
示例2: toVirtualFile
import com.intellij.psi.PsiFile; //導入方法依賴的package包/類
public static VirtualFile toVirtualFile( PsiFile file )
{
VirtualFile vfile = file.getUserData( IndexingDataKeys.VIRTUAL_FILE );
if( vfile == null )
{
vfile = file.getVirtualFile();
if( vfile == null )
{
vfile = file.getOriginalFile().getVirtualFile();
if( vfile == null )
{
vfile = file.getViewProvider().getVirtualFile();
}
}
else if( vfile instanceof LightVirtualFile )
{
PsiFile containingFile = file.getContainingFile();
if( containingFile != null && containingFile != file )
{
PsiFile originalFile = containingFile.getOriginalFile();
SmartPsiElementPointer owningFile = originalFile.getUserData( FileContextUtil.INJECTED_IN_ELEMENT );
if( owningFile != null )
{
vfile = owningFile.getVirtualFile();
}
}
}
}
return vfile;
}