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


Java FileManager.findCachedViewProvider方法代码示例

本文整理汇总了Java中com.intellij.psi.impl.file.impl.FileManager.findCachedViewProvider方法的典型用法代码示例。如果您正苦于以下问题:Java FileManager.findCachedViewProvider方法的具体用法?Java FileManager.findCachedViewProvider怎么用?Java FileManager.findCachedViewProvider使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.psi.impl.file.impl.FileManager的用法示例。


在下文中一共展示了FileManager.findCachedViewProvider方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getPsi

import com.intellij.psi.impl.file.impl.FileManager; //导入方法依赖的package包/类
@Override
@Nullable
public final PsiFile getPsi(@NotNull Language target) {
  if (!isPhysical()) {
    FileManager fileManager = ((PsiManagerEx)myManager).getFileManager();
    VirtualFile virtualFile = getVirtualFile();
    if (fileManager.findCachedViewProvider(virtualFile) == null) {
      fileManager.setViewProvider(virtualFile, this);
    }
  }
  return getPsiInner(target);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:SingleRootFileViewProvider.java

示例2: getPsi

import com.intellij.psi.impl.file.impl.FileManager; //导入方法依赖的package包/类
@Override
@Nullable
public final PsiFile getPsi(@Nonnull Language target) {
  if (!isPhysical()) {
    FileManager fileManager = getManager().getFileManager();
    VirtualFile virtualFile = getVirtualFile();
    if (fileManager.findCachedViewProvider(virtualFile) == null && getCachedPsiFiles().isEmpty()) {
      fileManager.setViewProvider(virtualFile, this);
    }
  }
  return getPsiInner(target);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:13,代码来源:AbstractFileViewProvider.java

示例3: doPostponedFormattingInner

import com.intellij.psi.impl.file.impl.FileManager; //导入方法依赖的package包/类
private void doPostponedFormattingInner(@NotNull FileViewProvider key) {
  final List<ASTNode> astNodes = getContext().myReformatElements.remove(key);
  final Document document = key.getDocument();
  // Sort ranges by end offsets so that we won't need any offset adjustment after reformat or reindent
  if (document == null) return;

  final VirtualFile virtualFile = key.getVirtualFile();
  if (!virtualFile.isValid()) return;

  PsiManager manager = key.getManager();
  if (manager instanceof PsiManagerEx) {
    FileManager fileManager = ((PsiManagerEx)manager).getFileManager();
    FileViewProvider viewProvider = fileManager.findCachedViewProvider(virtualFile);
    if (viewProvider != key) { // viewProvider was invalidated e.g. due to language level change
      if (viewProvider == null) viewProvider = fileManager.findViewProvider(virtualFile);
      if (viewProvider != null) {
        key = viewProvider;
      }
    }
  }

  final TreeSet<PostprocessFormattingTask> postProcessTasks = new TreeSet<PostprocessFormattingTask>();
  Collection<Disposable> toDispose = ContainerUtilRt.newArrayList();
  try {
    // process all roots in viewProvider to find marked for reformat before elements and create appropriate range markers
    handleReformatMarkers(key, postProcessTasks);
    toDispose.addAll(postProcessTasks);

    // then we create ranges by changed nodes. One per node. There ranges can intersect. Ranges are sorted by end offset.
    if (astNodes != null) createActionsMap(astNodes, key, postProcessTasks);

    if (Boolean.getBoolean("check.psi.is.valid") && ApplicationManager.getApplication().isUnitTestMode()) {
      checkPsiIsCorrect(key);
    }

    while (!postProcessTasks.isEmpty()) {
      // now we have to normalize actions so that they not intersect and ordered in most appropriate way
      // (free reformatting -> reindent -> formatting under reindent)
      final List<PostponedAction> normalizedActions = normalizeAndReorderPostponedActions(postProcessTasks, document);
      toDispose.addAll(normalizedActions);

      // only in following loop real changes in document are made
      for (final PostponedAction normalizedAction : normalizedActions) {
        CodeStyleSettings settings = CodeStyleSettingsManager.getSettings(myPsiManager.getProject());
        boolean old = settings.ENABLE_JAVADOC_FORMATTING;
        settings.ENABLE_JAVADOC_FORMATTING = false;
        try {
          normalizedAction.execute(key);
        }
        finally {
          settings.ENABLE_JAVADOC_FORMATTING = old;
        }
      }
    }
  }
  finally {
    for (Disposable disposable : toDispose) {
      //noinspection SSBasedInspection
      disposable.dispose();
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:63,代码来源:PostprocessReformattingAspect.java


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