org.jetbrains.jps.model.java.JavaSourceRootType Java Examples
The following examples show how to use
org.jetbrains.jps.model.java.JavaSourceRootType.
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: HaxeTestConfigurationEditorForm.java From intellij-haxe with Apache License 2.0 | 6 votes |
private void updateModule(Module module) { if (module == null) { return; } myComboRunnerClasses.removeAllItems(); ModuleRootManager rootManager = ModuleRootManager.getInstance(module); List<VirtualFile> roots = rootManager.getSourceRoots(JavaSourceRootType.TEST_SOURCE); List<HaxeClass> classList = new ArrayList<HaxeClass>(); for (VirtualFile testSourceRoot : roots) { classList.addAll(UsefulPsiTreeUtil.getClassesInDirectory(module.getProject(), testSourceRoot)); } classList.size(); for (HaxeClass haxeClass : classList) { myComboRunnerClasses.addItem(haxeClass); } }
Example #2
Source File: OSSPantsScalaExamplesIntegrationTest.java From intellij-pants-plugin with Apache License 2.0 | 6 votes |
public void testWelcomeTest() throws Throwable { doImport("examples/tests/scala/org/pantsbuild/example/hello/welcome"); assertFirstSourcePartyModules( "examples_src_resources_org_pantsbuild_example_hello_hello", "examples_src_java_org_pantsbuild_example_hello_greet_greet", "examples_src_scala_org_pantsbuild_example_hello_welcome_welcome", "examples_tests_scala_org_pantsbuild_example_hello_welcome_welcome" ); final ContentEntry[] contentRoots = getContentRoots("examples_tests_scala_org_pantsbuild_example_hello_welcome_welcome"); assertSize(1, contentRoots); final List<SourceFolder> testSourceRoots = contentRoots[0].getSourceFolders(JavaSourceRootType.TEST_SOURCE); assertSize(1, testSourceRoots); assertPantsCompileExecutesAndSucceeds(pantsCompileProject()); findClassAndAssert("org.pantsbuild.example.hello.welcome.WelSpec"); assertScalaLibrary("examples_tests_scala_org_pantsbuild_example_hello_welcome_welcome"); }
Example #3
Source File: EventsList.java From droidtestrec with Apache License 2.0 | 6 votes |
protected static void checkForTestRoots(Module srcModule, Set<VirtualFile> testFolders) { testFolders.addAll(ModuleRootManager.getInstance(srcModule).getSourceRoots(JavaSourceRootType.TEST_SOURCE)); removeGenerated(testFolders); //create test in the same module if (!testFolders.isEmpty()) return; //suggest to choose from all dependencies modules final HashSet<Module> modules = new HashSet<Module>(); ModuleUtilCore.collectModulesDependsOn(srcModule, modules); for (Module module : modules) { testFolders.addAll(ModuleRootManager.getInstance(module).getSourceRoots(JavaSourceRootType.TEST_SOURCE)); } removeGenerated(testFolders); }
Example #4
Source File: GenerateAction.java From RIBs with Apache License 2.0 | 6 votes |
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 #5
Source File: HaxeModuleConfigurationEditorProvider.java From intellij-haxe with Apache License 2.0 | 5 votes |
public ModuleConfigurationEditor[] createEditors(final ModuleConfigurationState state) { final Module module = state.getRootModel().getModule(); if (ModuleType.get(module) != HaxeModuleType.getInstance()) { return ModuleConfigurationEditor.EMPTY; } return new ModuleConfigurationEditor[]{ new CommonContentEntriesEditor(module.getName(), state, JavaSourceRootType.SOURCE, JavaSourceRootType.TEST_SOURCE), new ClasspathEditor(state), new HaxeModuleConfigurationEditor(state) }; }
Example #6
Source File: ErrorFilter.java From intellij-haxe with Apache License 2.0 | 5 votes |
protected HyperlinkInfo createOpenFileHyperlink(String filePath, int line) { ModuleRootManager rootManager = ModuleRootManager.getInstance(myModule); List<VirtualFile> roots = rootManager.getSourceRoots(JavaSourceRootType.TEST_SOURCE); VirtualFile virtualFile = null; for (VirtualFile testSourceRoot : roots) { String fullPath = testSourceRoot.getPath() + "/" + filePath; virtualFile = LocalFileSystem.getInstance().findFileByPath(fullPath); if(virtualFile != null) { break; } } return virtualFile == null ? null : new OpenFileHyperlinkInfo(myModule.getProject(), virtualFile, line - 1); }
Example #7
Source File: HaskellTarget.java From intellij-haskforce with Apache License 2.0 | 5 votes |
@NotNull @Override public List<HaskellSourceRootDescriptor> computeRootDescriptors(JpsModel jpsModel, ModuleExcludeIndex moduleExcludeIndex, IgnoredFileIndex ignoredFileIndex, BuildDataPaths buildDataPaths) { List<HaskellSourceRootDescriptor> result = new ArrayList<HaskellSourceRootDescriptor>(); JavaSourceRootType type = isTests() ? JavaSourceRootType.TEST_SOURCE : JavaSourceRootType.SOURCE; for (JpsTypedModuleSourceRoot<JavaSourceRootProperties> root : myModule.getSourceRoots(type)) { result.add(new HaskellSourceRootDescriptor(root.getFile(), this)); } return result; }
Example #8
Source File: MavenImportingTestCase.java From intellij-quarkus with Eclipse Public License 2.0 | 5 votes |
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 #9
Source File: ModuleUtils.java From EasyCode with MIT License | 5 votes |
/** * 获取模块的源代码文件夹,不存在 * * @param module 模块对象 * @return 文件夹路径 */ public static VirtualFile getSourcePath(@NotNull Module module) { List<VirtualFile> virtualFileList = ModuleRootManager.getInstance(module).getSourceRoots(JavaSourceRootType.SOURCE); if (CollectionUtil.isEmpty(virtualFileList)) { return VirtualFileManager.getInstance().findFileByUrl(String.format("file://%s", ModuleUtil.getModuleDirPath(module))); } return virtualFileList.get(0); }
Example #10
Source File: PantsProjectCache.java From intellij-pants-plugin with Apache License 2.0 | 5 votes |
@NotNull private TreeSet<VirtualFile> collectRoots() { final TreeSet<VirtualFile> result = new TreeSet<>(VIRTUAL_FILE_COMPARATOR); final ProjectRootManager rootManager = ProjectRootManager.getInstance(myProject); result.addAll(rootManager.getModuleSourceRoots(ContainerUtil.set(JavaSourceRootType.SOURCE, JavaSourceRootType.TEST_SOURCE))); return result; }
Example #11
Source File: OCamlContentEntriesEditor.java From reasonml-idea-plugin with MIT License | 4 votes |
OCamlContentEntriesEditor(@NotNull String moduleName, @NotNull ModuleConfigurationState state) { super(moduleName, state, JavaSourceRootType.SOURCE, JavaSourceRootType.TEST_SOURCE, OCamlBinaryRootType.BINARY); }
Example #12
Source File: ExternalSystemImportingTestCase.java From intellij-quarkus with Eclipse Public License 2.0 | 4 votes |
protected void assertSources(String moduleName, String... expectedSources) { doAssertContentFolders(moduleName, JavaSourceRootType.SOURCE, expectedSources); }
Example #13
Source File: MavenImportingTestCase.java From intellij-quarkus with Eclipse Public License 2.0 | 4 votes |
protected void assertTestSources(String moduleName, String... expectedSources) { doAssertContentFolders(moduleName, JavaSourceRootType.TEST_SOURCE, expectedSources); }
Example #14
Source File: MavenImportingTestCase.java From intellij-quarkus with Eclipse Public License 2.0 | 4 votes |
protected void assertSources(String moduleName, String... expectedSources) { doAssertContentFolders(moduleName, JavaSourceRootType.SOURCE, expectedSources); }
Example #15
Source File: ExternalSystemImportingTestCase.java From intellij-quarkus with Eclipse Public License 2.0 | 4 votes |
protected void assertTestSources(String moduleName, String... expectedSources) { doAssertContentFolders(moduleName, JavaSourceRootType.TEST_SOURCE, expectedSources); }
Example #16
Source File: ExternalSystemImportingTestCase.java From intellij-quarkus with Eclipse Public License 2.0 | 4 votes |
protected void assertGeneratedTestSources(String moduleName, String... expectedSources) { assertGeneratedSources(moduleName, JavaSourceRootType.TEST_SOURCE, expectedSources); }
Example #17
Source File: ExternalSystemImportingTestCase.java From intellij-quarkus with Eclipse Public License 2.0 | 4 votes |
protected void assertGeneratedSources(String moduleName, String... expectedSources) { assertGeneratedSources(moduleName, JavaSourceRootType.SOURCE, expectedSources); }
Example #18
Source File: ModuleUtils.java From EasyCode with MIT License | 2 votes |
/** * 判断模块是否存在源代码文件夹 * * @param module 模块对象 * @return 是否存在 */ public static boolean existsSourcePath(Module module) { return !CollectionUtil.isEmpty(ModuleRootManager.getInstance(module).getSourceRoots(JavaSourceRootType.SOURCE)); }