Package com.intellij.openapi.roots

Examples of com.intellij.openapi.roots.ModifiableRootModel.commit()


            //add the library to the module and commit the change
            //
            final ModuleRootManager modRootMgr = ModuleRootManager.getInstance(module);
            final ModifiableRootModel moduleRootModel = modRootMgr.getModifiableModel();
            moduleRootModel.addLibraryEntry(lib);
            moduleRootModel.commit();
        }
    }
}


                                            found = true;
                                            moduleLibraryTable.removeLibrary(library);
                                        }
                                    }
                                    if (found) {
                                        model.commit();
                                    } else {
                                        model.dispose();
                                    }
                                }
                            });

        contentEntry.addExcludeFolder(rootUrl + "/dir2/packages/oldProject2Name");
        contentEntry.addExcludeFolder(rootUrl + "/dir2/someFolder");
        contentEntry.addExcludeFolder(rootUrl + "/dir2/lib/someFolder");
        contentEntry.addExcludeFolder(rootUrl + "/dir2/example/nonexistent/packages");
        contentEntry.addExcludeFolder(rootUrl + "/dir2/example/packages/oldProject3Name");
        model.commit();
      }
    });

    DartProjectComponent.excludeBuildAndPackagesFolders(myModule, pubspec2);

          final Library library = modifiableModel.getModuleLibraryTable().createLibrary("Dart custom package roots");
          final Library.ModifiableModel libModel = library.getModifiableModel();
          libModel.addRoot(customPack1.getUrl(), OrderRootType.CLASSES);
          libModel.addRoot(customPack2.getUrl(), OrderRootType.CLASSES);
          libModel.commit();
          modifiableModel.commit();
        }
        catch (Exception e) {
          if (!modifiableModel.isDisposed()) modifiableModel.dispose();
        }
      }

      @Override
      public void run() {
        try {
          ModifiableRootModel modifiableModel = ModuleRootManager.getInstance(getModule()).getModifiableModel();
          updater.update(modifiableModel);
          modifiableModel.commit();
        }
        catch (Throwable e) {
          throw new RuntimeException(e);
        }
      }

          if (supportUrl.equals(entry.getUrl()) || genUrl.equals(entry.getUrl())) {
            model.removeContentEntry(entry);
          }
        }
      }
      model.commit();
    }
    finally {
      accessToken.finish();
    }
    assertTrue("GrammarKit src problem", add == (null != facade.findPackage("org.intellij.grammar.psi")));

                ContentEntry[] entries = instance.getContentEntries();
                for (ContentEntry entry : entries) {
                    modifiableModel.removeContentEntry(entry);
                }
                modifiableModel.commit();
            }
        }.execute().throwException();
    }

    @Override

                VirtualFile srcFolder = baseDir.findFileByRelativePath("src");
                if(srcFolder != null) {
                    entry.addSourceFolder(srcFolder, false);
                }

                mrm.commit();
                moduleModel.commit();
            }
        });


    final ModifiableRootModel rootModel = manager.getModifiableModel();
    final Library jarLibrary = rootModel.getModuleLibraryTable().createLibrary();
    final Library.ModifiableModel libraryModel = jarLibrary.getModifiableModel();
    libraryModel.addRoot(jarFile, rootType);
    libraryModel.commit();
    rootModel.commit();
  }


  public PsiFile getFile() {
    return myFile;

      final ModuleRootManager rootManager = ModuleRootManager.getInstance(module);
      ApplicationManager.getApplication().runWriteAction(new Runnable() {
        public void run() {
          final ModifiableRootModel rootModel = rootManager.getModifiableModel();
          rootModel.setJdk(jdk);
          rootModel.commit();
        }
      });
    }
  }

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.