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


Java ModuleFileIndex.isInContent方法代码示例

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


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

示例1: addAllSubpackages

import com.intellij.openapi.roots.ModuleFileIndex; //导入方法依赖的package包/类
public void addAllSubpackages(List<AbstractTreeNode> container,
                              PsiDirectory dir,
                              @Nullable ModuleFileIndex moduleFileIndex,
                              ViewSettings viewSettings) {
  final Project project = dir.getProject();
  PsiDirectory[] subdirs = dir.getSubdirectories();
  for (PsiDirectory subdir : subdirs) {
    if (skipDirectory(subdir)) {
      continue;
    }
    if (moduleFileIndex != null && !moduleFileIndex.isInContent(subdir.getVirtualFile())) {
      container.add(new PsiDirectoryNode(project, subdir, viewSettings));
      continue;
    }
    if (viewSettings.isHideEmptyMiddlePackages()) {
      if (!isEmptyMiddleDirectory(subdir, false)) {

        container.add(new PsiDirectoryNode(project, subdir, viewSettings));
      }
    }
    else {
      container.add(new PsiDirectoryNode(project, subdir, viewSettings));
    }
    addAllSubpackages(container, subdir, moduleFileIndex, viewSettings);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:ProjectViewDirectoryHelper.java

示例2: addNode

import com.intellij.openapi.roots.ModuleFileIndex; //导入方法依赖的package包/类
public static void addNode(ModuleFileIndex moduleFileIndex,
                           VirtualFile vFile,
                           List<AbstractTreeNode> container,
                           Class<? extends AbstractTreeNode> nodeClass,
                           PsiElement element,
                           final ViewSettings settings) {
  if (vFile == null) {
    return;
  }
  // this check makes sense for classes not in library content only
  if (moduleFileIndex != null && !moduleFileIndex.isInContent(vFile)) {
    return;
  }

  try {
    container.add(ProjectViewNode.createTreeNode(nodeClass, element.getProject(), element, settings));
  }
  catch (Exception e) {
    LOGGER.error(e);
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:22,代码来源:BaseProjectViewDirectoryHelper.java

示例3: addAllSubpackages

import com.intellij.openapi.roots.ModuleFileIndex; //导入方法依赖的package包/类
@RequiredReadAction
public static void addAllSubpackages(List<AbstractTreeNode> container, PsiDirectory dir, ModuleFileIndex moduleFileIndex, ViewSettings viewSettings) {
  final Project project = dir.getProject();
  PsiDirectory[] subdirs = dir.getSubdirectories();
  for (PsiDirectory subdir : subdirs) {
    if (skipDirectory(subdir)) {
      continue;
    }
    if (moduleFileIndex != null) {
      if (!moduleFileIndex.isInContent(subdir.getVirtualFile())) {
        container.add(new PsiDirectoryNode(project, subdir, viewSettings));
        continue;
      }
    }
    if (viewSettings.isHideEmptyMiddlePackages()) {
      if (!isEmptyMiddleDirectory(subdir, false)) {

        container.add(new PsiDirectoryNode(project, subdir, viewSettings));
      }
    }
    else {
      container.add(new PsiDirectoryNode(project, subdir, viewSettings));
    }
    addAllSubpackages(container, subdir, moduleFileIndex, viewSettings);
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:27,代码来源:BaseProjectViewDirectoryHelper.java

示例4: processPsiDirectoryChildren

import com.intellij.openapi.roots.ModuleFileIndex; //导入方法依赖的package包/类
public void processPsiDirectoryChildren(final PsiDirectory psiDir,
                                        PsiElement[] children,
                                        List<AbstractTreeNode> container,
                                        ProjectFileIndex projectFileIndex,
                                        @Nullable ModuleFileIndex moduleFileIndex,
                                        ViewSettings viewSettings,
                                        boolean withSubDirectories) {
  for (PsiElement child : children) {
    LOG.assertTrue(child.isValid());

    if (!(child instanceof PsiFileSystemItem)) {
      LOG.error("Either PsiFile or PsiDirectory expected as a child of " + child.getParent() + ", but was " + child);
      continue;
    }
    final VirtualFile vFile = ((PsiFileSystemItem) child).getVirtualFile();
    if (vFile == null) {
      continue;
    }
    if (moduleFileIndex != null && !moduleFileIndex.isInContent(vFile)) {
      continue;
    }
    if (child instanceof PsiFile) {
      container.add(new PsiFileNode(child.getProject(), (PsiFile) child, viewSettings));
    }
    else if (child instanceof PsiDirectory) {
      if (withSubDirectories) {
        PsiDirectory dir = (PsiDirectory)child;
        if (!vFile.equals(projectFileIndex.getSourceRootForFile(vFile))) { // if is not a source root
          if (viewSettings.isHideEmptyMiddlePackages() && !skipDirectory(psiDir) && isEmptyMiddleDirectory(dir, true)) {
            processPsiDirectoryChildren(dir, directoryChildrenInProject(dir, viewSettings),
                                        container, projectFileIndex, moduleFileIndex, viewSettings, withSubDirectories); // expand it recursively
            continue;
          }
        }
        container.add(new PsiDirectoryNode(child.getProject(), (PsiDirectory) child, viewSettings));
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:40,代码来源:ProjectViewDirectoryHelper.java

示例5: getChildren

import com.intellij.openapi.roots.ModuleFileIndex; //导入方法依赖的package包/类
@Override
@NotNull
public Collection<AbstractTreeNode> getChildren() {
  Module module = getValue();
  if (module == null || module.isDisposed()) {  // module has been disposed
    return Collections.emptyList();
  }
  ModuleRootManager rootManager = ModuleRootManager.getInstance(module);
  ModuleFileIndex moduleFileIndex = rootManager.getFileIndex();

  final VirtualFile[] contentRoots = rootManager.getContentRoots();
  final List<AbstractTreeNode> children = new ArrayList<AbstractTreeNode>(contentRoots.length + 1);
  final PsiManager psiManager = PsiManager.getInstance(module.getProject());
  for (final VirtualFile contentRoot : contentRoots) {
    if (!moduleFileIndex.isInContent(contentRoot)) continue;

    if (contentRoot.isDirectory()) {
      PsiDirectory directory = psiManager.findDirectory(contentRoot);
      if (directory != null) {
        children.add(new PsiDirectoryNode(getProject(), directory, getSettings()));
      }
    }
    else {
      PsiFile file = psiManager.findFile(contentRoot);
      if (file != null) {
        children.add(new PsiFileNode(getProject(), file, getSettings()));
      }
    }
  }

  /*
  if (getSettings().isShowLibraryContents()) {
    children.add(new LibraryGroupNode(getProject(), new LibraryGroupElement(getValue()), getSettings()));
  }
  */
  return children;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:38,代码来源:ProjectViewModuleNode.java

示例6: addFlattenedSingleChild

import com.intellij.openapi.roots.ModuleFileIndex; //导入方法依赖的package包/类
private void addFlattenedSingleChild(@NotNull final Project project,
                                     @NotNull final ArrayList<AbstractTreeNode> children,
                                     @NotNull final Module module) {
  final ModuleRootManager rootManager = ModuleRootManager.getInstance(module);
  final ModuleFileIndex moduleFileIndex = rootManager.getFileIndex();
  final PsiManager psiManager = PsiManager.getInstance(project);
  final VirtualFile[] contentRoots = rootManager.getContentRoots();

  if(contentRoots.length == 1) {
    final VirtualFile contentRoot = contentRoots[0];

    if(moduleFileIndex.isInContent(contentRoot)) {
      final AbstractTreeNode child;

      if(contentRoot.isDirectory()) {
        final PsiDirectory directory = psiManager.findDirectory(contentRoot);
        child = new DefracViewDirectoryNode(project, checkNotNull(directory), getSettings());
      } else {
        child = new DefracViewModuleNode(project, module, getSettings());
      }

      children.add(child);
    }
  } else {
    children.add(new DefracViewModuleNode(project, module, getSettings()));
  }
}
 
开发者ID:defrac,项目名称:defrac-plugin-intellij,代码行数:28,代码来源:DefracViewPlatformNode.java

示例7: getDirectoryChildren

import com.intellij.openapi.roots.ModuleFileIndex; //导入方法依赖的package包/类
public static void getDirectoryChildren(final PsiDirectory psiDirectory, final Object rootElement, final List<Object> result) {
  final ModuleFileIndex moduleFileIndex =
    rootElement instanceof Module ? ModuleRootManager.getInstance((Module)rootElement).getFileIndex() : null;
  final PsiElement[] children = psiDirectory.getChildren();
  for (PsiElement child : children) {
    if (child != null && child.isValid()) {
      if (moduleFileIndex != null) {
        final VirtualFile virtualFile = PsiUtilBase.getVirtualFile(child);
        if (virtualFile != null && !moduleFileIndex.isInContent(virtualFile)) continue;
      }
      result.add(normalize(child));
    }
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:15,代码来源:NavBarModel.java

示例8: addNode

import com.intellij.openapi.roots.ModuleFileIndex; //导入方法依赖的package包/类
public void addNode(ModuleFileIndex moduleFileIndex,
                            ProjectFileIndex projectFileIndex,
                            PsiDirectory psiDir,
                            VirtualFile vFile,
                            List<AbstractTreeNode> container,
                            Class<? extends AbstractTreeNode> nodeClass,
                            PsiElement element,
                            final ViewSettings settings) {
  if (vFile == null) {
    return;
  }
  // this check makes sense for classes not in library content only
  if (moduleFileIndex != null && !moduleFileIndex.isInContent(vFile)) {
    return;
  }
  /*
  final boolean childInLibraryClasses = projectFileIndex.isInLibraryClasses(vFile);
  if (!projectFileIndex.isInSourceContent(vFile)) {
    if (childInLibraryClasses) {
      final VirtualFile psiDirVFile = psiDir.getVirtualFile();
      final boolean parentInLibraryContent =
        projectFileIndex.isInLibraryClasses(psiDirVFile) || projectFileIndex.isInLibrarySource(psiDirVFile);
      if (!parentInLibraryContent) {
        return;
      }
    }
  }
  if (childInLibraryClasses && !projectFileIndex.isInContent(vFile) && !showFileInLibClasses(vFile)) {
    return; // skip java sources in classpath
  }
  */

  try {
    container.add(ProjectViewNode.createTreeNode(nodeClass, element.getProject(), element, settings));
  }
  catch (Exception e) {
    LOG.error(e);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:40,代码来源:ProjectViewDirectoryHelper.java

示例9: addAllSubpackages

import com.intellij.openapi.roots.ModuleFileIndex; //导入方法依赖的package包/类
public void addAllSubpackages(List<AbstractTreeNode> container,
                                      PsiDirectory dir,
                                      ModuleFileIndex moduleFileIndex,
                                      ViewSettings viewSettings) {
  final Project project = dir.getProject();
  PsiDirectory[] subdirs = dir.getSubdirectories();
  for (PsiDirectory subdir : subdirs) {
    if (skipDirectory(subdir)) {
      continue;
    }
    if (moduleFileIndex != null) {
      if (!moduleFileIndex.isInContent(subdir.getVirtualFile())) {
        container.add(new PsiDirectoryNode(project, subdir, viewSettings));
        continue;
      }
    }
    if (viewSettings.isHideEmptyMiddlePackages()) {
      if (!isEmptyMiddleDirectory(subdir, false)) {

        container.add(new PsiDirectoryNode(project, subdir, viewSettings));
      }
    }
    else {
      container.add(new PsiDirectoryNode(project, subdir, viewSettings));
    }
    addAllSubpackages(container, subdir, moduleFileIndex, viewSettings);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:29,代码来源:ProjectViewDirectoryHelper.java

示例10: getChildren

import com.intellij.openapi.roots.ModuleFileIndex; //导入方法依赖的package包/类
@Override
@NotNull
public Collection<AbstractTreeNode> getChildren() {
  Module module = getValue();
  if (module == null) {  // module has been disposed
    return Collections.emptyList();
  }
  ModuleRootManager rootManager = ModuleRootManager.getInstance(module);
  ModuleFileIndex moduleFileIndex = rootManager.getFileIndex();

  final VirtualFile[] contentRoots = rootManager.getContentRoots();
  final List<AbstractTreeNode> children = new ArrayList<AbstractTreeNode>(contentRoots.length + 1);
  final PsiManager psiManager = PsiManager.getInstance(getProject());
  for (final VirtualFile contentRoot : contentRoots) {
    LOG.assertTrue(contentRoot.isDirectory());

    if (!moduleFileIndex.isInContent(contentRoot)) continue;

    final PsiDirectory psiDirectory = psiManager.findDirectory(contentRoot);
    LOG.assertTrue(psiDirectory != null);

    PsiDirectoryNode directoryNode = new PsiDirectoryNode(getProject(), psiDirectory, getSettings());
    children.add(directoryNode);
  }

  /*
  if (getSettings().isShowLibraryContents()) {
    children.add(new LibraryGroupNode(getProject(), new LibraryGroupElement(getValue()), getSettings()));
  }
  */
  return children;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:33,代码来源:ProjectViewModuleNode.java

示例11: getChildren

import com.intellij.openapi.roots.ModuleFileIndex; //导入方法依赖的package包/类
@Override
@Nonnull
public Collection<AbstractTreeNode> getChildren() {
  Module module = getValue();
  if (module == null) {  // module has been disposed
    return Collections.emptyList();
  }
  ModuleRootManager rootManager = ModuleRootManager.getInstance(module);
  ModuleFileIndex moduleFileIndex = rootManager.getFileIndex();

  final VirtualFile[] contentRoots = rootManager.getContentRoots();
  final List<AbstractTreeNode> children = new ArrayList<AbstractTreeNode>(contentRoots.length + 1);
  final PsiManager psiManager = PsiManager.getInstance(getProject());
  for (final VirtualFile contentRoot : contentRoots) {
    if (!moduleFileIndex.isInContent(contentRoot)) continue;

    AbstractTreeNode child;
    if (contentRoot.isDirectory()) {
      PsiDirectory directory = psiManager.findDirectory(contentRoot);
      LOG.assertTrue(directory != null);
      child = new PsiDirectoryNode(getProject(), directory, getSettings());
    }
    else {
      PsiFile file = psiManager.findFile(contentRoot);
      LOG.assertTrue(file != null);
      child = new PsiFileNode(getProject(), file, getSettings());
    }
    children.add(child);
  }

  /*
  if (getSettings().isShowLibraryContents()) {
    children.add(new LibraryGroupNode(getProject(), new LibraryGroupElement(getValue()), getSettings()));
  }
  */
  return children;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:38,代码来源:ProjectViewModuleNode.java

示例12: buildOutputItemsList

import com.intellij.openapi.roots.ModuleFileIndex; //导入方法依赖的package包/类
private void buildOutputItemsList(final String outputDir,
		final Module module,
		VirtualFile from,
		final FileTypeManager typeManager,
		final VirtualFile sourceRoot,
		final String packagePrefix,
		final List<File> filesToRefresh,
		final Map<String, Collection<TranslatingCompiler.OutputItem>> results) throws CacheCorruptedException
{
	final Ref<CacheCorruptedException> exRef = new Ref<>(null);
	final ModuleFileIndex fileIndex = ModuleRootManager.getInstance(module).getFileIndex();
	final GlobalSearchScope srcRootScope = GlobalSearchScope.moduleScope(module).intersectWith(GlobalSearchScopes.directoryScope(myProject,
			sourceRoot, true));

	final Collection<FileType> registeredInputTypes = CompilerManager.getInstance(myProject).getRegisteredInputTypes(myTranslatingCompiler);

	final ContentIterator contentIterator = new ContentIterator()
	{
		@Override
		public boolean processFile(final VirtualFile child)
		{
			try
			{
				if(child.isValid())
				{
					if(!child.isDirectory() && registeredInputTypes.contains(child.getFileType()))
					{
						updateOutputItemsList(outputDir, child, sourceRoot, packagePrefix, filesToRefresh, results, srcRootScope);
					}
				}
				return true;
			}
			catch(CacheCorruptedException e)
			{
				exRef.set(e);
				return false;
			}
		}
	};
	if(fileIndex.isInContent(from))
	{
		// use file index for iteration to handle 'inner modules' and excludes properly
		fileIndex.iterateContentUnderDirectory(from, contentIterator);
	}
	else
	{
		// seems to be a root for generated sources
		VfsUtilCore.visitChildrenRecursively(from, new VirtualFileVisitor()
		{
			@Override
			public boolean visitFile(@NotNull VirtualFile file)
			{
				if(!file.isDirectory())
				{
					contentIterator.processFile(file);
				}
				return true;
			}
		});
	}
	final CacheCorruptedException exc = exRef.get();
	if(exc != null)
	{
		throw exc;
	}
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:67,代码来源:BackendCompilerWrapper.java


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