Exemplo n.º 1
0
 public static void removeExcludedRoot(Module module, VirtualFile root) {
   ModuleRootModificationUtil.updateModel(
       module,
       model -> {
         ContentEntry entry = findContentEntryWithAssertion(model, root);
         entry.removeExcludeFolder(root.getUrl());
       });
 }
Exemplo n.º 2
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);
       });
 }
Exemplo n.º 3
0
  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;
  }
Exemplo n.º 4
0
 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;
           }
         }
       });
 }