Package com.google.gdt.eclipse.designer.util.resources

Examples of com.google.gdt.eclipse.designer.util.resources.IResourcesProvider


  /**
   * Visits public folders of given module and inherited modules (recursively).
   */
  public static void accept(ModuleDescription moduleDescription, ModuleVisitor visitor)
      throws Exception {
    IResourcesProvider resourcesProvider = moduleDescription.getResourcesProvider();
    visitor.m_resourcesProvider = resourcesProvider;
    {
      String moduleId = moduleDescription.getId();
      accept(resourcesProvider, Sets.<String>newTreeSet(), moduleId, visitor);
    }
View Full Code Here


        {
          String contents = IOUtils2.readString(file);
          document = new Document(contents);
        }
        // add error markers for not imported types
        IResourcesProvider resourcesProvider = moduleDescription.getResourcesProvider();
        try {
          addMarkers_notImportedTypes(
              newMarkers,
              resourcesProvider,
              moduleDescription,
              astUnit,
              file,
              document);
        } finally {
          resourcesProvider.dispose();
        }
      }
    }
  }
View Full Code Here

  public void test_dispose() throws Exception {
    // add "test.jar" into project classpath
    addTestJar();
    // create and right away dispose DefaultResourcesProvider
    {
      IResourcesProvider provider = new DefaultResourcesProvider(m_javaProject);
      provider.dispose();
    }
    // dispose project, so delete create "test.jar", if DefaultResourcesProvider is not disposed,
    // it will keep "test.jar" opened, so we will not able to delete it
    do_projectDispose();
  }
View Full Code Here

   */
  @DisposeProjectAfter
  public void test_getResourceAsStream() throws Exception {
    addTestJar();
    // prepare IResourcesProvider
    IResourcesProvider provider = getTestModuleResourceProvider();
    // work with IResourcesProvider
    try {
      // no such resource
      assertNotExistingResource(provider, "no/such/resource.txt");
      // "src" folder is included
      assertExistingResource(provider, "test/client/Module.java");
      assertExistingResource(provider, "/test/client/Module.java");
      // from "test.jar"
      assertExistingResource(provider, "jar/folder/hello.txt");
      // "bin" folder is NOT included
      assertNotExistingResource(provider, "test/client/Module.class");
    } finally {
      provider.dispose();
    }
  }
View Full Code Here

  /**
   * Test for {@link DefaultResourcesProvider#listFiles(String)}.
   */
  public void test_listFiles_1() throws Exception {
    IResourcesProvider provider = getTestModuleResourceProvider();
    // work with IResourcesProvider
    try {
      // from project
      {
        List<String> files = provider.listFiles("test");
        assertThat(files).contains("Module.gwt.xml", "client/Module.java");
        assertFalse(files.contains("client/Module.class"));
      }
      // from jar
      {
        List<String> files = provider.listFiles("com/google/gwt/xml");
        assertThat(files).contains("XML.gwt.xml", "client/");
      }
    } finally {
      provider.dispose();
    }
  }
View Full Code Here

    try {
      GTestUtils.configure(myProject);
      GTestUtils.createModule(myProject, "my.library.Library");
      m_testProject.addRequiredProject(myProject);
      // prepare IResourcesProvider
      IResourcesProvider provider = getTestModuleResourceProvider();
      // work with IResourcesProvider
      try {
        // from "my.library.Library" project
        {
          List<String> files = provider.listFiles("my");
          assertThat(files).doesNotHaveDuplicates().contains(
              "library/Library.gwt.xml",
              "library/client/Library.java");
          assertFalse(files.contains("library/client/Library.class"));
        }
      } finally {
        provider.dispose();
      }
    } finally {
      myProject.dispose();
    }
  }
View Full Code Here

   */
  @DisposeProjectAfter
  public void test_listFiles_invalidOutputFolder() throws Exception {
    m_javaProject.setOutputLocation(new Path("/TestProject/bin2"), null);
    // prepare IResourcesProvider
    IResourcesProvider provider = getTestModuleResourceProvider();
    // work with IResourcesProvider
    try {
      List<String> files = provider.listFiles("test");
      assertThat(files).contains("Module.gwt.xml", "client/Module.java");
      assertFalse(files.contains("client/Module.class"));
    } finally {
      provider.dispose();
    }
  }
View Full Code Here

  public void test_propertiesFileInClasspath() throws Exception {
    File tempFile = File.createTempFile("myFile", ".properties");
    try {
      ProjectUtils.addJar(m_javaProject, tempFile.getAbsolutePath(), null);
      // create IResourcesProvider, should ignore *.properties file in classpath
      IResourcesProvider provider = new DefaultResourcesProvider(m_javaProject);
      provider.dispose();
    } finally {
      tempFile.delete();
    }
  }
View Full Code Here

    TestProject myProject = new TestProject("myProject");
    try {
      m_testProject.addRequiredProject(myProject);
      myProject.dispose();
      // prepare IResourcesProvider
      IResourcesProvider provider = getTestModuleResourceProvider();
      // work with IResourcesProvider
      try {
        List<String> files = provider.listFiles("test");
        assertThat(files).contains("Module.gwt.xml", "client/Module.java");
      } finally {
        provider.dispose();
      }
    } finally {
      myProject.dispose();
    }
  }
View Full Code Here

    TestProject myProject = new TestProject("myProject");
    try {
      m_testProject.addRequiredProject(myProject);
      ProjectUtils.removeNature(myProject.getProject(), JavaCore.NATURE_ID);
      // prepare IResourcesProvider
      IResourcesProvider provider = getTestModuleResourceProvider();
      // work with IResourcesProvider
      try {
        List<String> files = provider.listFiles("test");
        assertThat(files).contains("Module.gwt.xml", "client/Module.java");
      } finally {
        provider.dispose();
      }
    } finally {
      myProject.dispose();
    }
  }
View Full Code Here

TOP

Related Classes of com.google.gdt.eclipse.designer.util.resources.IResourcesProvider

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.