Search in sources :

Example 6 with ViewSettings

use of com.intellij.ide.projectView.ViewSettings in project intellij-community by JetBrains.

the class MvcModuleNode method getChildren.

@Override
@NotNull
public Collection<? extends AbstractTreeNode> getChildren() {
    final List<AbstractTreeNode> nodesList = new ArrayList<>();
    final Module module = getValue();
    final ViewSettings viewSettings = getSettings();
    final VirtualFile root = myDescriptor.getFramework().findAppRoot(module);
    if (root == null) {
        return Collections.emptyList();
    }
    myDescriptor.fillModuleChildren(nodesList, module, viewSettings, root);
    return nodesList;
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) ArrayList(java.util.ArrayList) AbstractTreeNode(com.intellij.ide.util.treeView.AbstractTreeNode) ViewSettings(com.intellij.ide.projectView.ViewSettings) Module(com.intellij.openapi.module.Module) NotNull(org.jetbrains.annotations.NotNull)

Example 7 with ViewSettings

use of com.intellij.ide.projectView.ViewSettings in project android by JetBrains.

the class AndroidViewProjectNode method getChildren.

@NotNull
@Override
public Collection<? extends AbstractTreeNode> getChildren() {
    Project project = getProject();
    assert project != null;
    ViewSettings settings = getSettings();
    // add a node for every module
    // TODO: make this conditional on getSettings().isShowModules(), otherwise collapse them all at the root
    List<Module> modules = Arrays.asList(ModuleManager.getInstance(project).getModules());
    List<AbstractTreeNode> children = Lists.newArrayListWithExpectedSize(modules.size());
    for (Module module : modules) {
        if (isRootModuleWithNoSources(module)) {
            // If we detect such a module, then we don't show it..
            continue;
        }
        AndroidFacet androidFacet = AndroidFacet.getInstance(module);
        NdkFacet ndkFacet = NdkFacet.getInstance(module);
        if (androidFacet != null && androidFacet.getAndroidModel() != null) {
            children.add(new AndroidModuleNode(project, module, settings, myProjectViewPane));
        } else if (ndkFacet != null && ndkFacet.getNdkModuleModel() != null) {
            children.add(new NdkModuleNode(project, module, settings));
        } else {
            children.add(new NonAndroidModuleNode(project, module, settings));
        }
    }
    // are still visible. See https://code.google.com/p/android/issues/detail?id=76564
    if (children.isEmpty() && isBuildWithGradle(project) && GradleSyncState.getInstance(project).lastSyncFailed()) {
        PsiDirectory dir = PsiManager.getInstance(project).findDirectory(project.getBaseDir());
        if (dir != null) {
            children.add(new PsiDirectoryNode(project, dir, settings));
        }
    }
    if (isBuildWithGradle(project)) {
        children.add(new AndroidBuildScriptsGroupNode(project, settings));
    }
    ExternalBuildFilesGroupNode externalBuildFilesNode = new ExternalBuildFilesGroupNode(project, settings);
    if (!externalBuildFilesNode.getChildren().isEmpty()) {
        children.add(externalBuildFilesNode);
    }
    return children;
}
Also used : ViewSettings(com.intellij.ide.projectView.ViewSettings) AbstractTreeNode(com.intellij.ide.util.treeView.AbstractTreeNode) PsiDirectoryNode(com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode) NdkFacet(com.android.tools.idea.gradle.project.facet.ndk.NdkFacet) AndroidFacet(org.jetbrains.android.facet.AndroidFacet) Project(com.intellij.openapi.project.Project) PsiDirectory(com.intellij.psi.PsiDirectory) Module(com.intellij.openapi.module.Module) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

ViewSettings (com.intellij.ide.projectView.ViewSettings)7 AbstractTreeNode (com.intellij.ide.util.treeView.AbstractTreeNode)5 ArrayList (java.util.ArrayList)4 NotNull (org.jetbrains.annotations.NotNull)4 SettingsProvider (com.intellij.ide.projectView.SettingsProvider)2 Module (com.intellij.openapi.module.Module)2 Project (com.intellij.openapi.project.Project)2 VirtualFile (com.intellij.openapi.vfs.VirtualFile)2 NdkFacet (com.android.tools.idea.gradle.project.facet.ndk.NdkFacet)1 ProjectViewNode (com.intellij.ide.projectView.ProjectViewNode)1 TreeStructureProvider (com.intellij.ide.projectView.TreeStructureProvider)1 ClassTreeNode (com.intellij.ide.projectView.impl.nodes.ClassTreeNode)1 PsiDirectoryNode (com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode)1 PsiFileNode (com.intellij.ide.projectView.impl.nodes.PsiFileNode)1 ProcessCanceledException (com.intellij.openapi.progress.ProcessCanceledException)1 IndexNotReadyException (com.intellij.openapi.project.IndexNotReadyException)1 ProjectFileIndex (com.intellij.openapi.roots.ProjectFileIndex)1 PsiDirectory (com.intellij.psi.PsiDirectory)1 PsiElement (com.intellij.psi.PsiElement)1 PsiFile (com.intellij.psi.PsiFile)1