コード例 #1
0
 @Nullable
 public ScriptingLibraryModel lookupLibraryByContent(
     @NotNull Collection<VirtualFile> expectedSourceFiles) {
   ScriptingLibraryModel[] libraryModels = myScriptingLibraryManager.getAllLibraries();
   for (ScriptingLibraryModel libraryModel : libraryModels) {
     if (scriptingLibraryModelConsistsOf(libraryModel, expectedSourceFiles)) {
       return libraryModel;
     }
   }
   return null;
 }
コード例 #2
0
  @NotNull
  public String findAvailableJsLibraryName(@NotNull String initialLibraryName) {
    myScriptingLibraryManager.reset();

    String libraryName = initialLibraryName;
    boolean available = getScriptingLibraryModel(libraryName) == null;
    int id = 1;
    while (!available) {
      libraryName = initialLibraryName + " #" + id;
      available = getScriptingLibraryModel(libraryName) == null;
      id++;
    }
    return libraryName;
  }
コード例 #3
0
 @Nullable
 public ScriptingLibraryModel getScriptingLibraryModel(@NotNull String libraryName) {
   return myScriptingLibraryManager.getLibraryByName(libraryName);
 }