Java Code Examples for com.intellij.openapi.roots.ContentEntry#getSourceFolders()

The following examples show how to use com.intellij.openapi.roots.ContentEntry#getSourceFolders() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GenerateAction.java    From RIBs with Apache License 2.0 6 votes vote down vote up
private static SourceFolder suitableTestSourceFolders(Project project, Module module) {
  ContentEntry[] contentEntries = ModuleRootManager.getInstance(module).getContentEntries();
  for (ContentEntry contentEntry : contentEntries) {
    List<SourceFolder> testSourceFolders =
        contentEntry.getSourceFolders(JavaSourceRootType.TEST_SOURCE);
    for (SourceFolder testSourceFolder : testSourceFolders) {
      if (testSourceFolder.getFile() != null) {
        if (!JavaProjectRootsUtil.isInGeneratedCode(testSourceFolder.getFile(), project)) {
          return testSourceFolder;
        }
      }
    }
  }

  return null;
}
 
Example 2
Source File: MavenImportingTestCase.java    From intellij-quarkus with Eclipse Public License 2.0 5 votes vote down vote up
protected void assertGeneratedSources(String moduleName, String... expectedSources) {
  ContentEntry contentRoot = getContentRoot(moduleName);
  List<ContentFolder> folders = new ArrayList<>();
  for (SourceFolder folder : contentRoot.getSourceFolders(JavaSourceRootType.SOURCE)) {
    JavaSourceRootProperties properties = folder.getJpsElement().getProperties(JavaSourceRootType.SOURCE);
    assertNotNull(properties);
    if (properties.isForGeneratedSources()) {
      folders.add(folder);
    }
  }
  doAssertContentFolders(contentRoot, folders, expectedSources);
}
 
Example 3
Source File: JavaSyncTest.java    From intellij with Apache License 2.0 5 votes vote down vote up
@Nullable
private static SourceFolder findSourceFolder(ContentEntry entry, VirtualFile file) {
  for (SourceFolder sourceFolder : entry.getSourceFolders()) {
    if (file.equals(sourceFolder.getFile())) {
      return sourceFolder;
    }
  }
  return null;
}
 
Example 4
Source File: JavascriptSyncTest.java    From intellij with Apache License 2.0 5 votes vote down vote up
@Nullable
private static SourceFolder findSourceFolder(ContentEntry entry, VirtualFile file) {
  for (SourceFolder sourceFolder : entry.getSourceFolders()) {
    if (file.equals(sourceFolder.getFile())) {
      return sourceFolder;
    }
  }
  return null;
}