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


Java PsiFileSystemItem类代码示例

本文整理汇总了Java中com.intellij.psi.PsiFileSystemItem的典型用法代码示例。如果您正苦于以下问题:Java PsiFileSystemItem类的具体用法?Java PsiFileSystemItem怎么用?Java PsiFileSystemItem使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: isSupportedType

import com.intellij.psi.PsiFileSystemItem; //导入依赖的package包/类
/**
 * Optimized method.
 *
 * @param element
 *
 * @return
 */
@Contract(pure = true)
private boolean isSupportedType(final @Nullable PsiElement element) {
    return !(element instanceof PsiFileSystemItem) &&
           !(element instanceof ImpexAnyAttributeName) &&
           !(element instanceof ImpexAnyAttributeValue) &&
           !(element instanceof ImpexAnyHeaderParameterName) &&
           !(element instanceof ImpexAttribute) &&
           !(element instanceof ImpexFullHeaderType) &&
           !(element instanceof ImpexFullHeaderParameter) &&
           !(element instanceof ImpexHeaderTypeName) &&
           !(element instanceof ImpexParameter) &&
           !(element instanceof ImpexParameters) &&
           !(element instanceof ImpexAnyHeaderMode) &&
           !(element instanceof ImpexModifier) &&
           !(element instanceof ImpexModifiers) &&
           PsiTreeUtil.getParentOfType(element, ImpexHeaderLine.class) == null &&
           (element instanceof ImpexValueLine || element instanceof ImpexHeaderLine || aroundIsValueLine(element));
}
 
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:26,代码来源:ImpexFoldingLinesFilter.java

示例2: findPsiClass

import com.intellij.psi.PsiFileSystemItem; //导入依赖的package包/类
@Nullable
private PsiClass findPsiClass( PsiFileSystemItem element )
{
  Module mod = ModuleUtilCore.findModuleForPsiElement( element );
  if( mod == null )
  {
    return null;
  }

  ManModule module = ManProject.getModule( mod );
  String[] fqns = module.getTypesForFile( FileUtil.toIFile( module.getProject(), element.getVirtualFile() ) );
  PsiClass psiClass = null;
  for( String fqn: fqns )
  {
    psiClass = ManifoldPsiClassCache.instance().getPsiClass( GlobalSearchScope.moduleWithDependenciesAndLibrariesScope( module.getIjModule() ), module, fqn );
    if( psiClass != null )
    {
      break;
    }
  }
  return psiClass;
}
 
开发者ID:manifold-systems,项目名称:manifold-ij,代码行数:23,代码来源:MoveTypeManifoldFileProcessor.java

示例3: doResolve

