public static void removeExcludedRoot(Module module, VirtualFile root) { ModuleRootModificationUtil.updateModel( module, model -> { ContentEntry entry = findContentEntryWithAssertion(model, root); entry.removeExcludeFolder(root.getUrl()); }); }
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 ContentEntry addContentRoot(Module module, VirtualFile vDir) { ModuleRootModificationUtil.updateModel(module, model -> model.addContentEntry(vDir)); for (ContentEntry entry : ModuleRootManager.getInstance(module).getContentEntries()) { if (Comparing.equal(entry.getFile(), vDir)) { Assert.assertFalse(((ContentEntryImpl) entry).isDisposed()); return entry; } } return null; }
public static void removeSourceRoot(Module module, VirtualFile root) { ModuleRootModificationUtil.updateModel( module, model -> { ContentEntry entry = findContentEntryWithAssertion(model, root); for (SourceFolder sourceFolder : entry.getSourceFolders()) { if (root.equals(sourceFolder.getFile())) { entry.removeSourceFolder(sourceFolder); break; } } }); }