Search in sources :

Example 1 with GroupByTypeComparator

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

the class AndroidProjectViewTest method testProjectView.

public void testProjectView() throws Exception {
    loadProject("projects/navigator/packageview/simple");
    myPane = createPane();
    TestAndroidTreeStructure structure = new TestAndroidTreeStructure(getProject(), getTestRootDisposable());
    Queryable.PrintInfo printInfo = new Queryable.PrintInfo();
    PsiDirectory dir = getBaseFolder();
    assertNotNull(dir);
    String rootModuleName = null;
    for (Module module : ModuleManager.getInstance(getProject()).getModules()) {
        if (GradleUtil.getGradlePath(module) == null) {
            rootModuleName = module.getName();
        }
    }
    assertNotNull(rootModuleName);
    String projectName = getProject().getName();
    String expected = projectName + "\n" + " app (Android)\n" + "  manifests\n" + "   AndroidManifest.xml (main)\n" + "   AndroidManifest.xml (debug)\n" + "  java\n" + "   app (main)\n" + "    MainActivity\n" + "   app (androidTest)\n" + "    MainActivityTest.java\n" + "   Debug.java\n" + "  renderscript\n" + "   test.rs (main)\n" + "  assets\n" + "   raw.asset.txt (main)\n" + "  res\n" + "   drawable\n" + "    ic_launcher.png (2)\n" + "     ic_launcher.png (hdpi, debug)\n" + "     ic_launcher.png (mdpi)\n" + "    j.png (mdpi)\n" + "   layout\n" + "    activity_main.xml\n" + "   menu\n" + "    main.xml\n" + "   values\n" + "    dimens.xml (3)\n" + "     dimens.xml\n" + "     dimens.xml (debug)\n" + "     dimens.xml (w820dp)\n" + "    strings.xml (2)\n" + "     strings.xml\n" + "     strings.xml (debug)\n" + "    styles.xml\n" + " empty (non-Android)\n" + " javamodule (non-Android)\n" + "  java\n" + "   foo\n" + "    Foo.java\n" + "  tests\n" + "   foo\n" + "    FooTest.java\n" + "  resources\n" + "   res2.txt\n" + "  test-resources\n" + "   test-res.txt\n" + " lib (Android)\n" + "  manifests\n" + "   AndroidManifest.xml (main)\n" + "  cpp\n" + "   hello.c (main)\n" + "  jniLibs\n" + "   libc.so (main)\n" + "   libm.so (debug)\n" + "  res\n" + "   drawable\n" + "    ic_launcher.png (mdpi)\n" + "   values\n" + "    strings.xml\n" + " Gradle Scripts\n" + "  build.gradle (Project: " + rootModuleName + ")\n" + "  build.gradle (Module: app)\n" + "  sonar.gradle (Module: app)\n" + "  build.gradle (Module: empty)\n" + "  build.gradle (Module: javamodule)\n" + "  build.gradle (Module: lib)\n" + "  gradle-wrapper.properties (Gradle Version)\n" + "  proguard-rules.pro (ProGuard Rules for app)\n" + "  proguard.cfg (ProGuard Rules for lib)\n" + "  settings.gradle (Project Settings)\n" + "  local.properties (SDK Location)\n";
    int numLines = expected.split("\n").length;
    ProjectViewTestUtil.assertStructureEqual(structure, expected, numLines, new GroupByTypeComparator(null, "android"), structure.getRootElement(), printInfo);
}
Also used : PsiDirectory(com.intellij.psi.PsiDirectory) Queryable(com.intellij.openapi.ui.Queryable) GroupByTypeComparator(com.intellij.ide.projectView.impl.GroupByTypeComparator) Module(com.intellij.openapi.module.Module)

Example 2 with GroupByTypeComparator

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

the class PropertiesProjectViewTest method setupPane.

private AbstractProjectViewPSIPane setupPane(final boolean sortByType) {
    myStructure.setProviders(new ResourceBundleGrouper(getProject()));
    final AbstractProjectViewPSIPane pane = myStructure.createPane();
    pane.getTreeBuilder().setNodeDescriptorComparator(new GroupByTypeComparator(sortByType));
    // there should be xxx.properties in all test data
    PsiFile psiFile = getPsiManager().findFile(myFixture.findFileInTempDir(getTestName(true) + "/xxx.properties"));
    assert psiFile != null;
    pane.select(psiFile, psiFile.getVirtualFile(), sortByType);
    return pane;
}
Also used : AbstractProjectViewPSIPane(com.intellij.ide.projectView.impl.AbstractProjectViewPSIPane) ResourceBundleGrouper(com.intellij.lang.properties.projectView.ResourceBundleGrouper) GroupByTypeComparator(com.intellij.ide.projectView.impl.GroupByTypeComparator) PsiFile(com.intellij.psi.PsiFile)

Aggregations

GroupByTypeComparator (com.intellij.ide.projectView.impl.GroupByTypeComparator)2 AbstractProjectViewPSIPane (com.intellij.ide.projectView.impl.AbstractProjectViewPSIPane)1 ResourceBundleGrouper (com.intellij.lang.properties.projectView.ResourceBundleGrouper)1 Module (com.intellij.openapi.module.Module)1 Queryable (com.intellij.openapi.ui.Queryable)1 PsiDirectory (com.intellij.psi.PsiDirectory)1 PsiFile (com.intellij.psi.PsiFile)1