import com.intellij.psi.PsiFileSystemItem; //导入依赖的package包/类
@Nullable
private TargetResolver.Result doResolve(@Nullable final String referenceText) {
  final AntDomElement hostingElement = getHostingAntDomElement();
  if (hostingElement == null) {
    return null;
  }
  AntDomProject projectToSearchFrom;
  AntDomTarget contextTarget;
  if (hostingElement instanceof AntDomAnt) {
    final PsiFileSystemItem antFile = ((AntDomAnt)hostingElement).getAntFilePath().getValue();
    projectToSearchFrom = antFile instanceof PsiFile ? AntSupport.getAntDomProjectForceAntFile((PsiFile)antFile) : null;
    contextTarget = null;
  }
  else {
    projectToSearchFrom = hostingElement.getContextAntProject();
    contextTarget = hostingElement.getParentOfType(AntDomTarget.class, false);
  }
  if (projectToSearchFrom == null) {
    return null;
  }
  return TargetResolver.resolve(projectToSearchFrom, contextTarget, referenceText == null? Collections.<String>emptyList() : Collections.singletonList(referenceText));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:AntDomTargetReference.java

示例4: getRoots

import com.intellij.psi.PsiFileSystemItem; //导入依赖的package包/类
@NotNull
@Override
public Collection<VirtualFile> getRoots() {
  Value value = getValue();

  if (value instanceof RootsProvider) {
    return ((RootsProvider)value).getRoots();
  } else if (value instanceof PsiFile) {
    PsiFile vFile = ((PsiFile)value).getContainingFile();
    if (vFile != null && vFile.getVirtualFile() != null) {
      return Collections.singleton(vFile.getVirtualFile());
    }
  } else if (value instanceof VirtualFile) {
    return Collections.singleton(((VirtualFile)value));
  } else if (value instanceof PsiFileSystemItem) {
    return Collections.singleton(((PsiFileSystemItem)value).getVirtualFile());
  }

  return EMPTY_ROOTS;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:ProjectViewNode.java

示例5: getRelativePath

import com.intellij.psi.PsiFileSystemItem; //导入依赖的package包/类
@Nullable
public static String getRelativePath(PsiFileSystemItem src, PsiFileSystemItem dst) {
  final PsiFileSystemItem commonAncestor = getCommonAncestor(src, dst);

  if (commonAncestor != null) {
    StringBuilder buffer = new StringBuilder();
    if (!src.equals(commonAncestor)) {
      while (!commonAncestor.equals(src.getParent())) {
        buffer.append("..").append('/');
        src = src.getParent();
        assert src != null;
      }
    }
    buffer.append(getRelativePathFromAncestor(dst, commonAncestor));
    return buffer.toString();
  }

  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:PsiFileSystemItemUtil.java

示例6: computeFiles

import com.intellij.psi.PsiFileSystemItem; //导入依赖的package包/类
@Override
protected VirtualFile[] computeFiles(final PsiFile file, final boolean compileTimeOnly) {
  final Set<VirtualFile> files = new THashSet<VirtualFile>();
  processIncludes(file, new Processor<FileIncludeInfo>() {
    @Override
    public boolean process(FileIncludeInfo info) {
      if (compileTimeOnly != info.runtimeOnly) {
        PsiFileSystemItem item = resolveFileInclude(info, file);
        if (item != null) {
          ContainerUtil.addIfNotNull(files, item.getVirtualFile());
        }
      }
      return true;
    }

  });
  return VfsUtilCore.toVirtualFileArray(files);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:FileIncludeManagerImpl.java

示例7: getContextsForModule

import com.intellij.psi.PsiFileSystemItem; //导入依赖的package包/类
static Collection<PsiFileSystemItem> getContextsForModule(@NotNull Module module, @NotNull String packageName, @Nullable GlobalSearchScope scope) {
  List<PsiFileSystemItem> result = null;
  Query<VirtualFile> query = DirectoryIndex.getInstance(module.getProject()).getDirectoriesByPackageName(packageName, false);
  PsiManager manager = null;

  for(VirtualFile file:query) {
    if (scope != null && !scope.contains(file)) continue;
    if (result == null) {
      result = new ArrayList<PsiFileSystemItem>();
      manager = PsiManager.getInstance(module.getProject());
    }
    PsiDirectory psiDirectory = manager.findDirectory(file);
    if (psiDirectory != null) result.add(psiDirectory);
  }

  return result != null ? result:Collections.<PsiFileSystemItem>emptyList();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:PsiFileReferenceHelper.java

示例8: showCoverage

import com.intellij.psi.PsiFileSystemItem; //导入依赖的package包/类
private boolean showCoverage(PsiFileSystemItem psiFile) {
  if (coverageFilePaths.isEmpty()) {
    return false;
  }
  VirtualFile vf = psiFile.getVirtualFile();
  if (vf == null) {
    return false;
  }
  String filePath = normalizeFilePath(vf.getPath());
  for (String path : coverageFilePaths) {
    if (filePath.startsWith(path)) {
      return true;
    }
  }
  return false;
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:17,代码来源:BlazeCoverageAnnotator.java

示例9: findNode

import com.intellij.psi.PsiFileSystemItem; //导入依赖的package包/类
@Nullable
public PackageDependenciesNode findNode(PsiFileSystemItem file, final PsiElement psiElement) {
  if (file instanceof PsiDirectory) {
    return getModuleDirNode(file.getVirtualFile(), myFileIndex.getModuleForFile(file.getVirtualFile()), null);
  }
  PackageDependenciesNode parent = getFileParentNode(file.getVirtualFile());
  PackageDependenciesNode[] nodes = findNodeForPsiElement(parent, file);
  if (nodes == null || nodes.length == 0) {
    return null;
  }
  else {
    for (PackageDependenciesNode node : nodes) {
      if (node.getPsiElement() == psiElement) return node;
    }
    return nodes[0];
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:FileTreeModelBuilder.java

示例10: getProjectBasedir

import com.intellij.psi.PsiFileSystemItem; //导入依赖的package包/类
@Nullable
public final PsiFileSystemItem getProjectBasedir() {
  final PsiFileSystemItem basedir = getBasedir().getValue();
  if (basedir != null) {
    return basedir;
  }
  final XmlTag tag = getXmlTag();
  final VirtualFile containingFile = tag.getContainingFile().getOriginalFile().getVirtualFile();
  if (containingFile == null) {
    return null;
  }
  final VirtualFile parent = containingFile.getParent();
  if (parent == null) {
    return null;
  }
  return tag.getManager().findDirectory(parent);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:AntDomProject.java

示例11: actionPerformed

import com.intellij.psi.PsiFileSystemItem; //导入依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
  if (e.getData(LangDataKeys.IDE_VIEW) == null) {
    final Project project = e.getData(CommonDataKeys.PROJECT);
    final PsiFileSystemItem psiFile = e.getData(CommonDataKeys.PSI_FILE).getParent();
    ProjectViewImpl.getInstance(project).selectCB(psiFile, psiFile.getVirtualFile(), true).doWhenDone(new Runnable() {
      @Override
      public void run() {
        showPopup(DataManager.getInstance().getDataContext());
      }
    });
  }
  else {
    super.actionPerformed(e);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:NewElementToolbarAction.java

示例12: filterElements

import com.intellij.psi.PsiFileSystemItem; //导入依赖的package包/类
@Override
public boolean filterElements(@NotNull ChooseByNameBase base,
                              @NotNull String pattern,
                              boolean everywhere,
                              @NotNull ProgressIndicator indicator,
                              @NotNull Processor<Object> consumer) {
  if (pattern.contains("/") || pattern.contains("\\")) {
    String path = FileUtil.toSystemIndependentName(ChooseByNamePopup.getTransformedPattern(pattern, myModel));
    VirtualFile vFile = LocalFileSystem.getInstance().findFileByPathIfCached(path);
    if (vFile != null) {
      ProjectFileIndex index = ProjectFileIndex.SERVICE.getInstance(myProject);
      if (index.isInContent(vFile) || index.isInLibraryClasses(vFile) || index.isInLibrarySource(vFile)) {
        PsiFileSystemItem fileOrDir = vFile.isDirectory() ?
                                      PsiManager.getInstance(myProject).findDirectory(vFile) :
                                      PsiManager.getInstance(myProject).findFile(vFile);
        if (fileOrDir != null && !consumer.process(fileOrDir)) {
          return false;
        }
      }
    }
  }

  return super.filterElements(base, pattern, everywhere, indicator, consumer);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:GotoFileItemProvider.java

示例13: getContainerText

import com.intellij.psi.PsiFileSystemItem; //导入依赖的package包/类
@Override
protected String getContainerText(PsiElement element, String name) {
  if (element instanceof PsiFileSystemItem) {
    PsiFileSystemItem parent = ((PsiFileSystemItem)element).getParent();
    final PsiDirectory psiDirectory = parent instanceof PsiDirectory ? (PsiDirectory)parent : null;
    VirtualFile virtualFile = psiDirectory == null ? null : psiDirectory.getVirtualFile();
    if (virtualFile == null) return null;
    final String relativePath = getRelativePath(virtualFile, element.getProject());
    if (relativePath == null) return "( " + File.separator + " )";
    int width = myList.getWidth();
    if (width == 0) width += 800;
    String path = FilePathSplittingPolicy.SPLIT_BY_SEPARATOR.getOptimalTextForComponent(name, new File(relativePath), this, width - myRightComponentWidth - 16 - 10);
    return "(" + path + ")";
  }
  return getSymbolContainerText(name, element);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:SearchEverywherePsiRenderer.java

示例14: getChildrenImpl

import com.intellij.psi.PsiFileSystemItem; //导入依赖的package包/类
@Nullable
@Override
protected Collection<AbstractTreeNode> getChildrenImpl() {
  if (isAlwaysLeaf()) return Collections.emptyList();
  return ApplicationManager.getApplication().runReadAction(new Computable<Collection<AbstractTreeNode>>() {
    @Override
    public Collection<AbstractTreeNode> compute() {
      final PsiFileSystemItem value = getValue();
      if (value == null || !value.isValid()) return Collections.emptyList();
      final List<AbstractTreeNode> list = ContainerUtil.newArrayList();
      value.processChildren(new PsiElementProcessor<PsiFileSystemItem>() {
        @Override
        public boolean execute(@NotNull PsiFileSystemItem element) {
          if (!myRootType.isIgnored(value.getProject(), element.getVirtualFile())) {
            list.add(new MyPsiNode(value.getProject(), myRootType, element));
          }
          return true;
        }
      });
      return list;
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:ScratchProjectViewPane.java

示例15: calcPropertyValue

import com.intellij.psi.PsiFileSystemItem; //导入依赖的package包/类
@Nullable
protected final String calcPropertyValue(String propertyName) {
  final PsiFileSystemItem fsItem = getFile().getValue();
  if (fsItem != null) {
    final PsiFileSystemItem parent = fsItem.getParent();
    if (parent != null) {
      final VirtualFile vFile = parent.getVirtualFile();
      if (vFile != null) {
        return FileUtil.toSystemDependentName(vFile.getPath());
      }
    }
  }
  // according to the doc, defaulting to project's current dir
  final String projectBasedirPath = getContextAntProject().getProjectBasedirPath();
  if (projectBasedirPath == null) {
    return null;
  }
  return FileUtil.toSystemDependentName(projectBasedirPath);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:AntDomDirname.java


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