private static void addSourceDirToContent( @NotNull ContentEntry content, @NotNull VirtualFile root, @NotNull String sourceDir, boolean test) { VirtualFile sourceDirFile = root.findChild(sourceDir); if (sourceDirFile != null) { content.addSourceFolder(sourceDirFile, test); } }
public static <P extends JpsElement> void addSourceRoot( Module module, VirtualFile vDir, @NotNull JpsModuleSourceRootType<P> rootType, P properties) { ModuleRootModificationUtil.updateModel( module, model -> { ContentEntry entry = findContentEntry(model, vDir); if (entry == null) entry = model.addContentEntry(vDir); entry.addSourceFolder(vDir, rootType, properties); }); }
public static void addSourceRoot( final ModuleRootManager manager, @NotNull final VirtualFile root) { final ModifiableRootModel model = manager.getModifiableModel(); ContentEntry contentEntry = findContentEntryForRoot(model, root); if (contentEntry == null) { contentEntry = model.addContentEntry(root); } contentEntry.addSourceFolder(root, false); model.commit(); }