當前位置: 首頁>>代碼示例>>Java>>正文


Java PsiFile.getUserData方法代碼示例

本文整理匯總了Java中com.intellij.psi.PsiFile.getUserData方法的典型用法代碼示例。如果您正苦於以下問題:Java PsiFile.getUserData方法的具體用法?Java PsiFile.getUserData怎麽用?Java PsiFile.getUserData使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.intellij.psi.PsiFile的用法示例。


在下文中一共展示了PsiFile.getUserData方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getViewVariables

import com.intellij.psi.PsiFile; //導入方法依賴的package包/類
@NotNull
public static ArrayList<String> getViewVariables(PsiFile psiFile) {
    ArrayList<String> result = null;

    Long viewModified = psiFile.getUserData(VIEW_FILE_MODIFIED);
    if (viewModified != null && psiFile.getModificationStamp() == viewModified) {
        result = psiFile.getUserData(VIEW_VARIABLES);
    }

    if (result == null) {
        if (psiFile instanceof PhpFile) {
            result = getPhpViewVariables(psiFile);
        }

        if (result == null) {
            result = new ArrayList<>();
        }

        psiFile.putUserData(VIEW_VARIABLES, result);
        psiFile.putUserData(VIEW_FILE_MODIFIED, psiFile.getModificationStamp());
    }

    return new ArrayList<>(result);
}
 
開發者ID:nvlad,項目名稱:yii2support,代碼行數:25,代碼來源:ViewsUtil.java

示例2: getTypeSystemMeta

import com.intellij.psi.PsiFile; //導入方法依賴的package包/類
@Override
public synchronized TSMetaModel getTypeSystemMeta(@Nullable final PsiFile contextFile) {
    if (contextFile == null || !TSMetaModelBuilder.isTsFile(contextFile)) {
        return myCachedValue.getValue();
    }
    final TSMetaModelImpl externalModel = doGetExternalModel(contextFile);
    final Project project = contextFile.getProject();
    CachedValue<TSMetaModelImpl> fileModelCache = contextFile.getUserData(FILE_MODEL_CACHE_KEY);

    if (fileModelCache == null) {
        fileModelCache = CachedValuesManager.getManager(project).createCachedValue(
            () -> ApplicationManager.getApplication().runReadAction(
                (Computable<CachedValueProvider.Result<TSMetaModelImpl>>) () -> {

                    final TSMetaModelBuilder builder = new TSMetaModelBuilder(project);
                    final TSMetaModelImpl modelForFile = builder.buildModelForFile(contextFile);
                    return CachedValueProvider.Result.create(modelForFile, contextFile);

                }), false);
        contextFile.putUserData(FILE_MODEL_CACHE_KEY, fileModelCache);
    }
    final TSMetaModelImpl fileModel = fileModelCache.getValue();
    return new TSMetaModelImpl(Arrays.asList(externalModel, fileModel));
}
 
開發者ID:AlexanderBartash,項目名稱:hybris-integration-intellij-idea-plugin,代碼行數:25,代碼來源:TSMetaModelAccessImpl.java

示例3: 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

示例4: getRootDirectory

import com.intellij.psi.PsiFile; //導入方法依賴的package包/類
public static PsiDirectory getRootDirectory(PsiElement element) {
    final PsiFile file = element.getContainingFile();

    if (file.getUserData(VIEWS_DIRECTORY) != null) {
        Long modified = file.getUserData(VIEWS_DIRECTORY_MODIFIED);
        if (modified != null && modified == file.getModificationStamp()) {
            return file.getUserData(VIEWS_DIRECTORY);
        }
    }

    return findDirectory(element);
}
 
開發者ID:nvlad,項目名稱:yii2support,代碼行數:13,代碼來源:ViewsUtil.java

示例5: getContextDirectory

import com.intellij.psi.PsiFile; //導入方法依賴的package包/類
public static PsiDirectory getContextDirectory(PsiElement element) {
    final PsiFile file = element.getContainingFile();

    if (file.getUserData(VIEWS_CONTEXT_DIRECTORY) != null) {
        Long modified = file.getUserData(VIEWS_DIRECTORY_MODIFIED);
        if (modified != null && modified == file.getModificationStamp()) {
            return file.getUserData(VIEWS_CONTEXT_DIRECTORY);
        }
    }

    findDirectory(element);

    return file.getUserData(VIEWS_CONTEXT_DIRECTORY);
}
 
開發者ID:nvlad,項目名稱:yii2support,代碼行數:15,代碼來源:ViewsUtil.java

示例6: find

import com.intellij.psi.PsiFile; //導入方法依賴的package包/類
public static PsiElement find( PsiElement resolve )
{
  PsiFile file = resolve.getContainingFile();
  if( file != null )
  {
    ManifoldPsiClass facade = resolve instanceof ManifoldPsiClass ? (ManifoldPsiClass)resolve : file.getUserData( ManifoldPsiClass.KEY_MANIFOLD_PSI_CLASS );
    if( facade != null )
    {
      PsiElement annotations = find( (PsiModifierListOwner)resolve, facade );
      if( annotations != null ) return annotations;
    }
  }
  return null;
}
 
開發者ID:manifold-systems,項目名稱:manifold-ij,代碼行數:15,代碼來源:ManGotoDeclarationHandler.java

示例7: 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;
}
 
開發者ID:manifold-systems,項目名稱:manifold-ij,代碼行數:31,代碼來源:FileUtil.java


注:本文中的com.intellij.psi.PsiFile.getUserData方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。