Package com.intellij.openapi.roots.libraries

Examples of com.intellij.openapi.roots.libraries.Library$ModifiableModel


                                          @NotNull Collection<String> binaryPaths,
                                          @NotNull Collection<String> sourcePaths,
                                          @NotNull Collection<String> documentationPaths,
                                          @NotNull DependencyOrder order) {
        LibraryTable libraryTable = ProjectLibraryTable.getInstance(model.getProject());
        Library library = libraryTable.getLibraryByName(libraryName);
        if (library == null) {
            // Create library.
            LibraryTable.ModifiableModel libraryTableModel = libraryTable.getModifiableModel();
            try {
                library = libraryTableModel.createLibrary(libraryName);
View Full Code Here


        if (!data.dartSdkPath.equals(sdk.getHomePath())) {
          DartSdkGlobalLibUtil.updateDartSdkGlobalLib(libraryTableModifiableModel, dartSdkLibName, data.dartSdkPath);
        }
      }

      final Library dartSdkGlobalLib = libraryTableModifiableModel.getLibraryByName(dartSdkLibName);
      assert dartSdkGlobalLib != null;

      if (libraryTableModifiableModel.isChanged()) {
        libraryTableModifiableModel.commit();
      }
View Full Code Here

    ApplicationManager.getApplication().runWriteAction(new Runnable() {
      public void run() {
        final ModifiableRootModel modifiableModel = ModuleRootManager.getInstance(myModule).getModifiableModel();
        try {
          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();
        }
View Full Code Here

          modifiableModel.removeOrderEntry(entry);
        }
      }

      if (paths.size() > 0) {
        final Library library = modifiableModel.getModuleLibraryTable().createLibrary(CUSTOM_PACKAGE_ROOTS_LIB_NAME);
        final Library.ModifiableModel libModel = library.getModifiableModel();
        for (String path : paths) {
          libModel.addRoot(VfsUtilCore.pathToUrl(path), OrderRootType.CLASSES);
        }
        libModel.commit();
      }
View Full Code Here

    int count = 2;
    while (libraryTableModel.getLibraryByName(name) != null) {
      name = DartSdk.DART_SDK_GLOBAL_LIB_NAME + " (" + count++ + ")";
    }

    final Library library = libraryTableModel.createLibrary(name);

    setupDartSdkRoots(library, sdkHomePath);
    return library.getName();
  }
View Full Code Here

  }

  public static void updateDartSdkGlobalLib(final @NotNull LibraryTable.ModifiableModel libraryTableModifiableModel,
                                            final @NotNull String dartSdkGlobalLibName,
                                            final @NotNull String sdkHomePath) {
    final Library library = libraryTableModifiableModel.getLibraryByName(dartSdkGlobalLibName);
    LOG.assertTrue(library != null, dartSdkGlobalLibName);
    setupDartSdkRoots(library, sdkHomePath);
  }
View Full Code Here

  }

  private static void doConfigurePubListPackageDirsLibrary(final Project project,
                                                           final Set<Module> modules,
                                                           final Map<String, Set<String>> packageMap) {
    final Library library = createPubListPackageDirsLibrary(project, packageMap);

    for (final Module module : ModuleManager.getInstance(project).getModules()) {
      final ModifiableRootModel modifiableModel = ModuleRootManager.getInstance(module).getModifiableModel();
      try {
        OrderEntry existingEntry = null;
View Full Code Here

      }
    }
  }

  private static Library createPubListPackageDirsLibrary(final Project project, final Map<String, Set<String>> packageMap) {
    Library library = ProjectLibraryTable.getInstance(project).getLibraryByName(PUB_LIST_PACKAGE_DIRS_LIB_NAME);
    if (library == null) {
      final LibraryTableBase.ModifiableModelEx libTableModel =
        (LibraryTableBase.ModifiableModelEx)ProjectLibraryTable.getInstance(project).getModifiableModel();
      library = libTableModel.createLibrary(PUB_LIST_PACKAGE_DIRS_LIB_NAME, DartListPackageDirsLibraryType.LIBRARY_KIND);
      libTableModel.commit();
    }

    final LibraryEx.ModifiableModelEx libModel = (LibraryEx.ModifiableModelEx)library.getModifiableModel();
    try {
      for (String url : libModel.getUrls(OrderRootType.CLASSES)) {
        libModel.removeRoot(url, OrderRootType.CLASSES);
      }
View Full Code Here

          modifiableModel.dispose();
        }
      }
    }

    final Library library = ProjectLibraryTable.getInstance(project).getLibraryByName(PUB_LIST_PACKAGE_DIRS_LIB_NAME);
    if (library != null) {
      ProjectLibraryTable.getInstance(project).removeLibrary(library);
    }
  }
View Full Code Here

  @Nullable
  private static String getCucumberCoreVersionImpl(Module module) {
    for (OrderEntry orderEntry : ModuleRootManager.getInstance(module).getOrderEntries()) {
      if (orderEntry instanceof LibraryOrderEntry) {
        final String libraryName = ((LibraryOrderEntry)orderEntry).getLibraryName();
        final Library library = ((LibraryOrderEntry)orderEntry).getLibrary();

        //libraryName is null for simple jar entries
        if ((libraryName == null || libraryName.toLowerCase().contains("cucumber")) && library != null) {
          final VirtualFile[] files = library.getFiles(OrderRootType.CLASSES);
          for (VirtualFile file : files) {
            final String version = getVersionByFile(file);
            if (version != null) return version;
          }
        }
View Full Code Here

TOP

Related Classes of com.intellij.openapi.roots.libraries.Library$ModifiableModel

Copyright © 2018 www.massapicom. 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.