コード例 #1
0
 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);
       });
 }
コード例 #2
0
 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();
 }