本文整理汇总了Java中com.intellij.openapi.roots.ModuleFileIndex类的典型用法代码示例。如果您正苦于以下问题:Java ModuleFileIndex类的具体用法?Java ModuleFileIndex怎么用?Java ModuleFileIndex使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ModuleFileIndex类属于com.intellij.openapi.roots包,在下文中一共展示了ModuleFileIndex类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: findFiles
import com.intellij.openapi.roots.ModuleFileIndex; //导入依赖的package包/类
protected static void findFiles(final Module module, final List<PsiFile> files) {
final ModuleFileIndex idx = ModuleRootManager.getInstance(module).getFileIndex();
final VirtualFile[] roots = ModuleRootManager.getInstance(module).getContentRoots();
for (final VirtualFile root : roots) {
ApplicationManager.getApplication().runReadAction(new Runnable() {
@Override
public void run() {
idx.iterateContentUnderDirectory(root, new ContentIterator() {
@Override
public boolean processFile(final VirtualFile dir) {
if (dir.isDirectory()) {
final PsiDirectory psiDir = PsiManager.getInstance(module.getProject()).findDirectory(dir);
if (psiDir != null) {
findFiles(files, psiDir, false);
}
}
return true;
}
});
}
});
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:AbstractFileProcessor.java
示例3: hasCustomCompile
import com.intellij.openapi.roots.ModuleFileIndex; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
public boolean hasCustomCompile(ModuleChunk chunk) {
for (Module m : chunk.getModules()) {
if (LibrariesUtil.hasGroovySdk(m)) {
final Set<String> scriptExtensions = GroovyFileTypeLoader.getCustomGroovyScriptExtensions();
final ContentIterator groovyFileSearcher = new ContentIterator() {
public boolean processFile(VirtualFile fileOrDir) {
ProgressManager.checkCanceled();
if (isCompilableGroovyFile(fileOrDir, scriptExtensions)) {
return false;
}
return true;
}
};
final ModuleRootManager rootManager = ModuleRootManager.getInstance(m);
final ModuleFileIndex fileIndex = rootManager.getFileIndex();
for (VirtualFile file : rootManager.getSourceRoots()) {
if (!fileIndex.iterateContentUnderDirectory(file, groovyFileSearcher)) {
return true;
}
}
}
}
return false;
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:29,代码来源:GroovyAntCustomCompilerProvider.java
示例4: findFiles
import com.intellij.openapi.roots.ModuleFileIndex; //导入依赖的package包/类
protected static void findFiles(final Module module, final List<PsiFile> files) {
final ModuleFileIndex idx = ModuleRootManager.getInstance(module).getFileIndex();
final VirtualFile[] roots = ModuleRootManager.getInstance(module).getContentRoots();
for (VirtualFile root : roots) {
idx.iterateContentUnderDirectory(root, new ContentIterator() {
public boolean processFile(final VirtualFile dir) {
if (dir.isDirectory()) {
final PsiDirectory psiDir = PsiManager.getInstance(module.getProject()).findDirectory(dir);
if (psiDir != null) {
findFiles(files, psiDir, false);
}
}
return true;
}
});
}
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:20,代码来源:AbstractFileProcessor.java
示例5: isUnderSourceRoot
import com.intellij.openapi.roots.ModuleFileIndex; //导入依赖的package包/类
public static boolean isUnderSourceRoot(@NotNull PsiElement element)
{
Module moduleForPsiElement = ModuleUtilCore.findModuleForPsiElement(element);
if(moduleForPsiElement == null)
{
return false;
}
PsiFile containingFile = element.getContainingFile();
if(containingFile == null)
{
return false;
}
VirtualFile virtualFile = containingFile.getVirtualFile();
if(virtualFile == null)
{
return false;
}
ModuleFileIndex fileIndex = ModuleRootManager.getInstance(moduleForPsiElement).getFileIndex();
return fileIndex.isInSourceContent(virtualFile) || fileIndex.isInTestSourceContent(virtualFile);
}
开发者ID:consulo,项目名称:consulo-dotnet,代码行数:21,代码来源:DotNetModuleUtil.java
示例6: 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
示例7: 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
示例8: collectFilePaths
import com.intellij.openapi.roots.ModuleFileIndex; //导入依赖的package包/类
@NotNull
static <T> List<T> collectFilePaths(@NotNull PsiElement element, @NotNull final Function<PsiFile, T> converter) {
final List<T> allFiles = new SmartList<T>();
final PsiManager psiManager = element.getManager();
ModuleFileIndex fileIndex = ModuleRootManager.getInstance(ModuleUtil.findModuleForPsiElement(element)).getFileIndex();
fileIndex.iterateContent(new ContentIterator() {
public boolean processFile(VirtualFile fileOrDir) {
PsiFile psiFile = psiManager.findFile(fileOrDir);
if (psiFile != null) {
ContainerUtil.addIfNotNull(converter.fun(psiFile), allFiles);
}
return true;
}
});
return allFiles;
}
开发者ID:consulo,项目名称:consulo-apache-velocity,代码行数:17,代码来源:Util.java
示例9: getModuleBase
import com.intellij.openapi.roots.ModuleFileIndex; //导入依赖的package包/类
public static PsiDirectory getModuleBase(Project project, VirtualFile vf) {
Module module = ModuleUtilCore.findModuleForFile(vf, project);
ModuleFileIndex fileIndex = ModuleRootManager.getInstance(module).getFileIndex();
PsiDirectory baseDir = PsiDirectoryFactory.getInstance(project).createDirectory(project.getBaseDir());
PsiDirectory moduleDir = baseDir.findSubdirectory(module.getName());
if (moduleDir == null) {
return baseDir;
}
return moduleDir;
}
开发者ID:Jamling,项目名称:Android-ORM-ASPlugin,代码行数:11,代码来源:Utils.java
示例10: CoreModule
import com.intellij.openapi.roots.ModuleFileIndex; //导入依赖的package包/类
public CoreModule(@NotNull Disposable parentDisposable, @NotNull Project project, String moduleFilePath) {
super(project.getPicoContainer(), parentDisposable);
myLifetime = parentDisposable;
myProject = project;
myPath = moduleFilePath;
Extensions.instantiateArea(ExtensionAreas.IDEA_MODULE, this, null);
Disposer.register(parentDisposable, new Disposable() {
@Override
public void dispose() {
Extensions.disposeArea(CoreModule.this);
}
});
initModuleExtensions();
final ModuleRootManagerImpl moduleRootManager =
new ModuleRootManagerImpl(this,
ProjectRootManagerImpl.getInstanceImpl(project),
VirtualFilePointerManager.getInstance()) {
@Override
public void loadState(ModuleRootManagerState object) {
loadState(object, false);
}
};
Disposer.register(parentDisposable, new Disposable() {
@Override
public void dispose() {
moduleRootManager.disposeComponent();
}
});
getPicoContainer().registerComponentInstance(ModuleRootManager.class, moduleRootManager);
getPicoContainer().registerComponentInstance(PathMacroManager.class, createModulePathMacroManager(project));
getPicoContainer().registerComponentInstance(ModuleFileIndex.class, createModuleFileIndex(project));
myModuleScopeProvider = createModuleScopeProvider();
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:36,代码来源:CoreModule.java
示例11: getDirectoryChildren
import com.intellij.openapi.roots.ModuleFileIndex; //导入依赖的package包/类
public Collection<AbstractTreeNode> getDirectoryChildren(final PsiDirectory psiDirectory,
final ViewSettings settings,
final boolean withSubDirectories) {
final List<AbstractTreeNode> children = new ArrayList<AbstractTreeNode>();
final Project project = psiDirectory.getProject();
final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();
final Module module = fileIndex.getModuleForFile(psiDirectory.getVirtualFile());
final ModuleFileIndex moduleFileIndex = module == null ? null : ModuleRootManager.getInstance(module).getFileIndex();
if (!settings.isFlattenPackages() || skipDirectory(psiDirectory)) {
processPsiDirectoryChildren(psiDirectory, directoryChildrenInProject(psiDirectory, settings),
children, fileIndex, null, settings, withSubDirectories);
}
else { // source directory in "flatten packages" mode
final PsiDirectory parentDir = psiDirectory.getParentDirectory();
if (parentDir == null || skipDirectory(parentDir) && withSubDirectories) {
addAllSubpackages(children, psiDirectory, moduleFileIndex, settings);
}
if (withSubDirectories) {
PsiDirectory[] subdirs = psiDirectory.getSubdirectories();
for (PsiDirectory subdir : subdirs) {
if (!skipDirectory(subdir)) {
continue;
}
VirtualFile directoryFile = subdir.getVirtualFile();
if (Registry.is("ide.hide.excluded.files")) {
if (fileIndex.isExcluded(directoryFile)) continue;
}
else {
if (FileTypeRegistry.getInstance().isFileIgnored(directoryFile)) continue;
}
children.add(new PsiDirectoryNode(project, subdir, settings));
}
}
processPsiDirectoryChildren(psiDirectory, psiDirectory.getFiles(), children, fileIndex, moduleFileIndex, settings,
withSubDirectories);
}
return children;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:41,代码来源:ProjectViewDirectoryHelper.java
示例12: 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
示例13: 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
示例14: hasCustomCompile
import com.intellij.openapi.roots.ModuleFileIndex; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public boolean hasCustomCompile(ModuleChunk chunk) {
for (Module m : chunk.getModules()) {
if (LibrariesUtil.hasGroovySdk(m)) {
final Set<String> scriptExtensions = GroovyFileTypeLoader.getCustomGroovyScriptExtensions();
final ContentIterator groovyFileSearcher = new ContentIterator() {
@Override
public boolean processFile(VirtualFile fileOrDir) {
ProgressManager.checkCanceled();
if (isCompilableGroovyFile(fileOrDir, scriptExtensions)) {
return false;
}
return true;
}
};
final ModuleRootManager rootManager = ModuleRootManager.getInstance(m);
final ModuleFileIndex fileIndex = rootManager.getFileIndex();
for (VirtualFile file : rootManager.getSourceRoots(JavaModuleSourceRootTypes.SOURCES)) {
if (!fileIndex.iterateContentUnderDirectory(file, groovyFileSearcher)) {
return true;
}
}
}
}
return false;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:31,代码来源:GroovyAntCustomCompilerProvider.java
示例15: 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
示例16: 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
示例17: getDirectoryChildren
import com.intellij.openapi.roots.ModuleFileIndex; //导入依赖的package包/类
public Collection<AbstractTreeNode> getDirectoryChildren(final PsiDirectory psiDirectory,
final ViewSettings settings,
final boolean withSubDirectories) {
final List<AbstractTreeNode> children = new ArrayList<AbstractTreeNode>();
final Project project = psiDirectory.getProject();
final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();
final Module module = fileIndex.getModuleForFile(psiDirectory.getVirtualFile());
final ModuleFileIndex moduleFileIndex = module == null ? null : ModuleRootManager.getInstance(module).getFileIndex();
if (!settings.isFlattenPackages() || skipDirectory(psiDirectory)) {
processPsiDirectoryChildren(psiDirectory, directoryChildrenInProject(psiDirectory),
children, fileIndex, null, settings, withSubDirectories);
}
else { // source directory in "flatten packages" mode
final PsiDirectory parentDir = psiDirectory.getParentDirectory();
if (parentDir == null || skipDirectory(parentDir) /*|| !rootDirectoryFound(parentDir)*/ && withSubDirectories) {
addAllSubpackages(children, psiDirectory, moduleFileIndex, settings);
}
PsiDirectory[] subdirs = psiDirectory.getSubdirectories();
for (PsiDirectory subdir : subdirs) {
if (!skipDirectory(subdir)) {
continue;
}
VirtualFile directoryFile = subdir.getVirtualFile();
if (fileIndex.isIgnored(directoryFile)) continue;
if (withSubDirectories) {
children.add(new PsiDirectoryNode(project, subdir, settings));
}
}
processPsiDirectoryChildren(psiDirectory, psiDirectory.getFiles(), children, fileIndex, moduleFileIndex, settings,
withSubDirectories);
}
return children;
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:35,代码来源:ProjectViewDirectoryHelper.java
示例18: processPsiDirectoryChildren
import com.intellij.openapi.roots.ModuleFileIndex; //导入依赖的package包/类
public void processPsiDirectoryChildren(final PsiDirectory psiDir,
PsiElement[] children,
List<AbstractTreeNode> container,
ProjectFileIndex projectFileIndex,
ModuleFileIndex moduleFileIndex,
ViewSettings viewSettings,
boolean withSubDirectories) {
for (PsiElement child : children) {
LOG.assertTrue(child.isValid());
final VirtualFile vFile;
if (child instanceof PsiFile) {
vFile = ((PsiFile)child).getVirtualFile();
addNode(moduleFileIndex, projectFileIndex, psiDir, vFile, container, PsiFileNode.class, child, viewSettings);
}
else if (child instanceof PsiDirectory) {
if (withSubDirectories) {
PsiDirectory dir = (PsiDirectory)child;
vFile = dir.getVirtualFile();
if (!vFile.equals(projectFileIndex.getSourceRootForFile(vFile))) { // if is not a source root
if (viewSettings.isHideEmptyMiddlePackages() && !skipDirectory(psiDir) && isEmptyMiddleDirectory(dir, true)) {
processPsiDirectoryChildren(dir, directoryChildrenInProject(dir),
container, projectFileIndex, moduleFileIndex, viewSettings, withSubDirectories); // expand it recursively
continue;
}
}
addNode(moduleFileIndex, projectFileIndex, psiDir, vFile, container, PsiDirectoryNode.class, child, viewSettings);
}
}
else {
LOG.error("Either PsiFile or PsiDirectory expected as a child of " + child.getParent() + ", but was " + child);
}
}
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:35,代码来源:ProjectViewDirectoryHelper.java
示例19: 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
示例20: 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
注:本文中的com.intellij.openapi.roots.ModuleFileIndex类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论